spec/support/shared_examples.rb in guard-rails-assets-0.1.5 vs spec/support/shared_examples.rb in guard-rails-assets-0.1.6
- old
+ new
@@ -1,31 +1,29 @@
-shared_examples_for "guard command" do |info|
-
- def set_run_on_option info
+RSpec.shared_examples_for 'guard command' do |info|
+ def run_on_option=(info)
# run_on_change -> change
# run_all -> all
run_option = info[:command].to_s.match(/(.*_)?(\w+)/)[2].to_sym
options[:run_on] = [run_option]
end
it "should execute #{info[:command]} when said so" do
- set_run_on_option info
- subject.should_receive(:compile_assets)
+ self.run_on_option = info
+ expect(subject).to receive(:compile_assets)
subject.send(info[:command])
end
it "should not execute #{info[:command]} when disabled" do
options[:run_on] = [:something_other]
- subject.should_not_receive(:compile_assets)
+ expect(subject).not_to receive(:compile_assets)
subject.send(info[:command])
end
it "should #{info[:run] ? '' : 'not '}execute #{info[:command]} by default" do
options[:run_on] = nil
if info[:run]
- subject.should_receive(:compile_assets)
+ expect(subject).to receive(:compile_assets)
else
- subject.should_not_receive(:compile_assets)
+ expect(subject).not_to receive(:compile_assets)
end
subject.send(info[:command])
end
-
end