From 0425a8379241733fe63590ad91898c5c9fdb3ad2 Mon Sep 17 00:00:00 2001 From: Dave Copeland Date: Sun, 15 Nov 2015 09:29:13 -0500 Subject: [PATCH] Fixes some issues with the generator - 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) --- lib/stitches/api_generator.rb | 12 +++++++----- .../generator_files/spec/acceptance/ping_v1_spec.rb | 2 +- .../generator_files/spec/features/api_spec.rb | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/stitches/api_generator.rb b/lib/stitches/api_generator.rb index e4b885e..a35705b 100644 --- a/lib/stitches/api_generator.rb +++ b/lib/stitches/api_generator.rb @@ -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' @@ -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( @@ -94,4 +96,4 @@ def bootstrap_api end end -end \ No newline at end of file +end diff --git a/lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb b/lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb index 603859d..4ce42f2 100644 --- a/lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb +++ b/lib/stitches/generator_files/spec/acceptance/ping_v1_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' require 'rspec_api_documentation/dsl' resource "Ping (V1)" do diff --git a/lib/stitches/generator_files/spec/features/api_spec.rb b/lib/stitches/generator_files/spec/features/api_spec.rb index 76bc03e..3efaf39 100644 --- a/lib/stitches/generator_files/spec/features/api_spec.rb +++ b/lib/stitches/generator_files/spec/features/api_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper.rb' +require 'rails_helper.rb' feature "general API stuff" do scenario "good request" do