Skip to content

Commit

Permalink
Make Clojure builder announce Leiningen version before running builds
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Feb 8, 2012
1 parent ed6b087 commit fd316e3
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
9 changes: 9 additions & 0 deletions features/support/step_definitions.rb
Expand Up @@ -136,6 +136,15 @@ def decode(string)
in_sequence($sequence)
end

Then /it announces active (?:lein|leiningen|Leiningen) version/ do
cmd = 'lein version'

$shell.expects(:execute).
with(cmd).
outputs(cmd).
in_sequence($sequence)
end

Then /it announces active (?:php|PHP) version/ do
cmd = 'php --version'

Expand Down
4 changes: 4 additions & 0 deletions features/test_clojure.feature
Expand Up @@ -11,6 +11,7 @@ Feature: Testing a Clojure project
Then it exports the given environment variables
And it successfully clones the repository to the build dir with git
And it successfully checks out the commit with git to the repository directory
And it announces active leiningen version
And it successfully installs dependencies with lein
And it successfully runs the script: lein test
And it closes the ssh session
Expand All @@ -24,6 +25,7 @@ Feature: Testing a Clojure project
| job:test:log | log: git clone |
| job:test:log | log: cd travis-ci/travis-ci |
| job:test:log | log: git checkout |
| job:test:log | log: lein version |
| job:test:log | log: lein deps |
| job:test:log | log: lein test |
| job:test:log | log: /Done.* 0/ |
Expand All @@ -49,6 +51,7 @@ Feature: Testing a Clojure project
Then it exports the given environment variables
And it successfully clones the repository to the build dir with git
And it successfully checks out the commit with git to the repository directory
And it announces active leiningen version
And it fails to install dependencies with lein
And it closes the ssh session
And it returns the status 1
Expand All @@ -58,6 +61,7 @@ Feature: Testing a Clojure project
Then it exports the given environment variables
And it successfully clones the repository to the build dir with git
And it successfully checks out the commit with git to the repository directory
And it announces active leiningen version
And it successfully installs dependencies with lein
And it fails to run the script: lein test
And it closes the ssh session
Expand Down
16 changes: 16 additions & 0 deletions lib/travis/build/job/test/clojure.rb
Expand Up @@ -6,6 +6,22 @@ class Clojure < Test
class Config < Hashr
define :install => 'lein deps', :script => 'lein test'
end

def setup
super

announce_leiningen
end

def uses_leiningen?
@uses_leiningen ||= shell.file_exists?('project.clj')
end

protected

def announce_leiningen
shell.execute("lein version")
end
end
end
end
Expand Down
16 changes: 15 additions & 1 deletion spec/build/job/test/clojure_spec.rb
Expand Up @@ -2,7 +2,9 @@
require 'travis/build'

describe Travis::Build::Job::Test::Clojure do
let(:config) { Travis::Build::Job::Test::Clojure::Config.new }
let(:shell) { stub('shell', :execute => true) }
let(:config) { described_class::Config.new }
let(:job) { described_class.new(shell, nil , config) }

describe 'config' do
it 'defaults :install to "lein deps"' do
Expand All @@ -13,4 +15,16 @@
config.script.should == 'lein test'
end
end



describe "setup" do
let(:shell) { stub('shell') }

it "announces Leiningen version" do
shell.expects(:execute).with('lein version')

job.setup
end
end
end

0 comments on commit fd316e3

Please sign in to comment.