Sha256: d23576f39bc4f8ec5bda1333718c63e1897e7f28779bec4d6f79142b6ca1b84d

Contents?: true

Size: 710 Bytes

Versions: 26

Compression:

Stored size: 710 Bytes

Contents

module MSpecRSpecAdapter
  def expect(object)
    MSpecRSpecAdapterShould.new(object)
  end

  def eq(expected)
    MSpecRSpecAdapterEq.new(expected)
  end

  class MSpecRSpecAdapterEq < Struct.new(:object)
  end

  class MSpecRSpecAdapterShould < Struct.new(:object)
    def to(expectation)
      apply_expectation(:should, expectation)
    end

    def apply_expectation(type, expectation)
      if MSpecRSpecAdapterEq === expectation
        object.send(type) == expectation.object
      else
        object.send(type, expectation)
      end
    end

    def not_to
      apply_expectation(:should_not, expectation)
    end
    alias to_not not_to
  end
end

include MSpecRSpecAdapter unless defined? RSpec

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
opal-0.9.4 spec/support/mspec_rspec_adapter.rb
opal-0.9.3 spec/support/mspec_rspec_adapter.rb
opal-0.10.0.beta2 spec/support/mspec_rspec_adapter.rb
opal-0.10.0.beta1 spec/support/mspec_rspec_adapter.rb
opal-0.9.2 spec/support/mspec_rspec_adapter.rb
opal-0.9.0 spec/support/mspec_rspec_adapter.rb
opal-0.9.0.rc1 spec/support/mspec_rspec_adapter.rb
opal-0.9.0.beta2 spec/support/mspec_rspec_adapter.rb
opal-0.9.0.beta1 spec/support/mspec_rspec_adapter.rb
opal-0.8.1 spec/support/mspec_rspec_adapter.rb
opal-0.8.1.rc1 spec/support/mspec_rspec_adapter.rb
opal-wedge-0.9.0.dev spec/support/mspec_rspec_adapter.rb
opal-0.8.0 spec/support/mspec_rspec_adapter.rb
opal-0.8.0.rc3 spec/support/mspec_rspec_adapter.rb
opal-0.8.0.rc2 spec/support/mspec_rspec_adapter.rb
opal-0.8.0.rc1 spec/support/mspec_rspec_adapter.rb
opal-0.8.0.beta1 spec/support/mspec_rspec_adapter.rb
opal-0.7.2 spec/support/mspec_rspec_adapter.rb
opal-0.7.1 spec/support/mspec_rspec_adapter.rb
opal-0.7.0 spec/support/mspec_rspec_adapter.rb