Sha256: 75723f7e06585719e6dccb1e3604af8bd73d4156e57341976ab31ae8da0fdbff

Contents?: true

Size: 1.38 KB

Versions: 23

Compression:

Stored size: 1.38 KB

Contents

Feature: Expect error

  Expect a proc to raise an error when called.
  
  Scenario: expect error
    Given a file named "expect_error_spec.rb" with:
      """
      describe Object, "#non_existent_message" do
        it "should raise" do
          expect{Object.non_existent_message}.to raise_error(NameError)
        end
      end

      #deliberate failure
      describe Object, "#public_instance_methods" do
        it "should raise" do
          expect{Object.public_instance_methods}.to raise_error(NameError)
        end
      end
      """
    When I run "rspec ./expect_error_spec.rb"
    Then the output should contain "2 examples, 1 failure"
    Then the output should contain "expected NameError but nothing was raised"

  Scenario: expect no error
    Given a file named "expect_no_error_spec.rb" with:
      """
      describe Object, "#public_instance_methods" do
        it "should not raise" do
          expect{Object.public_instance_methods}.to_not raise_error(NameError)
        end
      end

      #deliberate failure
      describe Object, "#non_existent_message" do
        it "should not raise" do
          expect{Object.non_existent_message}.to_not raise_error(NameError)
        end
      end
      """
    When I run "rspec ./expect_no_error_spec.rb"
    Then the output should contain "2 examples, 1 failure"
    Then the output should contain "undefined method `non_existent_message'"

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/expect_error.feature
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/expect_error.feature
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/expect_error.feature
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/expect_error.feature
rspec-expectations-2.3.0 features/matchers/expect_error.feature
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/expect_error.feature
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/expect_error.feature
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/features/matchers/expect_error.feature
rspec-expectations-2.2.0 features/matchers/expect_error.feature
rspec-expectations-2.1.0 features/matchers/expect_error.feature
rspec-expectations-2.0.1 features/matchers/expect_error.feature
gemrage-1.0.0 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.4.1 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.4.0 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.3.2 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.3.1 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.3.0 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.2.0 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.1.2 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature
gemrage-0.1.1 vendor/ruby/1.8/gems/rspec-expectations-2.0.0/features/matchers/expect_error.feature