|
4 | 4 | require_relative 'integration_helper'
|
5 | 5 |
|
6 | 6 | describe 'Integration testing on Rails 5.2.4.1', if: IntegrationHelper.able_to_run?(__FILE__, RUBY_VERSION) do
|
7 |
| - let(:app_name) { 'rails_5.2.4.1' } |
| 7 | + ::APP_NAME = 'rails_5.2.4.1'.freeze |
| 8 | + ::PROJECT_PATH = File.expand_path('../..', __dir__) |
| 9 | + ::APP_PATH = File.expand_path(APP_NAME, __dir__) |
| 10 | + ::MIGRATION_COMMAND = 'bin/rails db:migrate'.freeze |
8 | 11 |
|
9 |
| - let(:project_path) { File.expand_path('../..', __dir__) } |
10 |
| - let!(:app_path) { File.expand_path(app_name, __dir__) } |
| 12 | + let!(:git) { Git.open(PROJECT_PATH) } |
11 | 13 |
|
12 |
| - let!(:git) { Git.open(project_path) } |
13 |
| - |
14 |
| - let(:migration_command) { 'bin/rails db:migrate' } |
15 |
| - |
16 |
| - before do |
| 14 | + before(:all) do |
17 | 15 | Bundler.with_clean_env do
|
18 |
| - Dir.chdir app_path do |
| 16 | + Dir.chdir APP_PATH do |
19 | 17 | puts `bundle install`
|
20 |
| - puts `#{migration_command}` |
| 18 | + puts `#{MIGRATION_COMMAND}` |
21 | 19 | end
|
22 | 20 | end
|
23 | 21 | end
|
24 | 22 |
|
25 |
| - after do |
| 23 | + after(:each) do |
26 | 24 | git.reset_hard
|
27 | 25 | end
|
28 | 26 |
|
|
95 | 93 |
|
96 | 94 | it 'annotate models' do
|
97 | 95 | Bundler.with_clean_env do
|
98 |
| - Dir.chdir app_path do |
| 96 | + Dir.chdir APP_PATH do |
99 | 97 | expect(git.diff.any?).to be_falsy
|
100 | 98 |
|
101 | 99 | puts `#{command}`
|
|
145 | 143 |
|
146 | 144 | it 'annotate routes.rb' do
|
147 | 145 | Bundler.with_clean_env do
|
148 |
| - Dir.chdir app_path do |
| 146 | + Dir.chdir APP_PATH do |
149 | 147 | expect(git.diff.any?).to be_falsy
|
150 | 148 |
|
151 | 149 | puts `#{command}`
|
152 | 150 |
|
153 |
| - expect(git.diff.entries).to include( |
154 |
| - an_object_having_attributes(task_routes) |
155 |
| - ) |
| 151 | + expect(git.diff.entries).to include(an_object_having_attributes(task_routes)) |
156 | 152 | end
|
157 | 153 | end
|
158 | 154 | end
|
|
0 commit comments