Sha256: 7a26cc852ce9263c0c247516d4780de837c51eef197dd6f96453764937303d22

Contents?: true

Size: 931 Bytes

Versions: 225

Compression:

Stored size: 931 Bytes

Contents

require 'spec_helper'

describe "should satisfy { block }" do
  it "describes itself" do
    satisfy.description.should eq("satisfy block")
  end

  it "passes if block returns true" do
    true.should satisfy { |val| val }
    true.should satisfy do |val|
      val
    end
  end

  it "fails if block returns false" do
    lambda {
      false.should satisfy { |val| val }
    }.should fail_with("expected false to satisfy block")
    lambda do
      false.should satisfy do |val|
        val
      end
    end.should fail_with("expected false to satisfy block")
  end
end

describe "should_not satisfy { block }" do
  it "passes if block returns false" do
    false.should_not satisfy { |val| val }
    false.should_not satisfy do |val|
      val
    end
  end

  it "fails if block returns true" do
    lambda {
      true.should_not satisfy { |val| val }
    }.should fail_with("expected true not to satisfy block")
  end
end

Version data entries

225 entries across 124 versions & 15 rubygems

Version Path
classiccms-0.5.8 vendor/bundle/gems/rspec-expectations-2.9.0/spec/rspec/matchers/satisfy_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/rspec-expectations-2.11.2/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.7 vendor/bundle/gems/rspec-expectations-2.10.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.7 vendor/bundle/gems/rspec-expectations-2.9.1/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.7 vendor/bundle/gems/rspec-expectations-2.9.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.6 vendor/bundle/gems/rspec-expectations-2.10.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.6 vendor/bundle/gems/rspec-expectations-2.9.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.6 vendor/bundle/gems/rspec-expectations-2.9.1/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.5 vendor/bundle/gems/rspec-expectations-2.9.1/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.5 vendor/bundle/gems/rspec-expectations-2.10.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.5 vendor/bundle/gems/rspec-expectations-2.9.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.2 vendor/bundle/gems/rspec-expectations-2.9.1/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.2 vendor/bundle/gems/rspec-expectations-2.9.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.2 vendor/bundle/gems/rspec-expectations-2.10.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.1 vendor/bundle/gems/rspec-expectations-2.9.1/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.1 vendor/bundle/gems/rspec-expectations-2.9.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.1 vendor/bundle/gems/rspec-expectations-2.10.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.0 vendor/bundle/gems/rspec-expectations-2.9.1/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.0 vendor/bundle/gems/rspec-expectations-2.9.0/spec/rspec/matchers/satisfy_spec.rb
classiccms-0.5.0 vendor/bundle/gems/rspec-expectations-2.10.0/spec/rspec/matchers/satisfy_spec.rb