Sha256: 805d7404cce10f6a1131d341f0b4911ff8ca0148a98d906612e9ca5f2c7924b5

Contents?: true

Size: 1.77 KB

Versions: 13

Compression:

Stored size: 1.77 KB

Contents

require File.dirname(__FILE__) + '/../../../test_helper'

module Spec
  module Api
    module Helper
      class IdentityTest < Test::Unit::TestCase

        def setup
          @dummy = 'dummy'
          @equal_dummy = 'dummy'
          @another_dummy  = 'another_dummy'
          @nil_var = nil
        end

        def test_should_be_same_as_should_not_raise_when_objects_are_same
          assert_nothing_raised do
            @dummy.should.be @dummy
          end
        end

        def test_should_be_same_as_should_raise_when_objects_are_not_same
          assert_raise(ExpectationNotMetError) do
            @dummy.should.be @equal_dummy
          end
        end

        def test_should_be_nil_should_not_raise_when_object_is_nil
          assert_nothing_raised do
            @nil_var.should.be nil
          end  
        end

        def test_should_be_nil_should_raise_when_object_is_not_nil
          assert_raise(ExpectationNotMetError) do
            @dummy.should.be nil
          end
        end

        # should.not.be

        def test_should_not_be_same_as_should_not_raise_when_objects_are_not_same
          assert_nothing_raised do
            @dummy.should.not.be @equal_dummy
          end
        end

        def test_should_not_be_same_as_should_raise_when_objects_are_not_same
          assert_raise(ExpectationNotMetError) do
            @dummy.should.not.be @dummy
          end
        end

        def test_should_not_be_nil_should_not_raise_when_object_is_not_nil
          assert_nothing_raised do
            @dummy.should.not.be nil
          end  
        end

        def test_should_not_be_nil_should_raise_when_object_is_nil
          assert_raise(ExpectationNotMetError) do
            @nil_var.should.not.be nil
          end
        end

      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rspec-0.5.11 test/spec/api/helper/identity_test.rb
rspec-0.5.0 test/spec/api/helper/identity_test.rb
rspec-0.5.10 test/spec/api/helper/identity_test.rb
rspec-0.5.12 test/spec/api/helper/identity_test.rb
rspec-0.5.1 test/spec/api/helper/identity_test.rb
rspec-0.5.6 test/spec/api/helper/identity_test.rb
rspec-0.5.7 test/spec/api/helper/identity_test.rb
rspec-0.5.9 test/spec/api/helper/identity_test.rb
rspec-0.5.8 test/spec/api/helper/identity_test.rb
rspec-0.5.3 test/spec/api/helper/identity_test.rb
rspec-0.5.2 test/spec/api/helper/identity_test.rb
rspec-0.5.4 test/spec/api/helper/identity_test.rb
rspec-0.5.5 test/spec/api/helper/identity_test.rb