Volkan Unsal
2011-Jan-07 23:17 UTC
[rspec-users] How to test scripts in the lib directory of Rails?
I have a script called query.rb inside my lib folder in Rails 3. I am
writing a spec test for it. Though I''m no sure how to reference the
Query class from my tests. Whenever I use Query, RSpec complain that
it''s not able to find it.
This is how I wrote it:
before(:each) do
query = Query.new
end
How can I make sure that Query is accessible by the spec?
Nick
2011-Jan-08 00:13 UTC
[rspec-users] How to test scripts in the lib directory of Rails?
Hey Volkan. Make sure to "require" the file that your Query class is in. Usually this is done at the top of query_spec.rb , or in spec_helper.rb . Cheers, Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110107/bffff3fc/attachment.html>
Volkan Unsal
2011-Jan-08 00:44 UTC
[rspec-users] How to test scripts in the lib directory of Rails?
D''oh! Thanks Nick! On Jan 7, 7:13?pm, Nick <n... at deadorange.com> wrote:> Hey Volkan. Make sure to "require" the file that your Query class is in. > Usually this is done at the top of query_spec.rb , or in spec_helper.rb . > > Cheers, > Nick > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users