Topic: first time writing tests, some questions & before_filter causing error

In my App controller I run a before filter to find the current @site, but when I run the default tests that the Rails has I get a NoMethodError when I try to query @site.domain (since it obviously hasn't been looked up). Not sure how to proceed here?

Also, should I just use Rails for my tests, or should I look in to some other test tools (like cucumber). If so, what should I look into?

Re: first time writing tests, some questions & before_filter causing error

Hi ngng,

For your problem with NoMethodError, can you paste your app controller code, your test code and the command you execute to run the test?

If you're beginning with tests, that's fine to just use Rails default test tool, as it's already set up. You can start with http://guides.rubyonrails.org/testing.html, and I recommend this book which very good: http://pragprog.com/titles/nrtest/rails … scriptions

Once you feel confortable with the Rails default test tool and need more, you can move to more advanced tools like Cucumber and rSpec, also covered by the Rails Test Prescriptions book. The rSpec book is very good also: http://pragprog.com/titles/achbd/the-rspec-book