Sha256: b4d63de1e5253ae5cc5b8077f88561ad2c0180a8e8442ba6a77c3008ef163504

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

RSpec.describe "expect(...).to satisfy { block }" do
  it_behaves_like "an RSpec matcher", :valid_value => true, :invalid_value => false do
    let(:matcher) { satisfy { |v| v } }
  end

  it "describes itself" do
    expect(satisfy.description).to eq("satisfy block")
  end

  it "passes if block returns true" do
    expect(true).to satisfy { |val| val }
    expect(true).to satisfy do |val|
      val
    end
  end

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

RSpec.describe "expect(...).not_to satisfy { block }" do
  it "passes if block returns false" do
    expect(false).not_to satisfy { |val| val }
    expect(false).not_to satisfy do |val|
      val
    end
  end

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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
opal-rspec-0.6.2 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-rspec-0.6.1 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-rspec-0.6.0 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-rspec-0.6.0.beta1 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-connect-rspec-0.5.0 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-rspec-0.5.0 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-rspec-0.5.0.beta3 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-rspec-0.5.0.beta2 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb
opal-rspec-0.5.0.beta1 rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb