Permalink
Browse files

AgileBench - test file

  • Loading branch information...
1 parent 2c520ff commit 40de2f5587ee9349e61c4e1b8802ea0ccb065f3c @DariuszMichalski DariuszMichalski committed Mar 16, 2012
Showing with 27 additions and 2 deletions.
  1. +2 −2 services/agile_bench.rb
  2. +25 −0 test/agile_bench_test.rb
@@ -5,8 +5,8 @@ def receive_push
token, project_id =
data['token'].to_s.strip, data['project_id'].to_s.strip
- raise_config_error "Invalid Token" if token.to_s.empty?
- raise_config_error "Invalid Project ID" if project_id.to_s.empty?
+ raise_config_error "Invalid Token" if !token.present?
+ raise_config_error "Invalid Project ID" if !project_id.present?
response = { :token => token,
:payload => payload }
@@ -0,0 +1,25 @@
+require File.expand_path('../helper', __FILE__)
+
+class AgileBenchTest < Service::TestCase
+ def setup
+ @stubs = Faraday::Adapter::Test::Stubs.new
+ @token = "test_token"
+ @project_id = "123"
+ end
+
+ def test_push
+ @stubs.post "/project/#{@project_id}" do |env|
+ assert_equal '212.127.65.121', env[:url].host
+ [200, {}, '']
+ end
+
+ svc = service(
+ {'token' => 'test_token', 'project_id' => '123'}, payload)
+ svc.receive_push
+ end
+
+ def service(*args)
+ super Service::AgileBench, *args
+ end
+end
+

0 comments on commit 40de2f5

Please sign in to comment.