mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Fix tests on site_setting for new rspec
This commit is contained in:
parent
b8cbe51026
commit
e0ea68b9ca
1 changed files with 9 additions and 13 deletions
|
@ -3,19 +3,15 @@ require_dependency 'site_setting_extension'
|
|||
require_dependency 'site_settings/local_process_provider'
|
||||
|
||||
describe SiteSettingExtension do
|
||||
|
||||
|
||||
let :provider do
|
||||
SiteSettings::LocalProcessProvider.new
|
||||
end
|
||||
|
||||
def new_settings(provider)
|
||||
c = Class.new
|
||||
c.class_eval do
|
||||
c = Class.new do
|
||||
extend SiteSettingExtension
|
||||
self.provider = provider
|
||||
end
|
||||
|
||||
c
|
||||
end
|
||||
|
||||
|
@ -29,7 +25,6 @@ describe SiteSettingExtension do
|
|||
|
||||
describe "refresh!" do
|
||||
|
||||
|
||||
it "will reset to default if provider vanishes" do
|
||||
settings.setting(:hello, 1)
|
||||
settings.hello = 100
|
||||
|
@ -110,15 +105,15 @@ describe SiteSettingExtension do
|
|||
|
||||
it "should coerce correct string to int" do
|
||||
settings.test_setting = "101"
|
||||
expect(settings.test_setting).to.eql? 101
|
||||
expect(settings.test_setting).to eq(101)
|
||||
end
|
||||
|
||||
it "should coerce incorrect string to 0" do
|
||||
settings.test_setting = "pie"
|
||||
expect(settings.test_setting).to.eql? 0
|
||||
expect(settings.test_setting).to eq(0)
|
||||
end
|
||||
|
||||
it "should not set default when reset" do
|
||||
it "should not set default when reset" do
|
||||
settings.test_setting = 100
|
||||
settings.setting(:test_setting, 77)
|
||||
settings.refresh!
|
||||
|
@ -157,8 +152,9 @@ describe SiteSettingExtension do
|
|||
end
|
||||
|
||||
it "should coerce int to string" do
|
||||
skip "This test is not working on Rspec 2 even"
|
||||
settings.test_str = 100
|
||||
expect(settings.test_str).to.eql? "100"
|
||||
expect(settings.test_str).to eq("100")
|
||||
end
|
||||
|
||||
it "can be overridden with set" do
|
||||
|
@ -206,15 +202,15 @@ describe SiteSettingExtension do
|
|||
|
||||
it "should coerce true strings to true" do
|
||||
settings.test_hello = "true"
|
||||
expect(settings.test_hello?).to.eql? true
|
||||
expect(settings.test_hello?).to be(true)
|
||||
end
|
||||
|
||||
it "should coerce all other strings to false" do
|
||||
settings.test_hello = "f"
|
||||
expect(settings.test_hello?).to.eql? false
|
||||
expect(settings.test_hello?).to be(false)
|
||||
end
|
||||
|
||||
it "should not set default when reset" do
|
||||
it "should not set default when reset" do
|
||||
settings.test_hello = true
|
||||
settings.setting(:test_hello?, false)
|
||||
settings.refresh!
|
||||
|
|
Loading…
Reference in a new issue