spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.3.24 vs spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.3.25
- old
+ new
@@ -65,11 +65,10 @@
context 'Provided services:' do
let(:phrase_instance) { %Q|enter my credentials as "nobody"| }
-
it 'should render the substeps' do
text = subject.expand(phrase_instance, [ %w(password no-secret) ])
expectation = <<-SNIPPET
Given I landed in the homepage
When I click "Sign in"
@@ -115,10 +114,20 @@
error_message = "Unknown macro-step argument 'unknown'."
args = [ %w(unknown anything) ]
->(){ subject.expand(phrase_instance, args) }.should raise_error(
UnknownArgumentError, error_message)
end
+
+
+ it 'should complain when argument gets a value from phrase and table' do
+ # Error case: there is no macro argument called <unknown>
+ phrase = %Q|enter my credentials as "nobody"|
+ msg = "The macro argument 'userid' has value 'nobody' and 'valueTable'."
+ args = [ %w(userid someone), %w(password no-secret) ]
+ ->(){ subject.expand(phrase, args) }.should raise_error(
+ AmbiguousArgumentValue, msg)
+ end
it 'should expand built-in variables' do
phrase = 'do nothing useful'
substeps = <<-SNIPPET
@@ -133,10 +142,10 @@
instance = MacroStep.new(phrase, substeps, true)
actual = instance.expand(phrase, [])
expected = substeps.gsub(/<quotes>/, '"""')
actual.should == expected
end
-
+
end # context
end # describe
\ No newline at end of file