Rswag: rspec is failing on default rswag example

Created on 17 Jan 2019  路  4Comments  路  Source: rswag/rswag

I added to my gemfile:

gem 'rswag'

 group :test do
   gem 'rspec-rails', '~> 3.5'
end

and created a test file spec/integration/my_api_spec.rb
where I put the default pet test present in the README file of rswag, but when I run
bundle exec rake rswag:specs:swaggerize

I get this error:
```An error occurred while loading ./spec/integration/my_api_spec.rb.
Failure/Error: tag 'Create Tag'

NoMethodError:
undefined method 'tag' for RSpec::ExampleGroups::MyAPI::ApiMy:Class

if I remove the tag I get

An error occurred while loading ./spec/integration/my_api_spec.rb.
Failure/Error: consumes 'application/json'

NoMethodError:
undefined method '[]=' for nil:NilClass

The test file includes ```require 'swagger_helper'``` which containes the following:

require 'rails_helper'

RSpec.configure do |config|

config.swagger_root = Rails.root.to_s + '/swagger'
config.swagger_docs = {
'v1/swagger.json' => {
swagger: '2.0',
info: {
title: 'API V1',
version: 'v1'
},
paths: {}
}
}
end
```

Most helpful comment

I am facing the same issue.

All 4 comments

Can you post the my_api_spec.rb file?

I am facing the same issue.

This error occurs when you use tag 'foo' inside of your spec, instead of tags 'foo'. It's supposed to be plural tags

Sorry for the late response, I will try this and post the file if it still fails

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcoms picture mcoms  路  4Comments

richthedev picture richthedev  路  5Comments

douglasrlee picture douglasrlee  路  4Comments

johnmcdowall picture johnmcdowall  路  5Comments

nicwillemse picture nicwillemse  路  4Comments