Permalink
Browse files

Adding CI Reporter

CI Reporter generates XML so jenkins can know what tests are running.
This lets it tell you how many tests you have, or how many times a
specific test has failed.

If you're upgrading, you can rerun the generator to get the new jenkins
job config xml file and the new ci_build.sh.
  • Loading branch information...
1 parent e3d15ed commit 79614b36efaeaca4956398594bea3f876de89f26 Gregg Van Hove & Matthew Kocher committed Apr 26, 2012
@@ -80,6 +80,23 @@
end
system!("cd testapp && bundle install")
system!("cd testapp && bundle exec jasmine init .")
+ system!(%{cd testapp && echo "task :default => 'jasmine:ci'" >> Rakefile})
+
+ spec_contents = <<-RUBY
+ require 'rspec'
+
+ describe "The World" do
+ it "should be green and blue" do
+ the_world = ["green", "blue"]
+ the_world.should include("green")
+ the_world.should include("blue")
+ end
+ end
+ RUBY
+
+ File.open("testapp/spec/hello_world_spec.rb", "w") do |file|
+ file.write(spec_contents)
+ end
end
When /^I push to git$/ do
@@ -20,11 +20,9 @@ def add_load_path_to_capfile
end
def add_ci_yml_to_gitignore
- if File.exists?("#{destination_root}/.gitignore")
- append_to_file '.gitignore', "config/ci.yml\n"
- else
- template 'dot-gitignore', '.gitignore'
- end
+ system("touch #{destination_root}/.gitignore")
+ append_to_file '.gitignore', "config/ci.yml\n"
+ append_to_file '.gitignore', "spec/reports\n"
end
def create_chef_cookbooks
@@ -37,6 +37,7 @@
<gitConfigEmail></gitConfigEmail>
<skipTag>false</skipTag>
<scmName></scmName>
+ <includedRegions></includedRegions>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
@@ -53,6 +54,12 @@
<command><%= CI_CONFIG['build_command'] %></command>
</hudson.tasks.Shell>
</builders>
- <publishers/>
+ <publishers>
+ <hudson.tasks.junit.JUnitResultArchiver>
+ <testResults>spec/reports/*.xml</testResults>
+ <keepLongStdio>false</keepLongStdio>
+ <testDataPublishers/>
+ </hudson.tasks.junit.JUnitResultArchiver>
+ </publishers>
<buildWrappers/>
</project>
@@ -19,4 +19,4 @@ RAILS_ENV=test rake db:version > /dev/null || rake db:create
RAILS_ENV=development rake db:migrate test:prepare
-rake ci:headlessly['rake'] --trace
+rake ci:headlessly['rake -f `bundle show ci_reporter`/stub.rake ci:setup:rspec default'] --trace
@@ -1 +0,0 @@
-config/ci.yml
View
@@ -1,3 +1,3 @@
module Lobot
- VERSION = "0.10.2"
+ VERSION = "0.10.3"
end
View
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
s.add_dependency('rvm')
s.add_dependency('rvm-capistrano')
s.add_dependency('nokogiri', '>=1.4.4')
+ s.add_dependency('ci_reporter', '>=1.7.0')
s.add_development_dependency('cucumber')
s.add_development_dependency('rspec')
s.add_development_dependency('generator_spec')
View
@@ -15,11 +15,35 @@
end
context "without requiring input" do
- before { run_generator }
+ before do
+ before_generator
+ run_generator
+ end
+
+ let(:before_generator) {}
+
+ context "when no .gitignore exists" do
+ it "creates .gitignore" do
+ assert_file ".gitignore", /config\/ci.yml/
+ end
+ it "adds spec/reports to the gitignore" do
+ assert_file ".gitignore", /spec\/reports/
+ end
+ end
- it "creates .gitignore" do
- assert_file ".gitignore", /config\/ci.yml/
+ context "when there is already a .gitignore" do
+ let(:before_generator) do
+ system("touch #{destination_root}/.gitignore")
+ end
+
+ it "creates .gitignore" do
+ assert_file ".gitignore", /config\/ci.yml/
+ end
+
+ it "adds spec/reports to the gitignore" do
+ assert_file ".gitignore", /spec\/reports/
+ end
end
it "creates ci.yml" do

0 comments on commit 79614b3

Please sign in to comment.