Sha256: dd0cf71aa158c1c91833e477fb67b93f420034bfbafa487ee9fba720b39d4408

Contents?: true

Size: 610 Bytes

Versions: 13

Compression:

Stored size: 610 Bytes

Contents

require_relative '../_lib'

class Critic::Unit::ProcTest < Critic::Unit::Test
  before do
    @proc = Configatron::Proc.new {rand}
  end

  describe '#call' do
    it 'executes the block and returns the results' do
      stubs(:rand).returns(4)
      assert_equal(4, @proc.call)
    end

    it 'caches the result if finalize? return true' do
      @proc.stubs(:finalize?).returns(true)
      assert_equal(@proc.call, @proc.call)
    end

    it 'does not cache the result if finalize? returns false' do
      @proc.stubs(:finalize?).returns(false)
      refute_equal(@proc.call, @proc.call)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
configatron-4.5.1 test/unit/configatron/proc.rb
configatron-4.5.0 test/unit/configatron/proc.rb
configatron-4.4.1 test/unit/configatron/proc.rb
configatron-4.4.0 test/unit/configatron/proc.rb
configatron-4.3.0 test/unit/configatron/proc.rb
configatron-4.2.1 test/unit/configatron/proc.rb
configatron-4.2.0 test/unit/configatron/proc.rb
configatron-4.1.1 test/unit/configatron/proc.rb
configatron-4.1.0 test/unit/configatron/proc.rb
configatron-4.0.3 test/unit/configatron/proc.rb
configatron-4.0.2 test/unit/configatron/proc.rb
configatron-4.0.1 test/unit/configatron/proc.rb
configatron-4.0.0 test/unit/configatron/proc.rb