Sha256: 2884ce17f12f805a2c6205af6277a83a745371a2df409e41eab116b21d0b8ed0

Contents?: true

Size: 1.19 KB

Versions: 200

Compression:

Stored size: 1.19 KB

Contents

Feature: exist matcher

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

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

  Scenario: basic usage
    Given a file named "exist_matcher_spec.rb" with:
      """
      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

200 entries across 99 versions & 14 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.9.1/features/built_in_matchers/exist.feature
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.9.0/features/built_in_matchers/exist.feature
classiccms-0.7.5 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/exist.feature
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.9.0/features/built_in_matchers/exist.feature
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.9.1/features/built_in_matchers/exist.feature
classiccms-0.7.4 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/exist.feature
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/exist.feature
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.9.0/features/built_in_matchers/exist.feature
classiccms-0.7.3 vendor/bundle/gems/rspec-expectations-2.9.1/features/built_in_matchers/exist.feature
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-expectations-2.11.3/features/built_in_matchers/exist.feature
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rspec-expectations-2.11.3/features/built_in_matchers/exist.feature
classiccms-0.7.2 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/exist.feature
classiccms-0.7.2 vendor/bundle/gems/rspec-expectations-2.9.0/features/built_in_matchers/exist.feature
classiccms-0.7.2 vendor/bundle/gems/rspec-expectations-2.9.1/features/built_in_matchers/exist.feature
classiccms-0.7.1 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/exist.feature
classiccms-0.7.1 vendor/bundle/gems/rspec-expectations-2.9.1/features/built_in_matchers/exist.feature
classiccms-0.7.1 vendor/bundle/gems/rspec-expectations-2.9.0/features/built_in_matchers/exist.feature
classiccms-0.7.0 vendor/bundle/gems/rspec-expectations-2.10.0/features/built_in_matchers/exist.feature
classiccms-0.7.0 vendor/bundle/gems/rspec-expectations-2.9.1/features/built_in_matchers/exist.feature
classiccms-0.7.0 vendor/bundle/gems/rspec-expectations-2.9.0/features/built_in_matchers/exist.feature