Sha256: 41dd249b20864dfc9b25ee83e892b40752d0929b1e038c467efe2b9412caf1df

Contents?: true

Size: 1.51 KB

Versions: 19

Compression:

Stored size: 1.51 KB

Contents

Feature: block local expectations

  In order to set message expectations on ...
  As an RSpec user
  I want to configure the evaluation context

  Background:
    Given a file named "account.rb" with:
      """
      class Account
        def self.create
          yield new
        end

        def opening_balance(amount, currency)
        end
      end
      """

  Scenario: passing example
    Given a file named "account_dsl.rb" with:
      """
      require 'spec_helper'
      require 'account'

      describe "account DSL" do
        it " .... " do
          account = Account.new
          Account.should_receive(:create).and_yield do |account|
            account.should_receive(:opening_balance).with(100, :USD)
          end
          Account.create do
            opening_balance 100, :USD
          end
        end
      end
      """
    When I run "spec account_dsl.rb"
    Then the stdout should include "1 example, 0 failures"
    
  Scenario: failing example
    
    Given a file named "account_dsl.rb" with:
      """
      require 'spec_helper'
      require 'account'

      describe "account DSL" do
        it " .... " do
          account = Account.new
          Account.should_receive(:create).and_yield do |account|
            account.should_receive(:opening_balance).with(100, :USD)
          end
          Account.create do
            # opening_balance is not called here
          end
        end
      end
      """

    When I run "spec account_dsl.rb"
    Then the stdout should include "1 example, 1 failure"

Version data entries

19 entries across 19 versions & 7 rubygems

Version Path
rspec-instructure-1.3.3 features/mocks/block_local_expectations.feature
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/features/mocks/block_local_expectations.feature
rspec-1.3.2 features/mocks/block_local_expectations.feature
rspec-1.3.1 features/mocks/block_local_expectations.feature
rspec-1.3.1.rc features/mocks/block_local_expectations.feature
rspec-1.3.0 features/mocks/block_local_expectations.feature
media-path-0.1.2 vendor/rspec/features/mocks/block_local_expectations.feature
simple-templater-0.0.1.3 vendor/rspec/features/mocks/block_local_expectations.feature
pupu-0.0.2.pre vendor/rspec/features/mocks/block_local_expectations.feature
media-path-0.1.1.pre vendor/rspec/features/mocks/block_local_expectations.feature
simple-templater-0.0.1.2 vendor/rspec/features/mocks/block_local_expectations.feature
media-path-0.1.1 vendor/rspec/features/mocks/block_local_expectations.feature
simple-templater-0.0.1.1 vendor/rspec/features/mocks/block_local_expectations.feature
pupu-0.0.2 vendor/rspec/features/mocks/block_local_expectations.feature
rango-0.0.6 vendor/rspec/features/mocks/block_local_expectations.feature
rango-0.1.pre vendor/rspec/features/mocks/block_local_expectations.feature
pupu-0.0.1 vendor/rspec/features/mocks/block_local_expectations.feature
media-path-0.1 vendor/rspec/features/mocks/block_local_expectations.feature
simple-templater-0.0.1 vendor/rspec/features/mocks/block_local_expectations.feature