Skip to content

Commit

Permalink
Convert specs to RSpec 2.14.8 syntax with Transpec
Browse files Browse the repository at this point in the history
This conversion is done by Transpec 2.3.1 with the following command:
    transpec

* 19 conversions
    from: obj.should
      to: expect(obj).to

* 7 conversions
    from: =~ /pattern/
      to: match(/pattern/)

* 3 conversions
    from: == expected
      to: eq(expected)

* 2 conversions
    from: its(:attr) { }
      to: describe '#attr' do subject { super().attr }; it { } end

* 1 conversion
    from: obj.should_not
      to: expect(obj).not_to

For more details: https://github.com/yujinakayama/transpec#supported-conversions
  • Loading branch information
ixti committed Jun 22, 2014
1 parent eed64a9 commit 66dbc08
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion spec/lib/jekyll-assets/bootstrap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe "Bootstrap integration" do
it "should globally append bootstrap paths into Sprockets environment" do
@site.assets["bootstrap.css"].to_s.should =~ /bootstrap\//
expect(@site.assets["bootstrap.css"].to_s).to match(/bootstrap\//)
end
end
2 changes: 1 addition & 1 deletion spec/lib/jekyll-assets/bourbon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe "Bourbon integration" do
it "should globally append bourbon paths into Sprockets environment" do
@site.assets["vendor/bourbon.css"].to_s.should =~ /linear-gradient/
expect(@site.assets["vendor/bourbon.css"].to_s).to match(/linear-gradient/)
end
end
2 changes: 1 addition & 1 deletion spec/lib/jekyll-assets/compass_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe "Compass integration" do
it "should globally append compass paths into Sprockets environment" do
@site.assets["vendor/compass.css"].to_s.should =~ /linear-gradient/
expect(@site.assets["vendor/compass.css"].to_s).to match(/linear-gradient/)
end
end
2 changes: 1 addition & 1 deletion spec/lib/jekyll-assets/font-awesome_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe "Font Awesome integration" do
it "should globally append font awesome paths into Sprockets environment" do
@site.assets["font-awesome.css"].to_s.should =~ /fa-github/
expect(@site.assets["font-awesome.css"].to_s).to match(/fa-github/)
end
end
2 changes: 1 addition & 1 deletion spec/lib/jekyll-assets/neat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

describe "Neat integration" do
it "should globally append neat paths into Sprockets environment" do
@site.assets["vendor/neat.css"].to_s.should =~ /max-width/
expect(@site.assets["vendor/neat.css"].to_s).to match(/max-width/)
end
end
23 changes: 15 additions & 8 deletions spec/lib/jekyll/assets_plugin/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,23 @@
context "when specified as String" do
it "should override default cache path" do
config = described_class.new :cache => "/tmp/jekyll-assets"
config.cache_path.should == "/tmp/jekyll-assets"
expect(config.cache_path).to eq("/tmp/jekyll-assets")
end
end
end

context "#baseurl" do
it "should respect explicit overrides" do
described_class.new({
expect(described_class.new({
:dirname => "foo",
:baseurl => "/bar/"
}).baseurl.should == "/bar"
}).baseurl).to eq("/bar")
end

it "should be auto-guessed from dirname" do
described_class.new({
expect(described_class.new({
:dirname => "foo"
}).baseurl.should == "/foo"
}).baseurl).to eq("/foo")
end
end

Expand Down Expand Up @@ -152,15 +152,22 @@
{ :compress => { :js => "uglify", :css => "sass" } }
end

its(:js_compressor) { should be :uglify }
its(:css_compressor) { should be :sass }
describe '#js_compressor' do
subject { super().js_compressor }
it { should be :uglify }
end

describe '#css_compressor' do
subject { super().css_compressor }
it { should be :sass }
end
end

context "cache_assets" do
let(:options) { { :cache_assets => true } }

it "should set `cache` value" do
config.cache_assets?.should be_true
expect(config.cache_assets?).to be_true
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/jekyll/assets_plugin/environment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ module AssetsPlugin
context "#asset_path of context" do
it "should properly handle query params" do
css = @site.assets["vapor.css"].to_s
css.should match(/fonts\/vapor-[a-f0-9]{32}\.eot\?#iefix/)
css.should match(/fonts\/vapor-[a-f0-9]{32}\.svg#iefix/)
expect(css).to match(/fonts\/vapor-[a-f0-9]{32}\.eot\?#iefix/)
expect(css).to match(/fonts\/vapor-[a-f0-9]{32}\.svg#iefix/)
end

it "should properly handle relative paths" do
css = @site.assets["lib/relative.css"].to_s
css.should =~ %r{/assets/fonts/vapor-[a-f0-9]{32}\.eot\?#iefix}
css.should =~ %r{/assets/fonts/vapor-[a-f0-9]{32}\.svg#iefix}
expect(css).to match(%r{/assets/fonts/vapor-[a-f0-9]{32}\.eot\?#iefix})
expect(css).to match(%r{/assets/fonts/vapor-[a-f0-9]{32}\.svg#iefix})
puts css
end
end
Expand Down
14 changes: 7 additions & 7 deletions spec/lib/jekyll/assets_plugin/patches/site_patch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@
it { should be_an_instance_of Jekyll::AssetsPlugin::Configuration }

it "should been populated with `assets` section of config" do
site.assets_config.dirname.should_not eq "foobar"
site.assets_config.sources.should include "foobar"
expect(site.assets_config.dirname).not_to eq "foobar"
expect(site.assets_config.sources).to include "foobar"
end
end

it "should regenerate assets upon multiple #process" do
@site.assets_config.cachebust = :none
2.times { @site.process }
@dest.join("assets", "app.css").exist?.should be_true
expect(@dest.join("assets", "app.css").exist?).to be_true
end

context "with cache" do
Expand All @@ -141,7 +141,7 @@ def site

it "should regenerate static assets upon multiple #process" do
2.times { site.process }
@dest.join("assets", "noise.png").exist?.should be_true
expect(@dest.join("assets", "noise.png").exist?).to be_true
end
end

Expand All @@ -151,18 +151,18 @@ def site
it "should generate a static assets if gzip is enabled" do
@site.assets_config.gzip = true
@site.process
@dest.join("assets", "app.css.gz").exist?.should be_true
expect(@dest.join("assets", "app.css.gz").exist?).to be_true
end

it "should not generate a static assets if gzip is enabled" do
@site.assets_config.gzip = false
@site.process
@dest.join("assets", "app.css.gz").exist?.should be_false
expect(@dest.join("assets", "app.css.gz").exist?).to be_false
end

end

it "should be included into Jekyll::Site" do
Jekyll::Site.included_modules.should include described_class
expect(Jekyll::Site.included_modules).to include described_class
end
end

0 comments on commit 66dbc08

Please sign in to comment.