Sha256: 22262eecfaca9f05eaa2482bc5345fb7cb84c0fd9d727e2f32c3b4615d8ffad2
Contents?: true
Size: 1000 Bytes
Versions: 6
Compression:
Stored size: 1000 Bytes
Contents
require File.join(File.dirname(__FILE__), 'spec_helper') describe Sunspot::SessionProxy::ThreadLocalSessionProxy do before :each do @config = Sunspot::Configuration.build @proxy = Sunspot::SessionProxy::ThreadLocalSessionProxy.new(@config) end it 'should have the same session for the same thread' do @proxy.session.should eql(@proxy.session) end it 'should not have the same session for different threads' do session1 = @proxy.session session2 = nil Thread.new do session2 = @proxy.session end.join session1.should_not eql(session2) end (Sunspot::Session.public_instance_methods(false) - ['config', :config]).each do |method| it "should delegate #{method.inspect} to its session" do args = Array.new(Sunspot::Session.instance_method(method).arity.abs) do stub('arg') end @proxy.session.should_receive(method).with(*args) @proxy.send(method, *args) end end it_should_behave_like 'session proxy' end
Version data entries
6 entries across 6 versions & 1 rubygems