Sha256: 556152656e030ec9623a9185481ed50655f96e759e2bbef4507c27bc70f16549

Contents?: true

Size: 1.53 KB

Versions: 35

Compression:

Stored size: 1.53 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.

    ```ruby
    "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:
      """ruby
      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:
      """ruby
      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

35 entries across 35 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-expectations-2.14.5/features/built_in_matchers/start_with.feature
rspec-expectations-2.99.2 features/built_in_matchers/start_with.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-expectations-2.14.4/features/built_in_matchers/start_with.feature
rspec-expectations-2.99.1 features/built_in_matchers/start_with.feature
rspec-expectations-2.99.0 features/built_in_matchers/start_with.feature
rspec-expectations-2.99.0.rc1 features/built_in_matchers/start_with.feature
rspec-expectations-2.99.0.beta2 features/built_in_matchers/start_with.feature
rspec-expectations-2.14.5 features/built_in_matchers/start_with.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-expectations-2.14.4/features/built_in_matchers/start_with.feature
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/built_in_matchers/start_with.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-expectations-2.14.4/features/built_in_matchers/start_with.feature
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/built_in_matchers/start_with.feature