Sha256: 94cf0505a328ccdc1aecbbdf4b70aadd94d13f97055c119a764aed6c7d228383

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

require File.dirname(__FILE__) + '/../../../spec_helper.rb'

class SomethingExpected
  attr_accessor :some_value
end

context "should_not_change" do
  setup do
    @instance = SomethingExpected.new
    @instance.some_value = 5
  end

  specify "should not raise exception when the target is not modified by the block" do
    lambda do
      lambda {nil}.should_not_change(@instance, :some_value)
    end.should_not_raise
  end

  specify "should raise exception when the target is modified by the block" do
    lambda do
      lambda {@instance.some_value = 6}.should_not_change(@instance, :some_value)
    end.should_fail_with "some_value should not have changed, but did change from 5 to 6"
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
riess-0.0.8 vendor/rspec-0.8.2/spec/spec/expectations/should/should_not_change_spec.rb
rspec-0.8.0 spec/spec/expectations/should/should_not_change_spec.rb
rspec-0.8.1 spec/spec/expectations/should/should_not_change_spec.rb
rspec-0.8.2 spec/spec/expectations/should/should_not_change_spec.rb