Sha256: da61be13dc9d543439069cf3b19dc033aa457c057e4f468782abbe614c9491ea

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

module BaconExpect
  class Expectation
    module BaconContext
      def expect(subject = nil, &block)
        Expectation.new(subject, &block)
      end
    end

    def initialize(subject, &subject_block)
      @subject = subject
      @subject_block = subject_block
    end

    def to(matcher)
      unless matcher.matches?(@subject, &@subject_block)
        raise matcher.fail!(@subject, &@subject_block)
      end
      assert
    end

    def not_to(matcher)
      if matcher.matches?(@subject, &@subject_block)
        raise matcher.fail!(@subject, &@subject_block)
      end
      assert
    end
    alias_method :to_not, :not_to

    def assert
      true.should == true
    end
  end
end

module Spector



end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bacon-expect-1.0.1 lib/bacon-expect/expectation.rb
bacon-expect-0.1 lib/bacon-expect/expectation.rb