SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Nov 7, 2007, 00:26 #1
- Join Date
- Nov 2007
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
P. Lenz's Ruby Book : rake test : units [FIXED]
solution : in /test/fixtures/stories.yml
I was having a bad indentation, now no more error.
Thanks for reply !
Hello,
I'm just starting using RoR for an internship.
I'm following P. Lenz book and I have a strange error when I try to run test in units using rake.
I have the same error that I'm describing in my post now for the functional test
Page : 171 : first use of rake test:units
my test who live in test/unit/story_test.rb
Code Ruby:require File.dirname(__FILE__) + '/../test_helper' class StoryTest < Test::Unit::TestCase fixtures :stories def test_should_require_name s = Story.create(:name => nil) assert s.errors.on(:name) end def test_should_require_lik s = Story.create(:link => nil) assert s.errors.on(:link) end def test_should_create_story s = Story.create(:name => 'testtest', :link => 'linktest') assert s.valid? end end
the log result after launching rake test:units (only for the first test, and the end of the error), run as root on server.
in /shovell i run rake test:units
(in /home/admin/shovell)
/usr/bin/ruby -Ilib:test "/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb" "test/unit/story_test.rb"
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader
Started
EEE
Finished in 0.14955 seconds.
1) Error:
test_should_create_story(StoryTest):
Errno::ENOENT: No such file or directory - SitePoint Forums
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:432:in `readlines'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:432:in `read_fixture_file'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:386:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:326:in `new'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:326:in `read_fixture_files'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:321:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:321:in `read_fixture_files'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:320:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:320:in `read_fixture_files'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:281:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:251:in `new'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:251:in `create_fixtures'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:250:in `map'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:250:in `create_fixtures'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/base.rb:867:in `silence'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:248:in `create_fixtures'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:593:in `load_fixtures'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.4/lib/active_record/fixtures.rb:538:in `setup'
//////.... I skip the other errors log (same error as the first one) ..... //////
3 tests, 0 assertions, 0 failures, 3 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby -Ilib:test "/usr/lib/ruby/ge...]
See the second line of the error 1
my first question is how can I have something about site point forum in my trace, I am just following the book I don't have write my self the file, I haven't copy any file from the website SitePoint.
I'm running Fedora Core 7.
[root@localhost shovell]# ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-linux]
[root@localhost shovell]# rake --version
rake, version 0.7.3
[root@localhost shovell]# mysql --version
mysql Ver 14.12 Distrib 5.0.37, for redhat-linux-gnu (i686) using readline 5.0
[root@localhost shovell]#
I have search via google and in this forum and I havent find any related answer.
Did somebody here have the same error log or can explain me what's happen ?
Cordialy
RMLast edited by Jarrek; Nov 12, 2007 at 04:17. Reason: adding informations
-
Nov 7, 2007, 13:33 #2
- Join Date
- May 2006
- Location
- Central Florida
- Posts
- 2,345
- Mentioned
- 192 Post(s)
- Tagged
- 5 Thread(s)
I would bet money that "SitePoint Forums" is in your test database.
Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)
►Git is for EVERYONE
►Literally, the best app for readers.
►Make Your P@ssw0rd Secure
►Leveraging SubDomains
-
Nov 8, 2007, 04:38 #3
- Join Date
- Nov 2007
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thank you for your reply
You are lucky ParkinT I don't use to bet money
I have just check my test database using ruby script/console :
I have try to find SitePoint Forums in each attributes of my database and ruby reply me nil each time...
Code Ruby:>> Story.find_by_name('SitePoint Forums') => nil >> Story.find_by_link('SitePoint Forums') => nil >> Story.find_by_id('SitePoint Forums') => nil >> Story.find_by_name('sandrine') => #<Story:0xb76b8cc8 @attributes={"name"=>"sandrine", "id"=>"4", "link"=>"menuires"}> >> Story.find(:all) => [#<Story:0xb7737b68 @attributes={"name"=>"sandrine", "id"=>"4", "link"=>"menuires"}>, #<Story:0xb7737af0 @attributes={"name"=>"paa", "id"=>"13", "link"=>"pa"}>] >>
[root@localhost shovell]# ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-linux]
[root@localhost shovell]# rake --version
rake, version 0.7.3
[root@localhost shovell]# mysql --version
mysql Ver 14.12 Distrib 5.0.37, for redhat-linux-gnu (i686) using readline 5.0
[root@localhost shovell]#
Do you or somebody have another idea related to this strange error ?
CordialyLast edited by Jarrek; Nov 8, 2007 at 05:04. Reason: adding information
RM
-
Dec 20, 2007, 12:06 #4
- Join Date
- Dec 2007
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
commented everything in stories.yml
I had exactly the same error, I commented everything in the file stories.yml and it works fine.
Bookmarks