Sha256: 06811fc84cef90d1caa5585fb19f6936863615e7a5e74d52323ee4b660c4027e

Contents?: true

Size: 1.7 KB

Versions: 32

Compression:

Stored size: 1.7 KB

Contents

Feature: customized message

  In order to get the feedback I want
  As an RSpec user
  I want to customize the failure message per example
  
  Scenario: one additional method
    Given a file named "node_spec.rb.rb" with:
      """
      class Node
        def initialize(state=:waiting)
          @state = state
        end
        def state
          @state
        end
        def waiting?
          @state == :waiting
        end
        def started?
          @state == :started
        end
        def start
          @state = :started
        end
      end
      
      describe "a new Node" do
        it "should be waiting" do
          node = Node.new(:started) #start w/ started to trigger failure
          node.should be_waiting, "node.state: #{node.state} (first example)"
        end
        
        it "should not be started" do
          node = Node.new(:started) #start w/ started to trigger failure
          node.should_not be_started, "node.state: #{node.state} (second example)"
        end
      end
      
      describe "node.start" do
        it "should change the state" do
          node = Node.new(:started) #start w/ started to trigger failure
          lambda {node.start}.should change{node.state}, "expected a change"
        end
      end
      
      """
    When I run "spec node_spec.rb.rb --format specdoc"
    Then the stdout should include "3 examples, 3 failures"
    And  the stdout should not match "to return true, got false"
    And  the stdout should not match "to return false, got true"
    And  the stdout should include "node.state: started (first example)"
    And  the stdout should include "node.state: started (second example)"
    And  the stdout should include "expected a change"

Version data entries

32 entries across 32 versions & 11 rubygems

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