/vendor/bundle/jruby/2.1/gems/rspec-expectations-2.14.5/features/built_in_matchers/end_with.feature

https://github.com/delowong/logstash · Gherkin Specification · 48 lines · 40 code · 6 blank · 2 comment · 0 complexity · c8dc0a9f508ed716c64e43f01d314b01 MD5 · raw file

  1. Feature: end_with matcher
  2. Use the `end_with` matcher to specify that a string or array ends with the
  3. expected characters or elements.
  4. ```ruby
  5. "this string".should end_with "string"
  6. "this string".should_not end_with "stringy"
  7. [0, 1, 2].should end_with 1, 2
  8. ```
  9. Scenario: string usage
  10. Given a file named "example_spec.rb" with:
  11. """ruby
  12. describe "this string" do
  13. it { should end_with "string" }
  14. it { should_not end_with "stringy" }
  15. # deliberate failures
  16. it { should_not end_with "string" }
  17. it { should end_with "stringy" }
  18. end
  19. """
  20. When I run `rspec example_spec.rb`
  21. Then the output should contain all of these:
  22. | 4 examples, 2 failures |
  23. | expected "this string" not to end with "string" |
  24. | expected "this string" to end with "stringy" |
  25. Scenario: array usage
  26. Given a file named "example_spec.rb" with:
  27. """ruby
  28. describe [0, 1, 2, 3, 4] do
  29. it { should end_with 4 }
  30. it { should end_with 3, 4 }
  31. it { should_not end_with 3 }
  32. it { should_not end_with 0, 1, 2, 3, 4, 5 }
  33. # deliberate failures
  34. it { should_not end_with 4 }
  35. it { should end_with 3 }
  36. end
  37. """
  38. When I run `rspec example_spec.rb`
  39. Then the output should contain all of these:
  40. | 6 examples, 2 failures |
  41. | expected [0, 1, 2, 3, 4] not to end with 4 |
  42. | expected [0, 1, 2, 3, 4] to end with 3 |