Sha256: 7bcc858ed3c590846e6b88a296727a1641e76b72be6eb602775cc1f8c7dc814a

Contents?: true

Size: 786 Bytes

Versions: 12

Compression:

Stored size: 786 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require 'ice_nine/support/recursion_guard'

describe IceNine::RecursionGuard::ObjectSet, '#guard' do
  let(:object)       { IceNine::RecursionGuard::ObjectSet.new }
  let(:object_arg)   { Object.new                             }
  let(:return_value) { double('return_value')                 }

  context 'when the block is not recursive' do
    subject { object.guard(object_arg) { return_value } }

    it 'returns the expected value' do
      should be(return_value)
    end
  end

  context 'when the block is recursive' do
    subject do
      object.guard(object_arg) do
        expect(subject).to be(object_arg)
        return_value
      end
    end

    it 'returns the expected value' do
      should be(return_value)
    end
  end
end

Version data entries

12 entries across 10 versions & 4 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ice_nine-0.11.2/spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
ice_nine-0.11.2 spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
ice_nine-0.11.1 spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb
ice_nine-0.11.0 spec/unit/ice_nine/recursion_guard/object_set/guard_spec.rb