Sha256: c4a46f7499aaffb68a06dd5685eead86f1552ba9043593c6777f06bf7f0d4278

Contents?: true

Size: 1.5 KB

Versions: 71

Compression:

Stored size: 1.5 KB

Contents

Feature: start_with matcher

  Use the `start_with` matcher to specify that a string or array starts with 
  the expected characters or elements.

    "this string".should start_with("this")
    "this string".should_not start_with("that")
    [0,1,2].should start_with(0, 1)

  Scenario: with a string
    Given a file named "example_spec.rb" with:
      """
      describe "this string" do
        it { should start_with "this" }
        it { should_not start_with "that" }

        # deliberate failures
        it { should_not start_with "this" }
        it { should start_with "that" }
      end
      """
    When I run `rspec example_spec.rb`
    Then the output should contain all of these:
      | 4 examples, 2 failures                          |
      | expected "this string" not to start with "this" |
      | expected "this string" to start with "that"     |

  Scenario: with an array
    Given a file named "example_spec.rb" with:
      """
      describe [0, 1, 2, 3, 4] do
        it { should start_with 0 }
        it { should start_with(0, 1)}
        it { should_not start_with(2) }
        it { should_not start_with(0, 1, 2, 3, 4, 5) }

        # deliberate failures
        it { should_not start_with 0 }
        it { should start_with 3 }
      end
      """
    When I run `rspec example_spec.rb`
    Then the output should contain all of these:
      | 6 examples, 2 failures                       |
      | expected [0, 1, 2, 3, 4] not to start with 0 |
      | expected [0, 1, 2, 3, 4] to start with 3     |

Version data entries

71 entries across 66 versions & 9 rubygems

Version Path
gem_repackager-0.1.0 support/gems/rspec-expectations-2.11.2/features/built_in_matchers/start_with.feature
classiccms-0.5.17 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.16 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.15 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.14 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.13 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/rspec-expectations-2.11.2/features/built_in_matchers/start_with.feature
rspec-expectations-2.11.3 features/built_in_matchers/start_with.feature
classiccms-0.5.12 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.11 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.10 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.9 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.8 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/rspec-expectations-2.11.2/features/built_in_matchers/start_with.feature
classiccms-0.5.7 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.6 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.5 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.2 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.1 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature
classiccms-0.5.0 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/start_with.feature