Sha256: 76ab222908578323958b551360f5ae86c62791e229c7af2329d479a73a71b38d

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper.rb'

module Spec
  module Expectations
    module Helper
      context "should_have_at_most" do
        setup do
          @owner = CollectionOwner.new
          (1..3).each do |n|
            @owner.add_to_collection_with_length_method(n)
            @owner.add_to_collection_with_size_method(n)
          end
        end

        specify "should fail when expecting actual length" do
          @owner.should_have_at_most(3).items_in_collection_with_length_method
        end

        specify "should fail when expecting actual size" do
          @owner.should_have_at_most(3).items_in_collection_with_size_method
        end

        specify "should fail when expecting more than actual length" do
          @owner.should_have_at_most(4).items_in_collection_with_length_method
        end

        specify "should fail when expecting more than actual size" do
          @owner.should_have_at_most(4).items_in_collection_with_size_method
        end

        specify "should pass when expecting less than actual length" do
          lambda do
            @owner.should_have_at_most(2).items_in_collection_with_length_method
          end.should_fail
        end

        specify "should pass when expecting less than actual size" do
          lambda do
            @owner.should_have_at_most(2).items_in_collection_with_size_method
          end.should_fail
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
riess-0.0.8 vendor/rspec-0.8.2/spec/spec/expectations/should/should_have_at_most_spec.rb
rspec-0.8.0 spec/spec/expectations/should/should_have_at_most_spec.rb
rspec-0.8.1 spec/spec/expectations/should/should_have_at_most_spec.rb
rspec-0.8.2 spec/spec/expectations/should/should_have_at_most_spec.rb