spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.3.17 vs spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.3.18
- old
+ new
@@ -92,11 +92,11 @@
And I click "Submit"
SNIPPET
text.should == expectation
end
-
+
it "should un-escape the double-quotes for phrase arguments" do
specific_phrase = %q|enter my credentials as "quotable\""|
text = subject.expand(specific_phrase, [ %w(password no-secret) ])
expectation = <<-SNIPPET
Given I landed in the homepage
@@ -107,17 +107,36 @@
SNIPPET
text.should == expectation
end
-
+
it "should complain when an unknown variable is used" do
# Error case: there is no macro argument called <unknown>
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 expand built-in variables" do
+ phrase = "do nothing useful"
+ substeps = <<-SNIPPET
+ Given I travel through:
+ <quotes>
+ London
+ Paris
+ San Francisco
+ <quotes>
+SNIPPET
+
+ 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