Sha256: d355d297ccdf33953ac17cafde291db52ee4cfd7719ca7022653c839bf2f2107

Contents?: true

Size: 884 Bytes

Versions: 31

Compression:

Stored size: 884 Bytes

Contents

require 'spec_helper'

module Startback
  describe Context, "fork" do

    it 'is a simple dup without args' do
      context = SubContext.new
      context.foo = ['hello']

      forked = context.fork
      expect(forked).not_to be(context)
      expect(forked.foo).to eql(['hello'])
      expect(forked.foo).to be(context.foo)
    end

    it 'yields the context if a block is provided' do
      context = SubContext.new

      seen = false
      context.fork({ 'foo' => 'hello' }) do |forked|
        expect(forked).not_to be(context)
        expect(forked.foo).to eql('hello')
        seen = true
      end
      expect(seen).to eql(true)
    end

    it 'uses the factory on the hash provided' do
      context = SubContext.new

      forked = context.fork({ 'foo' => 'hello' })
      expect(forked).not_to be(context)
      expect(forked.foo).to eql('hello')
    end

  end
end

Version data entries

31 entries across 31 versions & 3 rubygems

Version Path
startback-1.0.3 spec/unit/context/test_fork.rb
startback-1.0.2 spec/unit/context/test_fork.rb
startback-1.0.1 spec/unit/context/test_fork.rb
startback-1.0.0 spec/unit/context/test_fork.rb
startback-0.19.4 spec/unit/context/test_fork.rb
startback-0.19.3 spec/unit/context/test_fork.rb
startback-0.19.1 spec/unit/context/test_fork.rb
startback-0.19.0 spec/unit/context/test_fork.rb
startback-0.18.2 spec/unit/context/test_fork.rb
startback-0.18.1 spec/unit/context/test_fork.rb
startback-0.18.0 spec/unit/context/test_fork.rb
startback-0.17.4 spec/unit/context/test_fork.rb
startback-0.17.3 spec/unit/context/test_fork.rb
startback-0.17.2 spec/unit/context/test_fork.rb
startback-0.17.1 spec/unit/context/test_fork.rb
startback-0.17.0 spec/unit/context/test_fork.rb
startback-0.16.0 spec/unit/context/test_fork.rb
startback-0.15.5 spec/unit/context/test_fork.rb
startback-0.15.4 spec/unit/context/test_fork.rb
startback-0.15.3 spec/unit/context/test_fork.rb