Sha256: 7b56da07c1f376f11a2c065b934687409fa8236bb7e6aeac97ae9fd50b5de0fd

Contents?: true

Size: 995 Bytes

Versions: 16

Compression:

Stored size: 995 Bytes

Contents

require 'spec_helper'
require 'roadie/rspec'

describe TestProvider do
  subject(:provider) { TestProvider.new }

  it_behaves_like "roadie asset provider", valid_name: "existing.css", invalid_name: "invalid.css" do
    subject { TestProvider.new "existing.css" => "" }
  end

  it "finds styles from a predefined hash" do
    provider = TestProvider.new({
      "foo.css" => "a { color: red; }",
      "bar.css" => "body { color: green; }",
    })
    expect(provider.find_stylesheet("foo.css").to_s).not_to include("body")
    expect(provider.find_stylesheet("bar.css").to_s).to include("body")
    expect(provider.find_stylesheet("baz.css")).to be_nil
  end

  it "can have a default for missing entries" do
    provider = TestProvider.new({
      "foo.css" => "a { color: red; }",
      :default  => "body { color: green; }",
    })
    expect(provider.find_stylesheet("foo.css").to_s).not_to include("body")
    expect(provider.find_stylesheet("bar.css").to_s).to include("body")
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
roadie-3.5.1 spec/lib/roadie/test_provider_spec.rb
roadie-3.5.0 spec/lib/roadie/test_provider_spec.rb
roadie-3.4.0 spec/lib/roadie/test_provider_spec.rb
roadie-3.3.0 spec/lib/roadie/test_provider_spec.rb
roadie-3.2.2 spec/lib/roadie/test_provider_spec.rb
roadie-3.2.1 spec/lib/roadie/test_provider_spec.rb
roadie-3.2.0 spec/lib/roadie/test_provider_spec.rb
roadie-3.1.1 spec/lib/roadie/test_provider_spec.rb
roadie-3.1.0 spec/lib/roadie/test_provider_spec.rb
roadie-3.1.0.rc1 spec/lib/roadie/test_provider_spec.rb
roadie-3.0.5 spec/lib/roadie/test_provider_spec.rb
roadie-3.0.4 spec/lib/roadie/test_provider_spec.rb
roadie-3.0.3 spec/lib/roadie/test_provider_spec.rb
roadie-3.0.2 spec/lib/roadie/test_provider_spec.rb
roadie-3.0.1 spec/lib/roadie/test_provider_spec.rb
roadie-3.0.0 spec/lib/roadie/test_provider_spec.rb