I am trying to run rake on an app I have made. This is what happens neil@neil-laptop:~/************$ rake test:units --trace (in /home/neil/************) ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:load (first_time) ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:load ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load ** Execute test:units /usr/bin/ruby1.8 -I"lib:test" "/home/neil/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/story_test.rb" "test/unit/user_mailer_test.rb" "test/unit/user_test.rb" "test/unit/helpers/community_helper_test.rb" "test/unit/helpers/friendship_helper_test.rb" "test/unit/helpers/profile_helper_test.rb" "test/unit/comment_test.rb" "test/unit/friendship_test.rb" ruby index.rb <data dir> <index dir> rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/home/neil/...] I''ve spent two days googling this. Has anybody any idea what is wrong? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I am trying to run rake on an app I have made. This is what happens neil@neil-laptop:~/************$ rake test:units --trace (in /home/neil/************) ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:load (first_time) ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:load ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load ** Execute test:units /usr/bin/ruby1.8 -I"lib:test" "/home/neil/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/story_test.rb" "test/unit/user_mailer_test.rb" "test/unit/user_test.rb" "test/unit/helpers/community_helper_test.rb" "test/unit/helpers/friendship_helper_test.rb" "test/unit/helpers/profile_helper_test.rb" "test/unit/comment_test.rb" "test/unit/friendship_test.rb" ruby index.rb <data dir> <index dir> rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/home/neil/...] Any ideas? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m still stuck, can''t make an tests work -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I have created a test application. It only has one model. When I run tests on it it runs but still comes up with the same error message ie 1) Failure: test_should_not_be_valid_without_story(AnnnetteTest) [./test/unit/annnette_test.rb:6:in `test_should_not_be_valid_without_story'' /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'' /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `run'']: <nil> is not true. 1 tests, 1 assertions, 1 failures, 0 errors rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...] Any ideas? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 11:39 UTC
Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 11:08, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have created a test application. It only has one model. When I run > tests on it it runs but still comes up with the same error message ie > > 1) Failure: > test_should_not_be_valid_without_story(AnnnetteTest)So your test is failing. Either you have written the test incorrectly or your application is not right. If you do not understand why the test is failing show us the code of the test and we may be able to help.> [./test/unit/annnette_test.rb:6:inThat is the line in your test where it is failing> `test_should_not_be_valid_without_story'' > /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in > `__send__'' > /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in > `run'']: > <nil> is not true.You have a test for something true, but it is actually nil. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
This is the test, it looks OK to me. require ''test_helper'' class AnnnetteTest < ActiveSupport::TestCase def test_should_not_be_valid_without_story a = Annnette.create(:story => ''Neil'') assert a.errors.on(:story) end end Gleble -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 12:06 UTC
Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 11:56, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: Please don''t top post, it makes it difficult to follow the thread. Insert your comments at appropriate point in previous message. Thanks.> This is the test, it looks OK to me. > require ''test_helper'' > > class AnnnetteTest < ActiveSupport::TestCase > def test_should_not_be_valid_without_story > a = Annnette.create(:story => ''Neil'') > assert a.errors.on(:story)So what can you deduce from this? The test says a.errors.on(:story) should be true. When you run the test it says it is nil. Your app is allowing the create without generating errors. However the test looks a bit odd. The name suggests that you are checking that you cannot create an Annnette without a story, yet you appear to be giving it one (''Neil''). Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 12:28 UTC
Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962761:> On 20 November 2010 11:56, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Please don''t top post, it makes it difficult to follow the thread. > Insert your comments at appropriate point in previous message. > Thanks. > >> This is the test, it looks OK to me. >> require ''test_helper'' >> >> class AnnnetteTest < ActiveSupport::TestCase >> def test_should_not_be_valid_without_story >> a = Annnette.create(:story => ''Neil'') >> assert a.errors.on(:story) > > So what can you deduce from this? The test says a.errors.on(:story) > should be true. When you run the test it says it is nil. Your app is > allowing the create without generating errors. However the test looks > a bit odd. The name suggests that you are checking that you cannot > create an Annnette without a story, yet you appear to be giving it one > (''Neil''). > > ColinSo I change line 6 to a = Annnette.create(:story => nil) and I still get 1) Failure: test_should_not_be_valid_without_story(AnnnetteTest) [./test/unit/annnette_test.rb:6:in `test_should_not_be_valid_without_story'' /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'' /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `run'']: <nil> is not true. 1 tests, 1 assertions, 1 failures, 0 errors rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 12:34 UTC
Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 12:28, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #962761: >> On 20 November 2010 11:56, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> Please don''t top post, it makes it difficult to follow the thread. >> Insert your comments at appropriate point in previous message. >> Thanks. >> >>> This is the test, it looks OK to me. >>> require ''test_helper'' >>> >>> class AnnnetteTest < ActiveSupport::TestCase >>> def test_should_not_be_valid_without_story >>> a = Annnette.create(:story => ''Neil'') >>> assert a.errors.on(:story) >> >> So what can you deduce from this? The test says a.errors.on(:story) >> should be true. When you run the test it says it is nil. Your app is >> allowing the create without generating errors. However the test looks >> a bit odd. The name suggests that you are checking that you cannot >> create an Annnette without a story, yet you appear to be giving it one >> (''Neil''). >> >> Colin > > So I change line 6 to > > a = Annnette.create(:story => nil) > > and I still get > > 1) Failure: > test_should_not_be_valid_without_story(AnnnetteTest) > [./test/unit/annnette_test.rb:6:in > `test_should_not_be_valid_without_story'' > /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in > `__send__'' > /home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in > `run'']: > <nil> is not true.You will have to look at the code of the app and work out why. Presumably somewhere in your code you have attempted to prevent the creation without a story. If you cannot see what is wrong with that code (the code that prevents the creation without a story) then you could look at the Rails Guide on debugging to help you to find out what is going on. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 13:00 UTC
Re: Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962765:> On 20 November 2010 12:28, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>>> class AnnnetteTest < ActiveSupport::TestCase >>> >> [./test/unit/annnette_test.rb:6:in >> `test_should_not_be_valid_without_story'' >> >/home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in>> `__send__'' >> >/home/neil/annnette/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in>> `run'']: >> <nil> is not true. > > You will have to look at the code of the app and work out why. > > Presumably somewhere in your code you have attempted to prevent the > creation without a story. > > If you cannot see what is wrong with that code (the code that prevents > the creation without a story) then you could look at the Rails Guide > on debugging to help you to find out what is going on. > > Colin> Presumably somewhere in your code you have attempted to prevent the > creation without a story.That can''t be so because this works neil@baby6:~/annnette$ script/console Loading development environment (Rails 2.2.3)>> a = Annnette.create(:story => ''neil'')=> #<Annnette id: 3, story: "neil", created_at: "2010-11-20 12:58:11", updated_at: "2010-11-20 12:58:11">>>-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 13:27 UTC
Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 13:00, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #962765: >> [...] >> Presumably somewhere in your code you have attempted to prevent the >> creation without a story. > > That can''t be so because this works > > neil@baby6:~/annnette$ script/console > Loading development environment (Rails 2.2.3) >>> a = Annnette.create(:story => ''neil'') > => #<Annnette id: 3, story: "neil", created_at: "2010-11-20 12:58:11", > updated_at: "2010-11-20 12:58:11">I am losing track of this conversation. I think we had better start again. Can you explain: 1. What the test you wrote is attempting to check. 2. What code you have written in the application to perform the operation that the test is checking. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Nov-20 13:29 UTC
Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 12:28, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:>>> class AnnnetteTest < ActiveSupport::TestCase >>> def test_should_not_be_valid_without_story >>> a = Annnette.create(:story => ''Neil'') >>> assert a.errors.on(:story) >> > So I change line 6 to > > a = Annnette.create(:story => nil) > > and I still get > > 1) Failure: > <nil> is not true.You should possibly not be using .create as that does a save at that point. The save will fail (because there''s no story) and "a" won''t be assigned anything. instead, try: a = Annnette.new(:story => nil) Or load a valid Annnette from your fixtures (or factories), set the story to nil, and check the errors. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 13:47 UTC
Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962775:> On 20 November 2010 13:00, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> => #<Annnette id: 3, story: "neil", created_at: "2010-11-20 12:58:11", >> updated_at: "2010-11-20 12:58:11"> > > I am losing track of this conversation. I think we had better start > again. Can you explain: > 1. What the test you wrote is attempting to check. > 2. What code you have written in the application to perform the > operation that the test is checking. > > Colin1.It should show an error if an attempt is made to create a story without a story entry. 2.This is from annnettes_controller.rb def create @annnette = Annnette.new(params[:annnette]) respond_to do |format| if @annnette.save flash[:notice] = ''Annnette was successfully created.'' format.html { redirect_to(@annnette) } format.xml { render :xml => @annnette, :status => :created, :location => @annnette } else format.html { render :action => "new" } format.xml { render :xml => @annnette.errors, :status => :unprocessable_entity } end end end It is a very simple app made with scaffold to try and understand the problems with my main app which started this thread. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 13:57 UTC
Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 13:47, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #962775: >> On 20 November 2010 13:00, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> => #<Annnette id: 3, story: "neil", created_at: "2010-11-20 12:58:11", >>> updated_at: "2010-11-20 12:58:11"> >> >> I am losing track of this conversation. I think we had better start >> again. Can you explain: >> 1. What the test you wrote is attempting to check. >> 2. What code you have written in the application to perform the >> operation that the test is checking. >> >> Colin > > 1.It should show an error if an attempt is made to create a story > without a story entry. > 2.This is from annnettes_controller.rb > > def create > @annnette = Annnette.new(params[:annnette]) > > respond_to do |format| > if @annnette.save > flash[:notice] = ''Annnette was successfully created.'' > format.html { redirect_to(@annnette) } > format.xml { render :xml => @annnette, :status => :created, > :location => @annnette } > else > format.html { render :action => "new" } > format.xml { render :xml => @annnette.errors, :status => > :unprocessable_entity } > end > end > endI don''t see anything there stopping a save if there is no story. Anyway this code is not called when you call Annnette.create, the create method of the model is called. As Michael has pointed out you probably want to use new rather than create in the test, but you still need code to stop the save if there is no story. Usually this would be done by a validation in the controller. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Nov-20 13:59 UTC
Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 13:47, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 1.It should show an error if an attempt is made to create a story > without a story entry. > 2.This is from annnettes_controller.rbBut you''re testing a Model... so the controller code is not very useful to help with what''s going on :-/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 14:49 UTC
Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Michael Pavling wrote in post #962781:> On 20 November 2010 13:47, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> 1.It should show an error if an attempt is made to create a story >> without a story entry. >> 2.This is from annnettes_controller.rb > > But you''re testing a Model... so the controller code is not very > useful to help with what''s going on :-/There is no code in models/annette.rb I would be happy if any test worked -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Nov-20 15:21 UTC
Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 14:49, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Michael Pavling wrote in post #962781: >> But you''re testing a Model... so the controller code is not very >> useful to help with what''s going on :-/ > > There is no code in models/annette.rbno "validates_presence_of :annnette"?> I would be happy if any test workedIf you''re writing code to validate db updates in your controller, and trying to test them with unit tests, I suggest you take a couple of steps back, buy and read the "Agile Web Development With Rails" book, and move forward from there. Regards, -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 15:32 UTC
Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 14:49, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Michael Pavling wrote in post #962781: >> On 20 November 2010 13:47, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> 1.It should show an error if an attempt is made to create a story >>> without a story entry. >>> 2.This is from annnettes_controller.rb >> >> But you''re testing a Model... so the controller code is not very >> useful to help with what''s going on :-/ > > There is no code in models/annette.rb > > I would be happy if any test workedIf you just want a test that works then change your existing test to one that checks that you _can_ create an object if you _do_ provide a story, use new instead of create and change the assert to assert_nil, something like class AnnnetteTest < ActiveSupport::TestCase def test_should_be_valid_with_story a = Annnette.new(:story => ''Neil'') assert_nil a.errors.on(:story) end Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 16:07 UTC
Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962795:> class AnnnetteTest < ActiveSupport::TestCase > def test_should_be_valid_with_story > a = Annnette.new(:story => ''Neil'') > assert_nil a.errors.on(:story) > end > > ColinOK that worked so I changed the test in my other app (the one that matters) to class StoryTest < ActiveSupport::TestCase def test_should_be_valid_with_author s = Story.create(:author => ''neil'', :title => ''Story'', :body => ''test'') assert s.errors.on(:author) end When I run the test I still get neil@baby6:~/********$ rake test:units (in /home/neil/********) /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/unit/comment_test.rb" "test/unit/user_mailer_test.rb" "test/unit/friendship_test.rb" "test/unit/helpers/friendship_helper_test.rb" "test/unit/helpers/profile_helper_test.rb" "test/unit/helpers/community_helper_test.rb" "test/unit/user_test.rb" "test/unit/story_test.rb" ruby index.rb <data dir> <index dir> rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...] Gleble -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 17:02 UTC
Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 16:07, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #962795: > >> class AnnnetteTest < ActiveSupport::TestCase >> def test_should_be_valid_with_story >> a = Annnette.new(:story => ''Neil'') >> assert_nil a.errors.on(:story) >> end >> >> Colin > > OK that worked so I changed the test in my other app (the one that > matters) to > > class StoryTest < ActiveSupport::TestCase > def test_should_be_valid_with_author > s = Story.create(:author => ''neil'', :title => ''Story'', :body => > ''test'')What is that create doing there?> assert s.errors.on(:author)That should be assert_nil if you expect no errors.> end > > When I run the test I still get > > neil@baby6:~/********$ rake test:units > (in /home/neil/********) > /usr/bin/ruby1.8 -I"lib:test" > "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/unit/comment_test.rb" > "test/unit/user_mailer_test.rb" "test/unit/friendship_test.rb" > "test/unit/helpers/friendship_helper_test.rb" > "test/unit/helpers/profile_helper_test.rb" > "test/unit/helpers/community_helper_test.rb" "test/unit/user_test.rb" > "test/unit/story_test.rb" > ruby index.rb <data dir> <index dir> > rake aborted! > Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" > "/usr/lib/ru...]That is a completely different error, it is rake that is aborting, not the test that is failing (that is why it says ''rake aborted''). It has not got as far as running the tests, so the content of the tests is immaterial. Show us the rest of the message - but first look through it yourself and see if you can see what is the problem, or at least some hint as to the problem. The next bit that you have not showed us may well be the key. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 18:21 UTC
Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962810:> > That is a completely different error, it is rake that is aborting, not > the test that is failing (that is why it says ''rake aborted''). It has > not got as far as running the tests, so the content of the tests is > immaterial. Show us the rest of the message - but first look through > it yourself and see if you can see what is the problem, or at least > some hint as to the problem. The next bit that you have not showed us > may well be the key. > > ColinThat''s what I thought at first. I built the test app t try and make sure the test bit worked . Anyhow heres the whole thing. Gleble neil@baby6:~/*****$ rake test:units --trace (in /home/neil/******) ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:load (first_time) ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:load ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load ** Execute test:units /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/unit/comment_test.rb" "test/unit/user_mailer_test.rb" "test/unit/friendship_test.rb" "test/unit/helpers/friendship_helper_test.rb" "test/unit/helpers/profile_helper_test.rb" "test/unit/helpers/community_helper_test.rb" "test/unit/user_test.rb" "test/unit/story_test.rb" ruby index.rb <data dir> <index dir> rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...] /usr/lib/ruby/1.8/rake.rb:995 /usr/lib/ruby/1.8/rake.rb:1010:in `call'' /usr/lib/ruby/1.8/rake.rb:1010:in `sh'' /usr/lib/ruby/1.8/rake.rb:1094:in `sh'' /usr/lib/ruby/1.8/rake.rb:1029:in `ruby'' /usr/lib/ruby/1.8/rake.rb:1094:in `ruby'' /usr/lib/ruby/1.8/rake/testtask.rb:117 /usr/lib/ruby/1.8/rake.rb:1112:in `verbose'' /usr/lib/ruby/1.8/rake/testtask.rb:102 /usr/lib/ruby/1.8/rake.rb:636:in `call'' /usr/lib/ruby/1.8/rake.rb:636:in `execute'' /usr/lib/ruby/1.8/rake.rb:631:in `each'' /usr/lib/ruby/1.8/rake.rb:631:in `execute'' /usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'' /usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'' /usr/lib/ruby/1.8/rake.rb:583:in `invoke'' /usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'' /usr/lib/ruby/1.8/rake.rb:2029:in `top_level'' /usr/lib/ruby/1.8/rake.rb:2029:in `each'' /usr/lib/ruby/1.8/rake.rb:2029:in `top_level'' /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'' /usr/lib/ruby/1.8/rake.rb:2023:in `top_level'' /usr/lib/ruby/1.8/rake.rb:2001:in `run'' /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'' /usr/lib/ruby/1.8/rake.rb:1998:in `run'' /usr/bin/rake:28 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 20:11 UTC
Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 18:21, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> [...] > neil@baby6:~/*****$ rake test:units --trace > (in /home/neil/******) > ** Invoke test:units (first_time) > ** Invoke db:test:prepare (first_time) > ** Invoke db:abort_if_pending_migrations (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:abort_if_pending_migrations > ** Execute db:test:prepare > ** Invoke db:test:load (first_time) > ** Invoke db:test:purge (first_time) > ** Invoke environment > ** Execute db:test:purge > ** Execute db:test:load > ** Invoke db:schema:load (first_time) > ** Invoke environment > ** Execute db:schema:load > ** Execute test:units > /usr/bin/ruby1.8 -I"lib:test" > "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/unit/comment_test.rb" > "test/unit/user_mailer_test.rb" "test/unit/friendship_test.rb" > "test/unit/helpers/friendship_helper_test.rb" > "test/unit/helpers/profile_helper_test.rb" > "test/unit/helpers/community_helper_test.rb" "test/unit/user_test.rb" > "test/unit/story_test.rb" > ruby index.rb <data dir> <index dir> > rake aborted! > Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" > "/usr/lib/ru...] > /usr/lib/ruby/1.8/rake.rb:995 > /usr/lib/ruby/1.8/rake.rb:1010:in `call'' > /usr/lib/ruby/1.8/rake.rb:1010:in `sh'' > /usr/lib/ruby/1.8/rake.rb:1094:in `sh'' > /usr/lib/ruby/1.8/rake.rb:1029:in `ruby'' > /usr/lib/ruby/1.8/rake.rb:1094:in `ruby'' > /usr/lib/ruby/1.8/rake/testtask.rb:117 > /usr/lib/ruby/1.8/rake.rb:1112:in `verbose'' > /usr/lib/ruby/1.8/rake/testtask.rb:102 > /usr/lib/ruby/1.8/rake.rb:636:in `call'' > /usr/lib/ruby/1.8/rake.rb:636:in `execute'' > /usr/lib/ruby/1.8/rake.rb:631:in `each'' > /usr/lib/ruby/1.8/rake.rb:631:in `execute'' > /usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'' > /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'' > /usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'' > /usr/lib/ruby/1.8/rake.rb:583:in `invoke'' > /usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'' > /usr/lib/ruby/1.8/rake.rb:2029:in `top_level'' > /usr/lib/ruby/1.8/rake.rb:2029:in `each'' > /usr/lib/ruby/1.8/rake.rb:2029:in `top_level'' > /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'' > /usr/lib/ruby/1.8/rake.rb:2023:in `top_level'' > /usr/lib/ruby/1.8/rake.rb:2001:in `run'' > /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'' > /usr/lib/ruby/1.8/rake.rb:1998:in `run'' > /usr/bin/rake:28What happens if you run one of the tests explicitly, for example ruby -I test test/unit/comment_test.rb That is a capital i in -I test, telling ruby to include the test folder. Otherwise I am getting out of my depth I think. Can anyone else suggest what the problem may be? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Nov-20 20:23 UTC
Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 20:11, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> What happens if you run one of the tests explicitly, for example > ruby -I test test/unit/comment_test.rb > > Otherwise I am getting out of my depth I think. Can anyone else > suggest what the problem may be?From the stack trace, it does look like it''s failing at story_test (unless that list of test files includes every single test in the directory...). As an extension of Colin''s suggestion to run one test; what if you remove the story_test.rb file from the directory to test running everything *apart* from that. If it works without the story_test, I''d guess there''s something in there that''s making it not parse... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 21:30 UTC
Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Does any of this help? Michael Pavling wrote in post #962835:> On 20 November 2010 20:11, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> What happens if you run one of the tests explicitly, for example >> ruby -I test test/unit/comment_test.rbneil@baby6:~/*****$ ruby -I test test/unit/comment_test.rb ruby index.rb <data dir> <index dir> neil@baby6:~/*****$> As an extension of Colin''s suggestion to run one test; what if you > remove the story_test.rb file from the directory to test running > everything *apart* from that. >That gives /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/unit/comment_test.rb" "test/unit/user_mailer_test.rb" "test/unit/friendship_test.rb" "test/unit/helpers/friendship_helper_test.rb" "test/unit/helpers/profile_helper_test.rb" "test/unit/helpers/community_helper_test.rb" "test/unit/user_test.rb" ruby index.rb <data dir> <index dir> rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...] (See full trace by running task with --trace) neil@baby6:~/wagging_tales$ -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-20 21:36 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 21:30, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Does any of this help? > > Michael Pavling wrote in post #962835: >> On 20 November 2010 20:11, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >>> What happens if you run one of the tests explicitly, for example >>> ruby -I test test/unit/comment_test.rb > > > neil@baby6:~/*****$ ruby -I test test/unit/comment_test.rb > ruby index.rb <data dir> <index dir>Is that all? What on earth is that about? What if you try one of the other tests? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-20 21:50 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962842:> On 20 November 2010 21:30, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Does any of this help? >> >> Michael Pavling wrote in post #962835: >>> On 20 November 2010 20:11, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >>>> What happens if you run one of the tests explicitly, for example >>>> ruby -I test test/unit/comment_test.rb >> >> >> neil@baby6:~/*****$ ruby -I test test/unit/comment_test.rb >> ruby index.rb <data dir> <index dir> > > Is that all? What on earth is that about? What if you try one of the > other tests? > > Colinneil@baby6:~/wagging_tales$ ruby -I test test/unit/story_test.rb ruby index.rb <data dir> <index dir> neil@baby6:~/wagging_tales$ Gleble -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-21 09:03 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 20 November 2010 21:50, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> neil@baby6:~/wagging_tales$ ruby -I test test/unit/story_test.rb > ruby index.rb <data dir> <index dir> > neil@baby6:~/wagging_tales$What happens if you put a trivial ruby program there and try and run it? Make a file test/unit/puts.rb and in it put just one line puts "hello" then run it ruby test/unit/puts.rb If that works (display hello obviously) then it is something about your test files. Empty one of the test files, and gradually build it back up until it starts to fail. That will hopefully give us a clue as to what is going on. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-21 11:12 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
> > If that works (display hello obviously) then it is something about > your test files. Empty one of the test files, and gradually build it > back up until it starts to fail. That will hopefully give us a clue > as to what is going on. > > ColinIt did work. I''ve removed all the tests except story_test.rb which looks like require ''test_helper'' class StoryTest < ActiveSupport::TestCase def test_should_be_valid_with_author s = Story.create(:author => ''neil'', :title => ''Story'', :body => ''test'') assert s.errors.on(:author) end end I get the same error as before until I remove the line unit/story_test.rb If I run ruby test/unit/story_test.rb I get test/unit/story_test.rb:1:in `require'': no such file to load -- test_helper (LoadError) from test/unit/story_test.rb:1 Could this be the problem, why can''t it find test_helper.rb Gleble -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-21 13:26 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 21 November 2010 11:12, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:>> >> If that works (display hello obviously) then it is something about >> your test files. Empty one of the test files, and gradually build it >> back up until it starts to fail. That will hopefully give us a clue >> as to what is going on. >> >> Colin > > It did work. I''ve removed all the tests except story_test.rb which looks > like > > require ''test_helper'' > > class StoryTest < ActiveSupport::TestCase > def test_should_be_valid_with_author > s = Story.create(:author => ''neil'', :title => ''Story'', :body => > ''test'') > assert s.errors.on(:author) > end > end > > I get the same error as before until I remove the line > > unit/story_test.rbWhat do you mean remove that line? I don''t see that line in the file anywhere.> > If I run > > ruby test/unit/story_test.rb > > I get > > test/unit/story_test.rb:1:in `require'': no such file to load -- > test_helper (LoadError) > from test/unit/story_test.rb:1 > > Could this be the problem, why can''t it find test_helper.rbYou get that because with the require ''test_helper'' line you need to tell ruby where to find it, as we did previously ruby -I test test/unit/story_test.rb The -I test tells it to include (-I) the folder test in it''s search. When you do rake test it does the -I for you. Can you post the contents of test/test_helper.rb Also try removing everything from story_test.rb except the test_helper line and try to run that (with the -I test) in the ruby call.> > Gleble > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-21 14:26 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962924:> On 21 November 2010 11:12, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> I get the same error as before until I remove the line >> >> unit/story_test.rb > > What do you mean remove that line? I don''t see that line in the file > anywhere.Sorry, should read I get the same error as before until I remove the line require ''test_helper'' If I edit story_test.rb so it only contains require ''test_helper'' this happens neil@baby6:~/*****$ ruby -I test test/unit/story_test.rb ruby index.rb <data dir> <index dir> neil@baby6:~/*****$ Attachments: http://www.ruby-forum.com/attachment/5431/test_helper.rb http://www.ruby-forum.com/attachment/5432/story_test.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-21 14:29 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Sorry wrong attachment Attachments: http://www.ruby-forum.com/attachment/5433/story_test.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-21 15:25 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
On 21 November 2010 14:26, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #962924: >> On 21 November 2010 11:12, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> >>> I get the same error as before until I remove the line >>> >>> unit/story_test.rb >> >> What do you mean remove that line? I don''t see that line in the file >> anywhere. > Sorry, should read I get the same error as before until I remove the > line > > require ''test_helper'' > > If I edit story_test.rb so it only contains require ''test_helper'' this > happens > > neil@baby6:~/*****$ ruby -I test test/unit/story_test.rb > ruby index.rb <data dir> <index dir> > neil@baby6:~/*****$ > > Attachments: > http://www.ruby-forum.com/attachment/5431/test_helper.rbI see that requires test_help. Please post that also. Did you not think I might have wanted to see that also? Just post it inline unless it is large. You have not mentioned it but I presume your app runs ok? If not then post environment.rb also. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-21 15:46 UTC
Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #962955: I''ve attached test_help.rb Had to go to /vendor/railties/lib to find it, is that right?> > You have not mentioned it but I presume your app runs ok? If not then > post environment.rb also.Yes it works fine. Gleble Attachments: http://www.ruby-forum.com/attachment/5434/test_help.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Nov-21 16:53 UTC
Re: rake test:unit gives Command failed with status (1):
On Nov 21, 3:46 pm, Neil Bye <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #962955: > > I''ve attached test_help.rb Had to go to /vendor/railties/lib to find > it, is that right? > > > > > You have not mentioned it but I presume your app runs ok? If not then > > post environment.rb also. > > Yes it works fine.My guess is that somewhere in your app you have a ruby script (probably called index.rb) that expects to be invoked on the command line with some arguments.When rails loads up your tests it loads everything in app/models, app/controllers (and probably a few other places) and ends up loading your index.rb script, which blows up since it wasn''t provided with the arguments it expects. Fred> > Gleble > > Attachments:http://www.ruby-forum.com/attachment/5434/test_help.rb > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-21 17:00 UTC
Re: Re: rake test:unit gives Command failed with status (1):
On 21 November 2010 16:53, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Nov 21, 3:46 pm, Neil Bye <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Colin Law wrote in post #962955: >> >> I''ve attached test_help.rb Had to go to /vendor/railties/lib to find >> it, is that right? >> >> >> >> > You have not mentioned it but I presume your app runs ok? If not then >> > post environment.rb also. >> >> Yes it works fine. > > My guess is that somewhere in your app you have a ruby script > (probably called index.rb) that expects to be invoked on the command > line with some arguments.When rails loads up your tests it loads > everything in app/models, app/controllers (and probably a few other > places) and ends up loading your index.rb script, which blows up since > it wasn''t provided with the arguments it expects.Just what I was about to suggest. Well that''s my story anyway :) It is amazing how something that seems obvious once pointed out can be so elusive. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote in post #962968:> On Nov 21, 3:46pm, Neil Bye <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Yes it works fine. > My guess is that somewhere in your app you have a ruby script > (probably called index.rb) that expects to be invoked on the command > line with some arguments. > FredI think you''ve got it, that gets rid of the line ruby index.rb <data dir> <index dir> which I think was the problem. Thanks everyone. When I run rake test:units now I get (See full trace by running task with --trace) neil@baby6:~/*****$ rake test:units (in /home/neil/******) /usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/unit/story_test.rb" Loaded suite /usr/lib/ruby/1.8/rake/rake_test_loader Started E Finished in 0.411785 seconds. 1) Error: test_should_be_valid_with_story(StoryTest): ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: avatars: DELETE FROM "avatars" WHERE 1=1 .... 1 tests, 0 assertions, 0 failures, 1 errors rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ru...] (See full trace by running task with --trace) So I think I just have to sort my tests out now. Gleble -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-21 21:44 UTC
Re: Re: rake test:unit gives Command failed with status (1):
On 21 November 2010 17:52, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote in post #962968: >> On Nov 21, 3:46pm, Neil Bye <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> Yes it works fine. >> My guess is that somewhere in your app you have a ruby script >> (probably called index.rb) that expects to be invoked on the command >> line with some arguments. >> Fred > > I think you''ve got it, that gets rid of the line > > ruby index.rb <data dir> <index dir> > > which I think was the problem. Thanks everyone.For the record can you tell us where the offending file was? Was it called index.rb? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Neil Bye
2010-Nov-22 09:01 UTC
Re: Re: rake test:unit gives Command failed with status (1):
Colin Law wrote in post #963001:> On 21 November 2010 17:52, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> ruby index.rb <data dir> <index dir> >> >> which I think was the problem. Thanks everyone. > > For the record can you tell us where the offending file was? Was it > called index.rb? > > ColinIt was called index.rb. There was one in app/controllers and one in app/models. I''ve attached the offending file. This morning they have both come back and cause the same problem. Removing them makes all OK. Have you any idea what the file is? Have you any idea how to stop it coming back? Gleble Attachments: http://www.ruby-forum.com/attachment/5435/index.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Nov-22 09:11 UTC
Re: Re: Re: rake test:unit gives Command failed with status (1):
On 22 November 2010 09:01, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #963001: >> On 21 November 2010 17:52, Neil Bye <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> ruby index.rb <data dir> <index dir> >>> >>> which I think was the problem. Thanks everyone. >> >> For the record can you tell us where the offending file was? Was it >> called index.rb? >> >> Colin > > It was called index.rb. There was one in app/controllers and one in > app/models. I''ve attached the offending file. This morning they have > both come back and cause the same problem. Removing them makes all OK. > Have you any idea what the file is? Have you any idea how to stop it > coming back?I suggest watching to find what it is you do that makes them come back. Looking at the file, presumably it is something to do with Ferret. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.