Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Adding CI Reporter
Browse files Browse the repository at this point in the history
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
Gregg Van Hove & Matthew Kocher committed Apr 26, 2012
1 parent e3d15ed commit 79614b3
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 12 deletions.
17 changes: 17 additions & 0 deletions features/step_definitions/ci_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions lib/generators/lobot/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<gitConfigEmail></gitConfigEmail>
<skipTag>false</skipTag>
<scmName></scmName>
<includedRegions></includedRegions>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
Expand All @@ -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>
2 changes: 1 addition & 1 deletion lib/generators/lobot/templates/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 0 additions & 1 deletion lib/generators/lobot/templates/dot-gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion lib/lobot/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Lobot
VERSION = "0.10.2"
VERSION = "0.10.3"
end
1 change: 1 addition & 0 deletions lobot.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
30 changes: 27 additions & 3 deletions spec/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 79614b3

Please sign in to comment.