spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.3.20 vs spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.3.21
- old
+ new
@@ -8,11 +8,11 @@
module Macros4Cuke # Open the module to avoid lengthy qualified names
describe MacroStep do
- let(:sample_phrase) { "enter my credentials as <userid>" }
+ let(:sample_phrase) { 'enter my credentials as <userid>' }
let(:sample_template) do
snippet = <<-SNIPPET
Given I landed in the homepage
When I click "Sign in"
@@ -26,51 +26,51 @@
# Default instantiation rule
subject { MacroStep.new(sample_phrase, sample_template, true) }
- context "Creation & initialization" do
- it "should be created with a phrase, substeps and a table use indicator" do
+ context 'Creation & initialization:' do
+ it 'should be created with a phrase, substeps and a table use indicator' do
->(){ MacroStep.new(sample_phrase, sample_template, true) }.should_not raise_error
end
- it "should complain when a sub-step argument can never be assigned a value via the phrase" do
+ it 'should complain when a sub-step argument can never be assigned a value via the phrase' do
msg = "The sub-step argument 'password' does not appear in the phrase."
->(){ MacroStep.new(sample_phrase, sample_template, false) }.should raise_error(
Macros4Cuke::UnreachableSubstepArgument, msg)
end
- it "should complain when an argument in phrase never occurs in substeps" do
- phrase = "enter my credentials as <foobar>"
+ it 'should complain when an argument in phrase never occurs in substeps' do
+ phrase = 'enter my credentials as <foobar>'
msg = "The phrase argument 'foobar' does not appear in a sub-step."
->(){ MacroStep.new(phrase, sample_template, true) }.should raise_error(
Macros4Cuke::UselessPhraseArgument, msg)
end
- it "should know its key" do
- subject.key.should == "enter_my_credentials_as_X_T"
+ it 'should know its key' do
+ subject.key.should == 'enter_my_credentials_as_X_T'
end
- it "should know the tags(placeholders) from its phrase" do
+ it 'should know the tags(placeholders) from its phrase' do
subject.phrase_args.should == %w[userid]
end
- it "should know the tags(placeholders) from its phrase and template" do
+ it 'should know the tags(placeholders) from its phrase and template' do
subject.args.should == %w[userid password]
end
end # context
- context "Provided services" do
+ context 'Provided services:' do
let(:phrase_instance) { %Q|enter my credentials as "nobody"| }
- it "should render the substeps" do
+ 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"
And I fill in "Username" with "nobody"
@@ -79,11 +79,11 @@
SNIPPET
text.should == expectation
end
- it "should render steps even when one argument has no actual value" do
+ it 'should render steps even when one argument has no actual value' do
# Special case: password has no value...
text = subject.expand(phrase_instance, [ ])
expectation = <<-SNIPPET
Given I landed in the homepage
When I click "Sign in"
@@ -93,11 +93,11 @@
SNIPPET
text.should == expectation
end
- it "should un-escape the double-quotes for phrase arguments" do
+ 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
When I click "Sign in"
@@ -108,20 +108,20 @@
text.should == expectation
end
- it "should complain when an unknown variable is used" do
+ 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"
+ it 'should expand built-in variables' do
+ phrase = 'do nothing useful'
substeps = <<-SNIPPET
Given I travel through:
<quotes>
London
Paris
\ No newline at end of file