Sha256: 1d072f6cdecd130ab33ce8884d69d429a7aab739f80adbf60cbfc60a90027ca3

Contents?: true

Size: 1.36 KB

Versions: 32

Compression:

Stored size: 1.36 KB

Contents

Feature: expect error

  Expect a proc to change the state of some object.
  
  Scenario: expect error
    Given a file named "expect_error.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 "spec expect_error.rb"
    Then the stdout should include "2 examples, 1 failure"
    Then the stdout should include "expected NameError but nothing was raised"

  Scenario: expect no error
    Given a file named "expect_no_error.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 "spec expect_no_error.rb"
    Then the stdout should include "2 examples, 1 failure"
    Then the stdout should include "undefined method `non_existent_message'"

Version data entries

32 entries across 32 versions & 11 rubygems

Version Path
rspec-instructure-1.3.3 features/expectations/expect_error.feature
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/features/expectations/expect_error.feature
rspec-1.3.2 features/expectations/expect_error.feature
rspec-1.3.1 features/expectations/expect_error.feature
rspec-1.3.1.rc features/expectations/expect_error.feature
rspec-1.3.0 features/expectations/expect_error.feature
hubbub-0.0.11 lib/vendor/plugins/rspec/features/expectations/expect_error.feature
hubbub-0.0.10 lib/vendor/plugins/rspec/features/expectations/expect_error.feature
hubbub-0.0.9 lib/vendor/plugins/rspec/features/expectations/expect_error.feature
hubbub-0.0.8 lib/vendor/plugins/rspec/features/expectations/expect_error.feature
hubbub-0.0.6 lib/vendor/plugins/rspec/features/expectations/expect_error.feature
simple-templater-0.0.1.4 gems/gems/rspec-1.2.9/features/expectations/expect_error.feature
media-path-0.1.2 vendor/rspec/features/expectations/expect_error.feature
simple-templater-0.0.1.3 vendor/rspec/features/expectations/expect_error.feature
pupu-0.0.2.pre vendor/rspec/features/expectations/expect_error.feature
media-path-0.1.1.pre vendor/rspec/features/expectations/expect_error.feature
simple-templater-0.0.1.2 vendor/rspec/features/expectations/expect_error.feature
media-path-0.1.1 vendor/rspec/features/expectations/expect_error.feature
simple-templater-0.0.1.1 vendor/rspec/features/expectations/expect_error.feature
pupu-0.0.2 vendor/rspec/features/expectations/expect_error.feature