PageRenderTime 14ms CodeModel.GetById 7ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

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