Sha256: 11861ade3a076f4796637e2971460b3fb2005d51baea27dcea99246345606f51

Contents?: true

Size: 1.21 KB

Versions: 42

Compression:

Stored size: 1.21 KB

Contents

Feature: exist matcher

  The exist matcher is used to specify that something exists
  (as indicated by #exist? or #exists?):

    ```ruby
    obj.should exist # passes if obj.exist? or obj.exists?
    ```

  Scenario: basic usage
    Given a file named "exist_matcher_spec.rb" with:
      """ruby
      class Planet
        attr_reader :name

        def initialize(name)
          @name = name
        end

        def inspect
          "<Planet: #{name}>"
        end

        def exist? # also works with exists?
          %w[Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune].include?(name)
        end
      end

      describe "Earth" do
        let(:earth) { Planet.new("Earth") }
        specify { earth.should exist }
        specify { earth.should_not exist } # deliberate failure
      end

      describe "Tatooine" do
        let(:tatooine) { Planet.new("Tatooine") }
        it { tatooine.should exist } # deliberate failure
        it { tatooine.should_not exist }
      end
      """
    When I run `rspec exist_matcher_spec.rb`
    Then the output should contain all of these:
      | 4 examples, 2 failures                |
      | expected <Planet: Earth> not to exist |
      | expected <Planet: Tatooine> to exist  |

Version data entries

42 entries across 42 versions & 12 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/exist.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-expectations-2.14.5/features/built_in_matchers/exist.feature
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-expectations-2.13.0/features/built_in_matchers/exist.feature
rspec-expectations-2.99.2 features/built_in_matchers/exist.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-expectations-2.14.4/features/built_in_matchers/exist.feature
rspec-expectations-2.99.1 features/built_in_matchers/exist.feature
rspec-expectations-2.99.0 features/built_in_matchers/exist.feature
rspec-expectations-2.99.0.rc1 features/built_in_matchers/exist.feature
rspec-expectations-2.99.0.beta2 features/built_in_matchers/exist.feature
rspec-expectations-2.14.5 features/built_in_matchers/exist.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-expectations-2.14.4/features/built_in_matchers/exist.feature
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/built_in_matchers/exist.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-expectations-2.14.4/features/built_in_matchers/exist.feature