Guest User

Untitled

a guest
Jul 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. $ be cucumber features/subject/attribute_of_subject.feature:104 --format pretty
  2. Using the default profile...
  3. Feature: attribute of subject
  4. Use the its() method as a short-hand to generate a nested example group with
  5. a single example that specifies the expected value of an attribute of the
  6. subject. This can be used with an implicit or explicit subject.
  7.  
  8. its() accepts a symbol or a string, and a block representing the example.
  9.  
  10. its(:size) { should eq(1) }
  11. its("length") { should eq(1) }
  12.  
  13. You can use a string with dots to specify a nested attribute (i.e. an
  14. attribute of the attribute of the subject).
  15.  
  16. its("phone_numbers.size") { should eq(2) }
  17.  
  18. When the subject is a hash, you can pass in an array with a single key to
  19. access the value at that key in the hash.
  20.  
  21. its([:key]) { should eq(value) }
  22.  
  23. Scenario: specify value for key in a hash-like object # features/subject/attribute_of_subject.feature:104
  24. Given a file named "example_spec.rb" with: # aruba-0.2.2/lib/aruba/cucumber.rb:66
  25. """
  26. require 'matrix'
  27.  
  28. describe Matrix do
  29. context "with values [[1, 2] [3, 4]]" do
  30. subject do
  31. Matrix[[1, 2] [3, 4]]
  32. end
  33.  
  34. its([0, 1]) { should eq(2) }
  35. its([1, 0]) { should eq(3) }
  36. its([1, 2]) { should be_nil }
  37. end
  38. end
  39. """
  40. When I run "rspec example_spec.rb" # aruba-0.2.2/lib/aruba/cucumber.rb:90
  41. Then the examples should all pass # features/step_definitions/additional_cli_steps.rb:13
  42. expected: /0\ failures/
  43. 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 =~)
  44. Diff:
  45. @@ -1,2 +1,25 @@
  46. -/0\ failures/
  47. +FFF
  48. +
  49. +Failures:
  50. +
  51. + 1) Matrix with values [[1, 2] [3, 4]] 01
  52. + Failure/Error: its([0, 1]) { should eq(2) }
  53. + NoMethodError:
  54. + undefined method `[]' for nil:NilClass
  55. + # ./example_spec.rb:9
  56. +
  57. + 2) Matrix with values [[1, 2] [3, 4]] 10
  58. + Failure/Error: its([1, 0]) { should eq(3) }
  59. + NoMethodError:
  60. + undefined method `[]' for nil:NilClass
  61. + # ./example_spec.rb:10
  62. +
  63. + 3) Matrix with values [[1, 2] [3, 4]] 12
  64. + Failure/Error: its([1, 2]) { should be_nil }
  65. + NoMethodError:
  66. + undefined method `[]' for nil:NilClass
  67. + # ./example_spec.rb:11
  68. +
  69. +Finished in 0.00195 seconds
  70. +3 examples, 3 failures
  71. (RSpec::Expectations::ExpectationNotMetError)
  72. features/subject/attribute_of_subject.feature:122:in `Then the examples should all pass'
  73.  
  74. Failing Scenarios:
  75. cucumber features/subject/attribute_of_subject.feature:104 # Scenario: specify value for key in a hash-like object
  76.  
  77. 1 scenario (1 failed)
  78. 3 steps (1 failed, 2 passed)
  79. 0m0.653s
Add Comment
Please, Sign In to add comment