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.7.0.rc1 spec/support/mspec_rspec_adapter.rb
opal-0.7.0.beta3 spec/support/mspec_rspec_adapter.rb
opal-0.7.0.beta2 spec/support/mspec_rspec_adapter.rb
opal-cj-0.7.0.beta2 spec/support/mspec_rspec_adapter.rb
opal-cj-0.7.0.beta1 spec/support/mspec_rspec_adapter.rb
opal-0.7.0.beta1 spec/support/mspec_rspec_adapter.rb