Sha256: ec4bab55caf6ba290deb8f0f6916ffb4426e9af4e064b7d27e1de4ec7539c4ea

Contents?: true

Size: 1.44 KB

Versions: 8

Compression:

Stored size: 1.44 KB

Contents

require "rspec"
require File.expand_path(File.dirname(__FILE__) + '/../../lib/testingbot/config.rb')
require File.expand_path(File.dirname(__FILE__) + '/../../lib/testingbot/tunnel.rb')

describe TestingBot::Tunnel do
  describe "load config" do
  	it "should load the configuration in the constructor" do
  		tunnel = TestingBot::Tunnel.new
      tunnel.instance_variable_get("@config").should_not be_nil
  	end

    it "should should not overwrite the config with arguments supplied in the constructor" do
      tunnel = TestingBot::Tunnel.new({ :client_key => "fake" })
      tunnel.instance_variable_get("@config")[:client_key].should_not eql("fake")
    end

    it "should allow for extra options to be specified, which will be passed to the jar's argument list" do
      tunnel = TestingBot::Tunnel.new({ :options => ["-f readyfile.txt", "-F *.com"] })
      tunnel.extra_options.should eql("-f readyfile.txt -F *.com")
    end
  end

  describe "before starting the tunnel" do
    it "should have 0 errors" do
      tunnel = TestingBot::Tunnel.new
      tunnel.errors.should be_empty
    end

    it "should not be connected" do
      tunnel = TestingBot::Tunnel.new
      tunnel.is_connected?.should == false
    end
  end

  describe "before stopping the tunnel" do
    it "should check if the tunnel has been started yet" do
      tunnel = TestingBot::Tunnel.new
      lambda { tunnel.stop }.should raise_error(RuntimeError, /^Can't stop tunnel/)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
testingbot-0.1.7 spec/unit/tunnel_spec.rb
testingbot-0.1.6 spec/unit/tunnel_spec.rb
testingbot-0.1.5 spec/unit/tunnel_spec.rb
testingbot-0.1.4 spec/unit/tunnel_spec.rb
testingbot-0.1.3 spec/unit/tunnel_spec.rb
testingbot-0.1.2 spec/unit/tunnel_spec.rb
testingbot-0.1.1 spec/unit/tunnel_spec.rb
testingbot-0.1.0 spec/unit/tunnel_spec.rb