From 6b6d5cee66f8f6e66004b0ba277525ec356b4f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Mon, 8 Apr 2013 14:58:37 +0200 Subject: [PATCH] RSpec are now sensitive to stub order (which is nice thing). --- .../appliance-definition-helper-spec.rb | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/spec/helpers/appliance-definition-helper-spec.rb b/spec/helpers/appliance-definition-helper-spec.rb index 5cc94d1..28407e6 100644 --- a/spec/helpers/appliance-definition-helper-spec.rb +++ b/spec/helpers/appliance-definition-helper-spec.rb @@ -80,9 +80,9 @@ def prepare_helper appliance_b.name = 'b' File.should_receive(:exists?).ordered.with('a.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./b.appl').and_return(true) - @helper.appliance_parser.should_receive(:parse_definition).ordered.with('a.appl').and_return(appliance_a) + + File.should_receive(:exists?).ordered.with('./b.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./b.appl').and_return(appliance_b) @helper.read_definitions("a.appl") @@ -115,15 +115,18 @@ def prepare_helper appliance_c2.name = 'c2' File.should_receive(:exists?).ordered.with('a.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./b2.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./c2.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./b1.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./c1.appl').and_return(true) - @helper.appliance_parser.should_receive(:parse_definition).ordered.with('a.appl').and_return(appliance_a) + + File.should_receive(:exists?).ordered.with('./b2.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./b2.appl').and_return(appliance_b2) + + File.should_receive(:exists?).ordered.with('./c2.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./c2.appl').and_return(appliance_c2) + + File.should_receive(:exists?).ordered.with('./b1.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./b1.appl').and_return(appliance_b1) + + File.should_receive(:exists?).ordered.with('./c1.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./c1.appl').and_return(appliance_c1) @helper.read_definitions("a.appl") @@ -154,13 +157,15 @@ def prepare_helper appliance_c.name = 'c' File.should_receive(:exists?).ordered.with('a.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./b2.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./c.appl').and_return(true) - File.should_receive(:exists?).ordered.with('./b1.appl').and_return(true) - @helper.appliance_parser.should_receive(:parse_definition).ordered.with('a.appl').and_return(appliance_a) + + File.should_receive(:exists?).ordered.with('./b2.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./b2.appl').and_return(appliance_b2) + + File.should_receive(:exists?).ordered.with('./c.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.once.with('./c.appl').and_return(appliance_c) + + File.should_receive(:exists?).ordered.with('./b1.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./b1.appl').and_return(appliance_b1) @helper.read_definitions("a.appl") @@ -229,11 +234,13 @@ def prepare_helper File.should_receive(:exists?).with('a.appl').and_return(true) - File.should_receive(:exists?).with('./b.appl').and_return(true) - File.should_not_receive(:exists?).ordered.with('./a.appl') - @helper.appliance_parser.should_receive(:parse_definition).ordered.with('a.appl').and_return(appliance_a) + + + File.should_receive(:exists?).with('./b.appl').and_return(true) @helper.appliance_parser.should_receive(:parse_definition).ordered.with('./b.appl').and_return(appliance_b) + + File.should_not_receive(:exists?).ordered.with('./a.appl') @helper.appliance_parser.should_not_receive(:parse_definition).ordered.with('./a.appl') @helper.read_definitions("a.appl")