Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use :type => :api to mark example groups in spec/api/ #703

Closed
gaganawhad opened this issue Feb 28, 2013 · 4 comments
Closed

Can't use :type => :api to mark example groups in spec/api/ #703

gaganawhad opened this issue Feb 28, 2013 · 4 comments

Comments

@gaganawhad
Copy link

I recently tried using :type => :api for marking example groups I want to use an api helper in, by doing something like

RSpec.configure do |c|
  c.include ApiHelper, :type => :api
end

but realized that things weren't working as expected. Also, something like

RSpec.configure do |c|
  c.include ApiHelper, :foo => :bar
end

worked fine.

I think its because :type => :request is already set on example groups in spec/api/ when using rspec-rails.

Not sure what the right fix in this case should be. Whether using ':type' key to mark example groups should be disallowed and that should be documented somewhere or whether rspec-rails should use :type => :api for example groups in spec/api/ and have the include request helpers, or whether there should be some other way to overload the functionality...

Let me know if there is something I can do.

@alindeman
Copy link
Contributor

Thank you for reporting this. I'll be taking a look in the next few days.

@alindeman
Copy link
Contributor

Verified: I think rspec-rails is being opinioned here and "owning" the spec/api directory. It automatically tags specs in spec/api, spec/integration, and spec/requests as :request.

I recommend you include your ApiHelper for :type => :request or use a different directory.

@gaganawhad
Copy link
Author

if rspec-rails is owning spec/api and spec/integration, would it be more elegant to tag specs in them has :api and :integration respectively ? The appropriate request (and other) helpers could be included for those tags then.

Just a thought.

@javidjamae
Copy link

Marking :type => :api worked fine for me, but my folder is /spec/apis not /spec/api, FWIW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants