dblock
2011-Jul-30 20:07 UTC
[rspec-users] How can I add another ''requests''-like folder?
I love conventions. But I am trying to write tests for an API,which lives in ... api. I need to be making http requests, so all my tests work when put in spec/requests. How can I make that spec/api? (Obviously renaming requests into api doesn''t bring in the code that lets me do GETs).
David Chelimsky
2011-Jul-30 20:55 UTC
[rspec-users] How can I add another ''requests''-like folder?
On Jul 30, 2011, at 3:07 PM, dblock wrote:> I love conventions. But I am trying to write tests for an API,which > lives in ... api. I need to be making http requests, so all my tests > work when put in spec/requests. How can I make that spec/api? > (Obviously renaming requests into api doesn''t bring in the code that > lets me do GETs).Take a look at https://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/example.rb. You can do something similar in spec_helper.rb: RSpec::configure do |c| c.include RSpec::Rails::RequestExampleGroup, :example_group => { :file_path => /spec\/api// } end
Justin Ko
2011-Jul-30 22:02 UTC
[rspec-users] How can I add another ''requests''-like folder?
On Sat, Jul 30, 2011 at 2:07 PM, dblock <dblockdotorg at gmail.com> wrote:> I love conventions. But I am trying to write tests for an API,which > lives in ... api. I need to be making http requests, so all my tests > work when put in spec/requests. How can I make that spec/api? > (Obviously renaming requests into api doesn''t bring in the code that > lets me do GETs). > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Add this to your spec_helper.rb: c.include RSpec::Rails::RequestExampleGroup, :type => :request, :example_group => { :file_path => /spec\/api/ } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110730/9a95314a/attachment.html>