Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ be cucumber features/subject/attribute_of_subject.feature:104 --format pretty
- Using the default profile...
- Feature: attribute of subject
- Use the its() method as a short-hand to generate a nested example group with
- a single example that specifies the expected value of an attribute of the
- subject. This can be used with an implicit or explicit subject.
- its() accepts a symbol or a string, and a block representing the example.
- its(:size) { should eq(1) }
- its("length") { should eq(1) }
- You can use a string with dots to specify a nested attribute (i.e. an
- attribute of the attribute of the subject).
- its("phone_numbers.size") { should eq(2) }
- When the subject is a hash, you can pass in an array with a single key to
- access the value at that key in the hash.
- its([:key]) { should eq(value) }
- Scenario: specify value for key in a hash-like object # features/subject/attribute_of_subject.feature:104
- Given a file named "example_spec.rb" with: # aruba-0.2.2/lib/aruba/cucumber.rb:66
- """
- require 'matrix'
- describe Matrix do
- context "with values [[1, 2] [3, 4]]" do
- subject do
- Matrix[[1, 2] [3, 4]]
- end
- its([0, 1]) { should eq(2) }
- its([1, 0]) { should eq(3) }
- its([1, 2]) { should be_nil }
- end
- end
- """
- When I run "rspec example_spec.rb" # aruba-0.2.2/lib/aruba/cucumber.rb:90
- Then the examples should all pass # features/step_definitions/additional_cli_steps.rb:13
- expected: /0\ failures/
- got: "FFF\n\nFailures:\n\n 1) Matrix with values [[1, 2] [3, 4]] 01 \n Failure/Error: its([0, 1]) { should eq(2) }\n NoMethodError:\n undefined method `[]' for nil:NilClass\n # ./example_spec.rb:9\n\n 2) Matrix with values [[1, 2] [3, 4]] 10 \n Failure/Error: its([1, 0]) { should eq(3) }\n NoMethodError:\n undefined method `[]' for nil:NilClass\n # ./example_spec.rb:10\n\n 3) Matrix with values [[1, 2] [3, 4]] 12 \n Failure/Error: its([1, 2]) { should be_nil }\n NoMethodError:\n undefined method `[]' for nil:NilClass\n # ./example_spec.rb:11\n\nFinished in 0.00195 seconds\n3 examples, 3 failures\n" (using =~)
- Diff:
- @@ -1,2 +1,25 @@
- -/0\ failures/
- +FFF
- +
- +Failures:
- +
- + 1) Matrix with values [[1, 2] [3, 4]] 01
- + Failure/Error: its([0, 1]) { should eq(2) }
- + NoMethodError:
- + undefined method `[]' for nil:NilClass
- + # ./example_spec.rb:9
- +
- + 2) Matrix with values [[1, 2] [3, 4]] 10
- + Failure/Error: its([1, 0]) { should eq(3) }
- + NoMethodError:
- + undefined method `[]' for nil:NilClass
- + # ./example_spec.rb:10
- +
- + 3) Matrix with values [[1, 2] [3, 4]] 12
- + Failure/Error: its([1, 2]) { should be_nil }
- + NoMethodError:
- + undefined method `[]' for nil:NilClass
- + # ./example_spec.rb:11
- +
- +Finished in 0.00195 seconds
- +3 examples, 3 failures
- (RSpec::Expectations::ExpectationNotMetError)
- features/subject/attribute_of_subject.feature:122:in `Then the examples should all pass'
- Failing Scenarios:
- cucumber features/subject/attribute_of_subject.feature:104 # Scenario: specify value for key in a hash-like object
- 1 scenario (1 failed)
- 3 steps (1 failed, 2 passed)
- 0m0.653s
Add Comment
Please, Sign In to add comment