Sha256: 3e7f1baefd1223bdbcbcd8f1ce4510af41c19fe5c532c8cf0d6016869f50b1ff

Contents?: true

Size: 809 Bytes

Versions: 6

Compression:

Stored size: 809 Bytes

Contents

Feature: customized message

  RSpec tries to provide useful failure messages, but for cases in which you
  want more specific information, you can define your own message right in the
  example. This works for any matcher _other than the operator matchers_.
  
  Scenario: customize failure message
    Given a file named "example_spec.rb" with:
      """
      describe Array do
        context "when created with `new`" do
          it "is empty" do
            array = Array.new
            array << 1 # trigger a failure to demonstrate the message
            array.should be_empty, "expected empty array, got #{array.inspect}"
          end
        end
      end

      """
    When I run "rspec example_spec.rb --format documentation"
    Then the output should contain "expected empty array, got [1]"

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/features/customized_message.feature
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/features/customized_message.feature
rspec-expectations-2.5.0 features/customized_message.feature
rspec-expectations-2.4.0 features/customized_message.feature
rspec-expectations-2.3.0 features/expectations/customized_message.feature
rspec-expectations-2.2.0 features/expectations/customized_message.feature