spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.3.42 vs spec/macros4cuke/macro-step_spec.rb in macros4cuke-0.4.00
- old
+ new
@@ -18,26 +18,30 @@
And I fill in "Username" with "<userid>"
And I fill in "Password" with "<password>"
And I click "Submit"
SNIPPET
- snippet
-end
+ snippet
+ end
# 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
- expect { MacroStep.new(sample_phrase, sample_template, true) }.not_to raise_error
+ phrase = sample_phrase
+ template = sample_template
+ expect { MacroStep.new(phrase, template, true) }.not_to 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' do
+ phrase = sample_phrase
+ template = sample_template
msg = "The sub-step argument 'password' does not appear in the phrase."
- expect { MacroStep.new(sample_phrase, sample_template, false) }.to raise_error(
+ expect { MacroStep.new(phrase, template, false) }.to raise_error(
Macros4Cuke::UnreachableSubstepArgument, msg)
end
it 'should complain when an argument in phrase never occurs in substeps' do
@@ -45,10 +49,13 @@
msg = "The phrase argument 'foobar' does not appear in a sub-step."
expect { MacroStep.new(phrase, sample_template, true) }.to raise_error(
Macros4Cuke::UselessPhraseArgument, msg)
end
-
+ it 'should know its phrase' do
+ expect(subject.phrase).to eq(sample_phrase)
+ end
+
it 'should know its key' do
expect(subject.key).to eq('enter_my_credentials_as_X_T')
end
it 'should know the tags(placeholders) from its phrase' do