spec/macros4cuke/templating/engine_spec.rb in macros4cuke-0.3.26 vs spec/macros4cuke/templating/engine_spec.rb in macros4cuke-0.3.27
- old
+ new
@@ -15,11 +15,10 @@
describe Engine do
# Sample template (consisting of a sequence of steps)
let(:sample_template) do
source = <<-SNIPPET
Given I landed in the homepage
- # The credentials are entered here
And I fill in "Username" with "<userid>"
And I fill in "Password" with "<password>"
And I click "Sign in"
SNIPPET
@@ -258,53 +257,39 @@
instance = Engine.new ''
expect(instance.variables).to be_empty
end
- it 'should ignore variables/placeholders in comments' do
- substeps = " # Comment 1 <miscellaneous>\n" + sample_template
- substeps += " #\n Comment 2 <haphazard>"
- instance = Engine.new substeps
- # expect(instance.variables).to eq([:userid, :password])
- end
-
-
it 'should render the text given the actuals' do
locals = { 'userid' => 'johndoe' }
rendered_text = subject.render(Object.new, locals)
expected = <<-SNIPPET
Given I landed in the homepage
- # The credentials are entered here
And I fill in "Username" with "johndoe"
And I fill in "Password" with ""
And I click "Sign in"
SNIPPET
-
expect(rendered_text).to eq(expected)
# Case of an actual that's not a String
locals = { 'userid' => 'johndoe', 'password' => 12345 }
rendered_text = subject.render(Object.new, locals)
expected = <<-SNIPPET
Given I landed in the homepage
- # The credentials are entered here
And I fill in "Username" with "johndoe"
And I fill in "Password" with "12345"
And I click "Sign in"
SNIPPET
-
expect(rendered_text).to eq(expected)
-
# Place actual value in context object
Context = Struct.new(:userid, :password)
context = Context.new('sherlock', 'holmes')
rendered_text = subject.render(context, { 'userid' => 'susan' })
expected = <<-SNIPPET
Given I landed in the homepage
- # The credentials are entered here
And I fill in "Username" with "susan"
And I fill in "Password" with "holmes"
And I click "Sign in"
SNIPPET
@@ -354,10 +339,9 @@
locals = { 'userid' => %w(johndoe yeti) } # Silly case
rendered_text = subject.render(Object.new, locals)
expected = <<-SNIPPET
Given I landed in the homepage
- # The credentials are entered here
And I fill in "Username" with "johndoe<br/>yeti"
And I fill in "Password" with ""
And I click "Sign in"
SNIPPET
\ No newline at end of file