Sha256: c73743b3a900d5ae570238878f656204fcade5356d15bfbb9f7547baf5234013

Contents?: true

Size: 617 Bytes

Versions: 23

Compression:

Stored size: 617 Bytes

Contents

module Mongomatic
  module Expectations
    class Expected < Expectation
      def self.name
        "expected"
      end
      
      def to_be
        case value
        when Proc
          add_error_msg unless value.call
        when Symbol
          add_error_msg unless instance.send(value)
        else
          add_error_msg unless value
        end
      end

      def to_not_be
        case value
        when Proc
          add_error_msg if value.call
        when Symbol
          add_error_msg if instance.send(value)
        else
          add_error_msg if value
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
mongomatic-0.9.0.pre lib/mongomatic/expectations/expected.rb
mongomatic-0.8.2 lib/mongomatic/expectations/expected.rb
mongomatic-0.8.1.1 lib/mongomatic/expectations/expected.rb
mongomatic-0.7.3 lib/mongomatic/expectations/expected.rb
mongomatic-0.7.2 lib/mongomatic/expectations/expected.rb
mongomatic-0.7.1 lib/mongomatic/expectations/expected.rb
mongomatic-0.7.0 lib/mongomatic/expectations/expected.rb
mongomatic-0.6.5 lib/mongomatic/expectations/expected.rb
mongomatic-0.6.4 lib/mongomatic/expectations/expected.rb
mongomatic-0.6.3 lib/mongomatic/expectations/expected.rb
mongomatic-0.6.2 lib/mongomatic/expectations/expected.rb
mongomatic-0.6.1 lib/mongomatic/expectations/expected.rb
mongomatic-0.6.0 lib/mongomatic/expectations/expected.rb
mongomatic-0.5.8 lib/mongomatic/expectations/expected.rb
mongomatic-0.5.7 lib/mongomatic/expectations/expected.rb
mongomatic-0.5.6 lib/mongomatic/expectations/expected.rb
mongomatic-0.5.5 lib/mongomatic/expectations/expected.rb
mongomatic-0.5.4 lib/mongomatic/expectations/expected.rb
mongomatic-0.5.3 lib/mongomatic/expectations/expected.rb
mongomatic-0.5.2 lib/mongomatic/expectations/expected.rb