forked from shakacode/shakapacker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compiler_strategy_spec.rb
22 lines (18 loc) · 1.05 KB
/
compiler_strategy_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require_relative "spec_helper_initializer"
describe "Shakapacker::CompilerStrategy" do
describe "#from_config" do
it "returns and instance of MtimeStrategy when compiler_strategy is set to mtime" do
allow(Shakapacker.config).to receive(:compiler_strategy).and_return("mtime")
expect(Shakapacker::CompilerStrategy.from_config).to be_an_instance_of(Shakapacker::MtimeStrategy)
end
it "returns and instance of DigestStrategy when compiler_strategy is set to digest" do
allow(Shakapacker.config).to receive(:compiler_strategy).and_return("digest")
expect(Shakapacker::CompilerStrategy.from_config).to be_an_instance_of(Shakapacker::DigestStrategy)
end
it "raise exception for unknown compiler_strategy in the config file" do
expected_error_message = "Unknown strategy 'other'. Available options are 'mtime' and 'digest'."
allow(Shakapacker.config).to receive(:compiler_strategy).and_return("other")
expect { Shakapacker::CompilerStrategy.from_config }.to raise_error(expected_error_message)
end
end
end