Permalink
Browse files

Merge pull request #61 from cmeiklejohn/add_branch_build_test_coverage

Branch build by POST coverage
  • Loading branch information...
2 parents 90f8062 + cc70c51 commit fa120fc6b3f0b62d62cfb72f6a7590e1230b169f @queso queso committed Jun 22, 2011
Showing with 9 additions and 0 deletions.
  1. +1 −0 cijoe.gemspec
  2. +1 −0 test/helper.rb
  3. +7 −0 test/test_cijoe_server.rb
View
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'json'
s.add_runtime_dependency 'tinder', '>= 1.4.0'
s.add_development_dependency 'rack-test'
+ s.add_development_dependency 'mocha'
s.description = <<desc
cijoe is a sinatra-based continuous integration server. It's like an
View
@@ -1,5 +1,6 @@
require 'rubygems'
require 'test/unit'
+require 'mocha'
ENV['RACK_ENV'] = 'test'
@@ -82,6 +82,13 @@ def test_post_does_not_build_on_branch_mismatch
assert_equal 302, last_response.status
end
+ def test_post_builds_specific_branch
+ app.joe.expects(:build!).with("branchname")
+ post "/?branch=branchname", :payload => {"ref" => "refs/heads/master"}.to_json
+ assert app.joe.building?
+ assert_equal 302, last_response.status
+ end
+
def test_post_does_build_on_branch_match
post "/", :payload => {"ref" => "refs/heads/master"}.to_json
assert app.joe.building?

0 comments on commit fa120fc

Please sign in to comment.