Sha256: fe8d525603d7f9ca04c26ab82fe27fce02a8f9607c65306e28950e143b8517f2

Contents?: true

Size: 1.2 KB

Versions: 15

Compression:

Stored size: 1.2 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

include RR

describe DatabaseProxy do
  before(:each) do
    Initializer.configuration = standard_config
  end

  it "initialize should create an empty session regiser" do
    proxy =  DatabaseProxy.new
    proxy.session_register.should == {}
  end

  def create_proxy_and_session
    proxy = DatabaseProxy.new
    session = proxy.create_session Initializer.configuration.left
    return proxy, session
  end

  it "create_session should register the created session" do
    proxy, session = create_proxy_and_session

    session.should be_an_instance_of(ProxyConnection)
    proxy.session_register.include?(session).should == true
  end

  it "destroy_session should destroy and unregister the session" do
    proxy, session = create_proxy_and_session
    session.should_receive(:destroy)
    
    proxy.destroy_session session

    proxy.session_register.include?(session).should == false
  end
  
  it "ping should respond with 'pong'" do
    proxy = DatabaseProxy.new
    proxy.ping.should == 'pong' 
  end
  
  it "terminate should exit the proxy" do
    proxy = DatabaseProxy.new
    Thread.main.should_receive(:raise).with(SystemExit)
    
    proxy.terminate!
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
andyjeffries-rubyrep-1.2.1 spec/database_proxy_spec.rb
rubyrep-1.2.0 spec/database_proxy_spec.rb
rubyrep-1.1.2 spec/database_proxy_spec.rb
rubyrep-1.1.1 spec/database_proxy_spec.rb
rubyrep-1.1.0 spec/database_proxy_spec.rb
rubyrep-1.0.9 spec/database_proxy_spec.rb
rubyrep-1.0.8 spec/database_proxy_spec.rb
rubyrep-1.0.3 spec/database_proxy_spec.rb
rubyrep-1.0.4 spec/database_proxy_spec.rb
rubyrep-1.0.5 spec/database_proxy_spec.rb
rubyrep-1.0.6 spec/database_proxy_spec.rb
rubyrep-1.0.7 spec/database_proxy_spec.rb
rubyrep-1.0.1 spec/database_proxy_spec.rb
rubyrep-1.0.0 spec/database_proxy_spec.rb
rubyrep-1.0.2 spec/database_proxy_spec.rb