Sha256: ae8495fd5c2a08837f240a0099fa6d233dbc92d31a4b2bf064686f392930e6e9

Contents?: true

Size: 1.12 KB

Versions: 16

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

module Rspec
  module Matchers
    [:be_a_kind_of, :be_kind_of].each do |method|
      describe "actual.should #{method}(expected)" do
        it "passes if actual is instance of expected class" do
          5.should send(method, Fixnum)
        end

        it "passes if actual is instance of subclass of expected class" do
          5.should send(method, Numeric)
        end

        it "fails with failure message for should unless actual is kind of expected class" do
          lambda { "foo".should send(method, Array) }.should fail_with(%Q{expected "foo" to be a kind of Array})
        end

        it "provides a description" do
          matcher = be_a_kind_of(String)
          matcher.matches?("this")
          matcher.description.should == "be a kind of String"
        end
      end
      
      describe "actual.should_not #{method}(expected)" do
        it "fails with failure message for should_not if actual is kind of expected class" do
          lambda { "foo".should_not send(method, String) }.should fail_with(%Q{expected "foo" not to be a kind of String})
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rspec-expectations-2.0.0.beta.8 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.beta.7 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.beta.6 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.beta.5 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.beta.4 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.beta.3 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.beta.2 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.beta.1 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a10 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a9 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a8 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a7 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a6 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a5 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a4 spec/rspec/matchers/be_kind_of_spec.rb
rspec-expectations-2.0.0.a3 spec/rspec/matchers/be_kind_of_spec.rb