Skip to content

Commit

Permalink
Fixes some issues with the generator
Browse files Browse the repository at this point in the history
- putting stuff in spec_helper that should be in rails_helper
- not requiring some gems when needed
- referencing spec_helper instead of rails_helper
- not including capybara (not sure why this isn't brought in by rspec_api_documentation)
  • Loading branch information
davetron5000 committed Nov 15, 2015
1 parent 7e7ca4f commit 0425a83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions lib/stitches/api_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def bootstrap_api

inject_into_file "Gemfile", after: /^group :test, :development do.*$/ do<<-GEM
gem "rspec_api_documentation"
gem "rspec_api_documentation"
gem "capybara"
GEM
end
run 'bundle install'
Expand All @@ -62,16 +63,17 @@ def bootstrap_api
sleep 1 # allow clock to tick so we get different numbers
migration_template "db/migrate/create_api_clients.rb", "db/migrate/create_api_clients.rb"

inject_into_file 'spec/spec_helper.rb', %q{
inject_into_file 'spec/rails_helper.rb', %q{
config.include RSpec::Rails::RequestExampleGroup, type: :feature
}, before: /^end/

inject_into_file 'spec/spec_helper.rb', before: /^RSpec.configure/ do<<-REQUIRE
inject_into_file 'spec/rails_helper.rb', before: /^RSpec.configure/ do<<-REQUIRE
require 'stitches/spec'
REQUIRE
end

append_to_file 'spec/spec_helper.rb' do<<-RSPEC_API
append_to_file 'spec/rails_helper.rb' do<<-RSPEC_API
require 'rspec_api_documentation'
RspecApiDocumentation.configure do |config|
config.format = :json
config.request_headers_to_include = %w(
Expand All @@ -94,4 +96,4 @@ def bootstrap_api

end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
require 'rspec_api_documentation/dsl'

resource "Ping (V1)" do
Expand Down
2 changes: 1 addition & 1 deletion lib/stitches/generator_files/spec/features/api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper.rb'
require 'rails_helper.rb'

feature "general API stuff" do
scenario "good request" do
Expand Down

0 comments on commit 0425a83

Please sign in to comment.