[rspec-users] return code question

David Chelimsky dchelimsky at gmail.com
Wed Aug 13 08:35:45 EDT 2008


On Tue, Aug 12, 2008 at 1:22 PM, Ben Fyvie <ben.fyvie at champsoftware.com> wrote:
> We are trying to automate the running of our rspec tests for our Rails app
> on a build server using Capistrano.  The problem is that Capistrano seems to
> think that the command called to run the model tests failed when in fact I
> believe it succeeded. I believe the problem has to do with the return code
> from the command I am running.. The command I am running is:
>
> ruby script/spec spec/models -f html:model_test_results.html
>
>
>
> The output file seems to be complete as it has both the opening and closing
> html tags and it has the results of all of our tests. But when I run $? To
> get the return code of the last command it says it was "1" which I believe
> signifies that the command was not successful and is what is causing our
> Capistrano task to abort.

I just did this in a Rakefile:

task :models do
  `ruby script/spec spec/models -f html:model_test_results.html`
  puts $?
end

And I get this when I run 'rake models'

$ rake models
(in /Users/david/projects/ruby/mycastory)
0

I'm using the latest from git (naturally).

How are you checking the exit code?

> We are using RSpec 1.1.4 and in case you're
> curious the output from Capistrano looks like this:
>
>
>
>   * executing "cd /data/nightingalenotes/releases/20080812160703 && ruby
> script/
>
> spec spec/models -f html:public/rspec_test_results/model_test_results.html"
>
>     servers: ["buildnexus.champ.net"]
>
>     [buildnexus.champ.net] executing command
>
>     command finished
>
> *** [deploy:update_code] rolling back
>
>   * executing "rm -rf /data/nightingalenotes/releases/20080812160703; true"
>
>     servers: ["buildnexus.champ.net"]
>
>     [buildnexus.champ.net] executing command
>
>     command finished
>
> command "cd /data/nightingalenotes/releases/20080812160703 && ruby
> script/spec s
>
> pec/models -f html:public/rspec_test_results/model_test_results.html" failed
> on
>
> buildnexus.champ.net
>
>
>
>
>
> Thanks!
>
>
>
> Ben Fyvie
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list