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).
On Sat, Jul 30, 2011 at 2:07 PM, dblock [email protected] 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
[email protected]
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/
}
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
rspec-rails/lib/rspec/rails/example.rb at master · rspec/rspec-rails · GitHub.
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