Skip to content

Commit

Permalink
Merge pull request #58 from stitchfix/fix-bug-with-generator
Browse files Browse the repository at this point in the history
make sure the include goes on its own line
  • Loading branch information
davetron5000 authored Jun 15, 2018
2 parents b56890c + 928e94a commit c457ed6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/stitches/add_deprecation_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class AddDeprecationGenerator < Rails::Generators::Base
desc "Adds deprecation support to an app creates with an older version of stitches"
def add_deprecation
inject_into_file "app/controllers/api/api_controller.rb", after: /^class.*$/ do<<-CODE
include Stitches::Deprecation
CODE
end
Expand Down
9 changes: 6 additions & 3 deletions spec/integration/add_to_rails_app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ def run(command)

run "bin/rails generate stitches:add_deprecation"

aggregate_failures do
expect(File.read(api_controller)).to include("include Stitches::Deprecation")
end
lines = File.read(api_controller).split(/\n/)
include_line = lines.detect { |line|
line =~ /^\s+include Stitches::Deprecation$/
}

expect(include_line).to_not be_nil,lines.inspect
end

class RoutesFileAnalysis
Expand Down

0 comments on commit c457ed6

Please sign in to comment.