Sha256: 614c62cbae96aa9f749208b2ddc255b04447e8e13df3ecef1700855b6cda9f77

Contents?: true

Size: 937 Bytes

Versions: 5

Compression:

Stored size: 937 Bytes

Contents

require "spec_helper"

describe Array do
  before(:each) do
    @array = %w[app.js jquery.js bootstrap.css reset.css vendor.js]
  end

  describe :sort do
    it "won't change when before and after are empty array" do
      @array.sort_by_before_and_after([], []).should be_equal @array
    end

    it "will change by before items" do
      @array.sort_by_before_and_after(["jquery.js", "vendor.js"], [])
      @array.should =~ %w[jquery.js vendor.js app.js bootstrap.css reset.css]
    end

    it "will change by after items" do
      @array.sort_by_before_and_after([], ["reset.css", "bootstrap.css"])
      @array.should =~ %w[app.js jquery.js vendor.js reset.css bootstrap.css]
    end

    it "will change by before and after items" do
      @array.sort_by_before_and_after(["jquery.js", "vendor.js"], ["reset.css", "bootstrap.css"])
      @array.should =~ %w[jquery.js vendor.js app.js reset.css bootstrap.css]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
linner-0.1.5 spec/linner/helper_spec.rb
linner-0.1.4 spec/linner/helper_spec.rb
linner-0.1.3 spec/linner/helper_spec.rb
linner-0.1.2 spec/linner/helper_spec.rb
linner-0.1.1 spec/linner/helper_spec.rb