Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a Gosen User-Agent

  • Loading branch information...
commit de08b84021beb82566097ae8df586e3a3cf389a2 1 parent 5148c70
@priteau authored
Showing with 7 additions and 0 deletions.
  1. +2 −0  lib/gosen/deployment.rb
  2. +5 −0 test/gosen/test_deployment.rb
View
2  lib/gosen/deployment.rb
@@ -23,6 +23,8 @@ def initialize(site, environment, nodes, options = {})
@api_options = {}
@logger = options.delete(:logger) || NullLogger.new
+ @site.session.default_headers['User-Agent'] = "Gosen/#{Gosen::VERSION} Restfully/#{Restfully::VERSION}"
+
@min_deployed_nodes = options.delete(:min_deployed_nodes) || 1
raise Gosen::Error.new("Invalid minimal number of deployed nodes, should be between 0 and #{@nodes.length}") if @min_deployed_nodes > @nodes.length || @min_deployed_nodes < 0
View
5 test/gosen/test_deployment.rb
@@ -4,6 +4,11 @@ class TestDeployment < Test::Unit::TestCase
context 'A deployment instance' do
setup do
@site = mock()
+ @session = mock()
+ @default_headers = mock()
+ @default_headers.stubs(:[]=).with('User-Agent', "Gosen/#{Gosen::VERSION} Restfully/#{Restfully::VERSION}")
+ @session.stubs(:default_headers).returns(@default_headers)
+ @site.stubs(:session).returns(@session)
@site_name = "Rennes"
@site.stubs(:name).returns(@site_name)
@environment = 'lenny-x64-base'
Please sign in to comment.
Something went wrong with that request. Please try again.