few components with rspec3 syntax

This commit is contained in:
Luciano Sousa
2015-01-09 13:34:37 -03:00
parent c96220ca76
commit 0fd98b56d8
97 changed files with 1620 additions and 1618 deletions

View File

@ -10,16 +10,16 @@ describe Plugin::Instance do
context "find_all" do
it "can find plugins correctly" do
plugins = Plugin::Instance.find_all("#{Rails.root}/spec/fixtures/plugins")
plugins.count.should == 1
expect(plugins.count).to eq(1)
plugin = plugins[0]
plugin.name.should == "plugin-name"
plugin.path.should == "#{Rails.root}/spec/fixtures/plugins/my_plugin/plugin.rb"
expect(plugin.name).to eq("plugin-name")
expect(plugin.path).to eq("#{Rails.root}/spec/fixtures/plugins/my_plugin/plugin.rb")
end
it "does not blow up on missing directory" do
plugins = Plugin::Instance.find_all("#{Rails.root}/frank_zappa")
plugins.count.should == 0
expect(plugins.count).to eq(0)
end
end
@ -31,8 +31,8 @@ describe Plugin::Instance do
plugin.send :register_assets!
DiscoursePluginRegistry.mobile_stylesheets.count.should == 0
DiscoursePluginRegistry.stylesheets.count.should == 2
expect(DiscoursePluginRegistry.mobile_stylesheets.count).to eq(0)
expect(DiscoursePluginRegistry.stylesheets.count).to eq(2)
end
end
@ -46,18 +46,18 @@ describe Plugin::Instance do
File.open("#{plugin.auto_generated_path}/junk", "w") {|f| f.write("junk")}
plugin.activate!
plugin.auth_providers.count.should == 1
expect(plugin.auth_providers.count).to eq(1)
auth_provider = plugin.auth_providers[0]
auth_provider.authenticator.name.should == 'ubuntu'
expect(auth_provider.authenticator.name).to eq('ubuntu')
# calls ensure_assets! make sure they are there
plugin.assets.count.should == 1
expect(plugin.assets.count).to eq(1)
plugin.assets.each do |a, opts|
File.exists?(a).should == true
expect(File.exists?(a)).to eq(true)
end
# ensure it cleans up all crap in autogenerated directory
File.exists?(junk_file).should == false
expect(File.exists?(junk_file)).to eq(false)
end
it "finds all the custom assets" do
@ -82,13 +82,13 @@ describe Plugin::Instance do
plugin.activate!
DiscoursePluginRegistry.javascripts.count.should == 3
DiscoursePluginRegistry.admin_javascripts.count.should == 2
DiscoursePluginRegistry.server_side_javascripts.count.should == 1
DiscoursePluginRegistry.desktop_stylesheets.count.should == 2
DiscoursePluginRegistry.sass_variables.count.should == 2
DiscoursePluginRegistry.stylesheets.count.should == 2
DiscoursePluginRegistry.mobile_stylesheets.count.should == 1
expect(DiscoursePluginRegistry.javascripts.count).to eq(3)
expect(DiscoursePluginRegistry.admin_javascripts.count).to eq(2)
expect(DiscoursePluginRegistry.server_side_javascripts.count).to eq(1)
expect(DiscoursePluginRegistry.desktop_stylesheets.count).to eq(2)
expect(DiscoursePluginRegistry.sass_variables.count).to eq(2)
expect(DiscoursePluginRegistry.stylesheets.count).to eq(2)
expect(DiscoursePluginRegistry.mobile_stylesheets.count).to eq(1)
end
end
@ -100,7 +100,7 @@ describe Plugin::Instance do
user.save!
payload = JSON.parse(CurrentUserSerializer.new(user, scope: Guardian.new(user)).to_json)
payload["current_user"]["custom_fields"]["has_car"].should == "true"
expect(payload["current_user"]["custom_fields"]["has_car"]).to eq("true")
end
end
@ -111,7 +111,7 @@ describe Plugin::Instance do
plugin.register_color_scheme("Purple", {primary: 'EEE0E5'})
plugin.notify_after_initialize
}.to change { ColorScheme.count }.by(1)
ColorScheme.where(name: "Purple").should be_present
expect(ColorScheme.where(name: "Purple")).to be_present
end
it "doesn't add the same color scheme twice" do