Sha256: c3e8c17acee4b6a2cc9ccbc573bd000839cdfe8ac1a574a0bfa9e39867e8b878

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

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

context "should_include" do
  setup do
    @dummy = "dummy"
    @equal_dummy = "dummy"
    @another_dummy = "another_dummy"
    @nil_var = nil
  end

  specify "should fail when array inclusion is missing" do
    lambda do
      [1, 2, 3].should_include(5)
    end.should_fail
  end

  specify "should fail when enumerable inclusion is missing" do
    lambda do
      IO.constants.should_include("BLAH")
    end.should_fail
  end

  specify "should fail when hash inclusion is missing" do
    lambda do
      {"a" => 1}.should_include("b")
    end.should_fail
  end

  specify "should fail when string inclusion is missing" do
    lambda do
      @dummy.should_include("abc")
    end.should_fail
  end

  specify "should pass when array inclusion is present" do
    lambda do
      [1, 2, 3].should_include(2)
    end.should_pass
  end

  specify "should pass when enumerable inclusion is present" do
    lambda do
      IO.constants.should_include("SEEK_SET")
    end.should_pass
  end

  specify "should pass when hash inclusion is present" do
    lambda do
      {"a" => 1}.should_include("a")
    end.should_pass
  end

  specify "should pass when string inclusion is present" do
    lambda do
      @dummy.should_include("mm")
    end.should_pass
  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_include_spec.rb
rspec-0.8.0 spec/spec/expectations/should/should_include_spec.rb
rspec-0.8.1 spec/spec/expectations/should/should_include_spec.rb
rspec-0.8.2 spec/spec/expectations/should/should_include_spec.rb