Sha256: 34b29023458b7ffb39348ee88f5d8756a1179bc64acd77bf8376a925354edad4

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

Feature: exist matcher

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

    obj.should exist # passes if obj.exist?

  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?
          %w[Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune].include?(name)
        end
      end

      describe "Earth" do
        subject { Planet.new("Earth") }
        it { should exist }
        it { should_not exist } # deliberate failure
      end

      describe "Tatooine" do
        subject { Planet.new("Tatooine") }
        it { should_not exist }
        it { should exist } # deliberate failure
      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

11 entries across 11 versions & 2 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/exist.feature
rspec-expectations-2.4.0 features/built_in_matchers/exist.feature
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/exist.feature
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/exist.feature
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/exist.feature
rspec-expectations-2.3.0 features/matchers/exist.feature
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/exist.feature
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/exist.feature
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/exist.feature
rspec-expectations-2.2.0 features/matchers/exist.feature
rspec-expectations-2.1.0 features/matchers/exist.feature