| 1 |
|
| 2 |
|
| 3 |
require_relative "spec_helper" |
| 4 |
|
| 5 |
describe AutoprefixedRails::Railtie do |
| 6 |
before do |
| 7 |
@railtie = AutoprefixedRails::Railtie.instance |
| 8 |
end |
| 9 |
|
| 10 |
context "with config/autoprefixer.yml" do |
| 11 |
it "works" do |
| 12 |
expect(@railtie.config).to eq(cascade: false, supports: false, env: "test") |
| 13 |
end |
| 14 |
end |
| 15 |
|
| 16 |
context "with empty config/autoprefixer.yml" do |
| 17 |
before do |
| 18 |
file_path = File.join(Rails.application.root, "config/autoprefixer.yml") |
| 19 |
allow(File).to receive(:exists?).with(file_path) { true } |
| 20 |
allow(::YAML).to receive(:load_file).with(file_path) { false } |
| 21 |
end |
| 22 |
|
| 23 |
it "skips empty YAML" do |
| 24 |
expect { @railtie.config }.not_to raise_error |
| 25 |
end |
| 26 |
|
| 27 |
it "works" do |
| 28 |
expect(@railtie.config).to eq(env: "test") |
| 29 |
end |
| 30 |
end |
| 31 |
end |