Ruby on Rails Sunday, November 21, 2010

On 21 November 2010 11:12, Neil Bye <lists@ruby-forum.com> 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.rb

What 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.rb

You 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@googlegroups.com.
> 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@googlegroups.com.
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.

No comments:

Post a Comment