shipit-engine 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -37
  3. data/app/assets/javascripts/task/tty.js.coffee +40 -22
  4. data/app/assets/stylesheets/_pages/_deploy.scss +1 -0
  5. data/app/controllers/shipit/api/locks_controller.rb +3 -3
  6. data/app/controllers/shipit/api/stacks_controller.rb +14 -1
  7. data/app/controllers/shipit/commit_checks_controller.rb +9 -2
  8. data/app/controllers/shipit/shipit_controller.rb +1 -1
  9. data/app/controllers/shipit/stacks_controller.rb +11 -5
  10. data/app/controllers/shipit/status_controller.rb +1 -1
  11. data/app/controllers/shipit/webhooks_controller.rb +15 -5
  12. data/app/helpers/shipit/deploys_helper.rb +1 -1
  13. data/app/helpers/shipit/shipit_helper.rb +2 -0
  14. data/app/jobs/shipit/perform_commit_checks_job.rb +2 -0
  15. data/app/jobs/shipit/perform_task_job.rb +18 -8
  16. data/app/models/shipit/commit.rb +22 -12
  17. data/app/models/shipit/commit_checks.rb +20 -53
  18. data/app/models/shipit/deploy.rb +1 -1
  19. data/app/models/shipit/ephemeral_commit_checks.rb +76 -0
  20. data/app/models/shipit/stack.rb +40 -10
  21. data/app/models/shipit/status.rb +14 -8
  22. data/app/models/shipit/status_group.rb +1 -1
  23. data/app/models/shipit/task.rb +2 -0
  24. data/app/models/shipit/unknown_status.rb +4 -0
  25. data/app/models/shipit/user.rb +9 -1
  26. data/app/serializers/shipit/stack_serializer.rb +6 -1
  27. data/app/views/shipit/commit_checks/_checks.html.erb +13 -0
  28. data/app/views/shipit/commit_checks/show.html.erb +5 -0
  29. data/app/views/shipit/stacks/_header.html.erb +1 -1
  30. data/app/views/shipit/stacks/show.html.erb +15 -0
  31. data/config/routes.rb +2 -1
  32. data/db/migrate/20140226233935_create_baseline.rb +10 -10
  33. data/db/migrate/20160802092812_add_continuous_delivery_delayed_since_to_stacks.rb +5 -0
  34. data/db/migrate/20160822131405_add_locked_since_to_stacks.rb +5 -0
  35. data/lib/shipit.rb +4 -0
  36. data/lib/shipit/command.rb +1 -1
  37. data/lib/shipit/commands.rb +10 -7
  38. data/lib/shipit/csv_serializer.rb +1 -1
  39. data/lib/shipit/stack_commands.rb +17 -5
  40. data/lib/shipit/task_commands.rb +2 -2
  41. data/lib/shipit/version.rb +1 -1
  42. data/lib/snippets/push-to-heroku +20 -16
  43. data/test/controllers/api/deploys_controller_test.rb +8 -8
  44. data/test/controllers/api/hooks_controller_test.rb +11 -9
  45. data/test/controllers/api/locks_controller_test.rb +16 -6
  46. data/test/controllers/api/outputs_controller_test.rb +1 -1
  47. data/test/controllers/api/stacks_controller_test.rb +48 -3
  48. data/test/controllers/api/tasks_controller_test.rb +6 -6
  49. data/test/controllers/commit_checks_controller_test.rb +3 -3
  50. data/test/controllers/deploys_controller_test.rb +13 -13
  51. data/test/controllers/rollbacks_controller_test.rb +7 -7
  52. data/test/controllers/stacks_controller_test.rb +36 -29
  53. data/test/controllers/tasks_controller_test.rb +14 -14
  54. data/test/controllers/webhooks_controller_test.rb +16 -25
  55. data/test/dummy/config/application.rb +0 -3
  56. data/test/dummy/config/environments/test.rb +2 -2
  57. data/test/dummy/data/stacks/byroot/junk/production/git/bar.txt +2 -0
  58. data/test/dummy/data/stacks/byroot/junk/production/git/bin/slow +7 -0
  59. data/test/dummy/data/stacks/byroot/junk/production/git/bin/timeout +10 -0
  60. data/test/dummy/data/stacks/byroot/junk/production/git/dkfdsf +0 -0
  61. data/test/dummy/data/stacks/byroot/junk/production/git/dskjfsd +0 -0
  62. data/test/dummy/data/stacks/byroot/junk/production/git/dslkjfjsdf +0 -0
  63. data/test/dummy/data/stacks/byroot/junk/production/git/plopfizz +0 -0
  64. data/test/dummy/data/stacks/byroot/junk/production/git/sd +0 -0
  65. data/test/dummy/data/stacks/byroot/junk/production/git/sdkfjsdf +1 -0
  66. data/test/dummy/data/stacks/byroot/junk/production/git/sdlfjsdfdsfj +0 -0
  67. data/test/dummy/data/stacks/byroot/junk/production/git/sdlkfjsdlkfjsdlkfjdsfsdfksdfjsldkfjsdlkfjsdf +0 -0
  68. data/test/dummy/data/stacks/byroot/junk/production/git/shipit.yml +21 -0
  69. data/test/dummy/data/stacks/byroot/junk/production/git/toto.txt +2 -0
  70. data/test/dummy/db/development.sqlite3 +0 -0
  71. data/test/dummy/db/schema.rb +15 -13
  72. data/test/dummy/db/test.sqlite3 +0 -0
  73. data/test/fixtures/shipit/commit_deployments.yml +8 -8
  74. data/test/fixtures/shipit/output_chunks.yml +12 -12
  75. data/test/fixtures/shipit/tasks.yml +9 -1
  76. data/test/fixtures/shipit/users.yml +9 -2
  77. data/test/jobs/perform_task_job_test.rb +14 -11
  78. data/test/models/commits_test.rb +33 -14
  79. data/test/models/stacks_test.rb +78 -4
  80. data/test/models/users_test.rb +16 -0
  81. data/test/unit/commands_test.rb +4 -0
  82. data/test/unit/deploy_commands_test.rb +1 -1
  83. metadata +133 -34
  84. data/app/jobs/shipit/git_mirror_update_job.rb +0 -14
  85. data/app/views/shipit/deploys/_checks.html.erb +0 -11
@@ -11,7 +11,6 @@ module Shipit
11
11
  test "validates that Shipit.github_oauth_id is present" do
12
12
  Shipit.stubs(github_oauth_credentials: {'secret' => 'abc'})
13
13
  get :index
14
- assert_template 'missing_settings'
15
14
  assert_select "#github_oauth_id .missing"
16
15
  assert_select ".missing", count: 1
17
16
  end
@@ -19,7 +18,6 @@ module Shipit
19
18
  test "validates that Shipit.github_oauth_secret is present" do
20
19
  Shipit.stubs(github_oauth_credentials: {'id' => 'abc'})
21
20
  get :index
22
- assert_template 'missing_settings'
23
21
  assert_select "#github_oauth_secret .missing"
24
22
  assert_select ".missing", count: 1
25
23
  end
@@ -27,7 +25,6 @@ module Shipit
27
25
  test "validates that Shipit.github_api_credentials is present" do
28
26
  Shipit.stubs(github_api_credentials: {})
29
27
  get :index
30
- assert_template 'missing_settings'
31
28
  assert_select "#github_api .missing"
32
29
  assert_select ".missing", count: 1
33
30
  end
@@ -35,7 +32,6 @@ module Shipit
35
32
  test "validates that Shipit.redis_url is present" do
36
33
  Shipit.stubs(redis_url: nil)
37
34
  get :index
38
- assert_template 'missing_settings'
39
35
  assert_select "#redis_url .missing"
40
36
  assert_select ".missing", count: 1
41
37
  end
@@ -43,7 +39,6 @@ module Shipit
43
39
  test "validates that Shipit.host is present" do
44
40
  Shipit.stubs(host: nil)
45
41
  get :index
46
- assert_template 'missing_settings'
47
42
  assert_select "#host .missing"
48
43
  assert_select ".missing", count: 1
49
44
  end
@@ -66,33 +61,32 @@ module Shipit
66
61
  end
67
62
 
68
63
  test "#show is success" do
69
- get :show, id: @stack.to_param
64
+ get :show, params: {id: @stack.to_param}
70
65
  assert_response :ok
71
66
  end
72
67
 
73
68
  test "#show handles locked stacks without a lock_author" do
74
69
  @stack.update!(lock_reason: "I am a lock with no author")
75
- get :show, id: @stack.to_param
70
+ get :show, params: {id: @stack.to_param}
76
71
  end
77
72
 
78
73
  test "#show auto-links URLs in lock reason" do
79
74
  @stack.update!(lock_reason: 'http://google.com')
80
- get :show, id: @stack.to_param
75
+ get :show, params: {id: @stack.to_param}
81
76
  assert_response :ok
82
77
  assert_select 'a[href="http://google.com"]'
83
78
  end
84
79
 
85
80
  test "#create creates a Stack, queues a job to setup webhooks and redirects to it" do
86
- params = {}
87
- params[:stack] = {
88
- repo_name: "rails",
89
- repo_owner: "rails",
90
- environment: "staging",
91
- branch: "staging",
92
- }
93
-
94
81
  assert_difference "Stack.count" do
95
- post :create, params
82
+ post :create, params: {
83
+ stack: {
84
+ repo_name: 'rails',
85
+ repo_owner: 'rails',
86
+ environment: 'staging',
87
+ branch: 'staging',
88
+ },
89
+ }
96
90
  end
97
91
 
98
92
  assert_redirected_to stack_path(Stack.last)
@@ -100,28 +94,27 @@ module Shipit
100
94
 
101
95
  test "#create when not valid renders new" do
102
96
  assert_no_difference "Stack.count" do
103
- post :create, stack: {repo_owner: 'some', repo_name: 'owner/path'}
97
+ post :create, params: {stack: {repo_owner: 'some', repo_name: 'owner/path'}}
104
98
  end
105
-
106
- assert_template :new
99
+ assert_response :success
107
100
  end
108
101
 
109
102
  test "#destroy enqueues a DestroyStackJob" do
110
103
  assert_enqueued_with(job: DestroyStackJob, args: [@stack]) do
111
- delete :destroy, id: @stack.to_param
104
+ delete :destroy, params: {id: @stack.to_param}
112
105
  end
113
106
  assert_redirected_to stacks_path
114
107
  end
115
108
 
116
109
  test "#settings is success" do
117
- get :settings, id: @stack.to_param
110
+ get :settings, params: {id: @stack.to_param}
118
111
  assert_response :success
119
112
  end
120
113
 
121
114
  test "#update allows to lock the stack" do
122
115
  refute @stack.locked?
123
116
 
124
- patch :update, id: @stack.to_param, stack: {lock_reason: 'Went out to eat some chips!'}
117
+ patch :update, params: {id: @stack.to_param, stack: {lock_reason: 'Went out to eat some chips!'}}
125
118
  @stack.reload
126
119
  assert @stack.locked?
127
120
  assert_equal shipit_users(:walrus), @stack.lock_author
@@ -131,7 +124,7 @@ module Shipit
131
124
  @stack.update!(lock_reason: 'Went out to eat some chips!')
132
125
  assert @stack.locked?
133
126
 
134
- patch :update, id: @stack.to_param, stack: {lock_reason: ''}
127
+ patch :update, params: {id: @stack.to_param, stack: {lock_reason: ''}}
135
128
  @stack.reload
136
129
  refute @stack.locked?
137
130
  assert_instance_of AnonymousUser, @stack.lock_author
@@ -142,7 +135,7 @@ module Shipit
142
135
 
143
136
  assert_enqueued_with(job: RefreshStatusesJob, args: [stack_id: @stack.id]) do
144
137
  assert_enqueued_with(job: GithubSyncJob, args: [stack_id: @stack.id]) do
145
- post :refresh, id: @stack.to_param
138
+ post :refresh, params: {id: @stack.to_param}
146
139
  end
147
140
  end
148
141
 
@@ -151,26 +144,40 @@ module Shipit
151
144
 
152
145
  test "#sync_webhooks queues #{Stack::REQUIRED_HOOKS.count} SetupGithubHookJob" do
153
146
  assert_enqueued_jobs(Stack::REQUIRED_HOOKS.count) do
154
- post :sync_webhooks, id: @stack.to_param
147
+ post :sync_webhooks, params: {id: @stack.to_param}
155
148
  end
156
149
  assert_redirected_to stack_settings_path(@stack)
157
150
  end
158
151
 
159
152
  test "#clear_git_cache queues a ClearGitCacheJob" do
160
153
  assert_enqueued_with(job: ClearGitCacheJob, args: [@stack]) do
161
- post :clear_git_cache, id: @stack.to_param
154
+ post :clear_git_cache, params: {id: @stack.to_param}
162
155
  end
163
156
  assert_redirected_to stack_settings_path(@stack)
164
157
  end
165
158
 
166
159
  test "#update redirects to return_to parameter" do
167
- patch :update, id: @stack.to_param, stack: {ignore_ci: false}, return_to: stack_path(@stack)
160
+ patch :update, params: {id: @stack.to_param, stack: {ignore_ci: false}, return_to: stack_path(@stack)}
168
161
  assert_redirected_to stack_path(@stack)
169
162
  end
170
163
 
171
164
  test "#lookup redirects to the canonical URL" do
172
- get :lookup, id: @stack.id
165
+ get :lookup, params: {id: @stack.id}
173
166
  assert_redirected_to stack_path(@stack)
174
167
  end
168
+
169
+ test "#create does not create stack with invalid deploy_url" do
170
+ post :create, params: {
171
+ stack: {
172
+ repo_name: 'rails',
173
+ repo_owner: 'rails',
174
+ environment: 'staging',
175
+ branch: 'staging',
176
+ deploy_url: 'Javascript:alert(1);',
177
+ },
178
+ }
179
+ assert_response :success
180
+ assert_equal 'Deploy url is invalid', flash[:warning]
181
+ end
175
182
  end
176
183
  end
@@ -11,14 +11,14 @@ module Shipit
11
11
  end
12
12
 
13
13
  test "tasks defined in the shipit.yml can be displayed" do
14
- get :new, stack_id: @stack, definition_id: @definition.id
14
+ get :new, params: {stack_id: @stack, definition_id: @definition.id}
15
15
  assert_response :ok
16
16
  end
17
17
 
18
18
  test "tasks defined in the shipit.yml can't be triggered if the stack is being deployed" do
19
19
  assert @stack.active_task?
20
20
  assert_no_difference -> { @stack.tasks.count } do
21
- post :create, stack_id: @stack, definition_id: @definition.id
21
+ post :create, params: {stack_id: @stack, definition_id: @definition.id}
22
22
  end
23
23
  assert_redirected_to new_stack_tasks_path(@stack, @definition)
24
24
  end
@@ -26,7 +26,7 @@ module Shipit
26
26
  test "tasks defined in the shipit.yml can be triggered anyway if force apram is present" do
27
27
  assert @stack.active_task?
28
28
  assert_difference -> { @stack.tasks.count } do
29
- post :create, stack_id: @stack, definition_id: @definition.id, force: 'true'
29
+ post :create, params: {stack_id: @stack, definition_id: @definition.id, force: 'true'}
30
30
  end
31
31
  assert_redirected_to stack_task_path(@stack, Task.last)
32
32
  end
@@ -34,7 +34,7 @@ module Shipit
34
34
  test "tasks defined in the shipit.yml can be triggered while the stack is being deployed if specified as such" do
35
35
  @definition = @stack.find_task_definition('flush_cache')
36
36
  assert_difference -> { @stack.tasks.count } do
37
- post :create, stack_id: @stack, definition_id: @definition.id
37
+ post :create, params: {stack_id: @stack, definition_id: @definition.id}
38
38
  end
39
39
  assert_redirected_to stack_task_path(@stack, Task.last)
40
40
  end
@@ -42,18 +42,18 @@ module Shipit
42
42
  test "tasks with variables defined in the shipit.yml can be triggered with their variables set" do
43
43
  env = {"FOO" => "0"}
44
44
 
45
- post :create, stack_id: @stack, definition_id: @definition.id, task: {env: env}, force: 'true'
45
+ post :create, params: {stack_id: @stack, definition_id: @definition.id, task: {env: env}, force: 'true'}
46
46
 
47
47
  assert_redirected_to stack_tasks_path(@stack, Task.last)
48
48
  end
49
49
 
50
50
  test "triggered tasks can be observed" do
51
- get :show, stack_id: @stack, id: @task.id
51
+ get :show, params: {stack_id: @stack, id: @task.id}
52
52
  assert_response :ok
53
53
  end
54
54
 
55
55
  test "triggered tasks can be observed as raw text" do
56
- get :show, stack_id: @stack, id: @task.id, format: "txt"
56
+ get :show, params: {stack_id: @stack, id: @task.id}, format: 'txt'
57
57
  assert_response :success
58
58
  assert_equal("text/plain", @response.content_type)
59
59
  end
@@ -61,7 +61,7 @@ module Shipit
61
61
  test ":abort call abort! on the deploy" do
62
62
  @task = shipit_deploys(:shipit_running)
63
63
  @task.ping
64
- post :abort, stack_id: @stack.to_param, id: @task.id
64
+ post :abort, params: {stack_id: @stack.to_param, id: @task.id}
65
65
 
66
66
  @task.reload
67
67
  assert_response :success
@@ -72,7 +72,7 @@ module Shipit
72
72
  test ":abort schedule the rollback if `rollback` is present" do
73
73
  @task = shipit_deploys(:shipit_running)
74
74
  @task.ping
75
- post :abort, stack_id: @stack.to_param, id: @task.id, rollback: 'true'
75
+ post :abort, params: {stack_id: @stack.to_param, id: @task.id, rollback: 'true'}
76
76
 
77
77
  @task.reload
78
78
  assert_response :success
@@ -81,13 +81,13 @@ module Shipit
81
81
  end
82
82
 
83
83
  test ":index list the stack deploys" do
84
- get :index, stack_id: @stack.to_param
84
+ get :index, params: {stack_id: @stack.to_param}
85
85
  assert_response :success
86
86
  assert_select '.task-list .task', @stack.tasks.count
87
87
  end
88
88
 
89
89
  test ":index paginates with the `since` parameter" do
90
- get :index, stack_id: @stack.to_param, since: @stack.tasks.last.id
90
+ get :index, params: {stack_id: @stack.to_param, since: @stack.tasks.last.id}
91
91
  assert_response :success
92
92
  assert_select '.task-list .task', @stack.tasks.count - 1
93
93
  end
@@ -96,7 +96,7 @@ module Shipit
96
96
  @task = shipit_deploys(:shipit_running)
97
97
  last_chunk = @task.chunks.last
98
98
 
99
- get :tail, stack_id: @stack.to_param, id: @task.id, last_id: last_chunk.id, format: :json
99
+ get :tail, params: {stack_id: @stack.to_param, id: @task.id, last_id: last_chunk.id}, format: :json
100
100
  assert_response :success
101
101
  assert_json_keys %w(url status output)
102
102
  assert_json 'status', @task.status
@@ -105,7 +105,7 @@ module Shipit
105
105
  test ":tail doesn't returns the next url if the task is finished" do
106
106
  @task = shipit_deploys(:shipit)
107
107
 
108
- get :tail, stack_id: @stack.to_param, id: @task.id, format: :json
108
+ get :tail, params: {stack_id: @stack.to_param, id: @task.id}, format: :json
109
109
  assert_response :success
110
110
  assert_no_json 'url'
111
111
  end
@@ -113,7 +113,7 @@ module Shipit
113
113
  test ":tail returns the rollback url if the task have been aborted" do
114
114
  @task = shipit_deploys(:shipit_aborted)
115
115
 
116
- get :tail, stack_id: @stack.to_param, id: @task.id, format: :json
116
+ get :tail, params: {stack_id: @stack.to_param, id: @task.id}, format: :json
117
117
  assert_response :success
118
118
  assert_json_keys %w(status output rollback_url)
119
119
  end
@@ -12,16 +12,7 @@ module Shipit
12
12
  params = payload(:push_master)
13
13
 
14
14
  assert_enqueued_with(job: GithubSyncJob, args: [stack_id: @stack.id]) do
15
- post :push, {stack_id: @stack.id}.merge(params)
16
- end
17
- end
18
-
19
- test ":push with the target branch queues a GitMirrorUpdateJob" do
20
- request.headers['X-Github-Event'] = 'push'
21
- params = payload(:push_master)
22
-
23
- assert_enqueued_with(job: GitMirrorUpdateJob, args: [@stack]) do
24
- post :push, {stack_id: @stack.id}.merge(params)
15
+ post :push, params: {stack_id: @stack.id}.merge(params)
25
16
  end
26
17
  end
27
18
 
@@ -29,7 +20,7 @@ module Shipit
29
20
  request.headers['X-Github-Event'] = 'push'
30
21
  params = payload(:push_not_master)
31
22
  assert_no_enqueued_jobs do
32
- post :push, {stack_id: @stack.id}.merge(params)
23
+ post :push, params: {stack_id: @stack.id}.merge(params)
33
24
  end
34
25
  end
35
26
 
@@ -40,7 +31,7 @@ module Shipit
40
31
  commit = shipit_commits(:first)
41
32
 
42
33
  assert_difference 'commit.statuses.count', 1 do
43
- post :state, {stack_id: @stack.id}.merge(status_payload)
34
+ post :state, params: {stack_id: @stack.id}.merge(status_payload)
44
35
  end
45
36
 
46
37
  status = commit.statuses.last
@@ -55,14 +46,14 @@ module Shipit
55
46
  request.headers['X-Github-Event'] = 'status'
56
47
  params = {'sha' => 'notarealcommit', 'state' => 'pending', 'branches' => [{'name' => 'master'}]}
57
48
  assert_raises ActiveRecord::RecordNotFound do
58
- post :state, {stack_id: @stack.id}.merge(params)
49
+ post :state, params: {stack_id: @stack.id}.merge(params)
59
50
  end
60
51
  end
61
52
 
62
53
  test ":state in an untracked branche bails out" do
63
54
  request.headers['X-Github-Event'] = 'status'
64
55
  params = {'sha' => 'notarealcommit', 'state' => 'pending', 'branches' => []}
65
- post :state, {stack_id: @stack.id}.merge(params)
56
+ post :state, params: {stack_id: @stack.id}.merge(params)
66
57
  assert_response :ok
67
58
  end
68
59
 
@@ -70,7 +61,7 @@ module Shipit
70
61
  @request.headers['X-Github-Event'] = 'ping'
71
62
 
72
63
  assert_no_enqueued_jobs do
73
- post :state, stack_id: @stack.id, zen: "Git is beautiful"
64
+ post :state, params: {stack_id: @stack.id, zen: 'Git is beautiful'}
74
65
  assert_response :ok
75
66
  end
76
67
  end
@@ -79,7 +70,7 @@ module Shipit
79
70
  @request.headers['X-Github-Event'] = 'ping'
80
71
 
81
72
  assert_no_enqueued_jobs do
82
- post :state, stack_id: @stack.id
73
+ post :state, params: {stack_id: @stack.id}
83
74
  assert_response :ok
84
75
  end
85
76
  end
@@ -95,7 +86,7 @@ module Shipit
95
86
 
96
87
  GithubHook.any_instance.expects(:verify_signature).with(signature, URI.encode_www_form(params)).returns(false)
97
88
 
98
- post :push, {stack_id: @stack.id}.merge(params)
89
+ post :push, params: {stack_id: @stack.id}.merge(params)
99
90
  assert_response :unprocessable_entity
100
91
  end
101
92
 
@@ -108,13 +99,13 @@ module Shipit
108
99
 
109
100
  GithubHook.any_instance.expects(:verify_signature).with(signature, URI.encode_www_form(params)).returns(false)
110
101
 
111
- post :push, {stack_id: @stack.id}.merge(params)
102
+ post :push, params: {stack_id: @stack.id}.merge(params)
112
103
  assert_response :unprocessable_entity
113
104
  end
114
105
 
115
106
  test ":membership creates the mentioned team on the fly" do
116
107
  assert_difference -> { Team.count }, 1 do
117
- post :membership, membership_params.merge(team: {
108
+ post :membership, params: membership_params.merge(team: {
118
109
  id: 48,
119
110
  name: 'Ouiche Cooks',
120
111
  slug: 'ouiche-cooks',
@@ -127,42 +118,42 @@ module Shipit
127
118
  test ":membership creates the mentioned user on the fly" do
128
119
  Shipit.github_api.expects(:user).with('george').returns(george)
129
120
  assert_difference -> { User.count }, 1 do
130
- post :membership, membership_params.merge(member: {login: 'george'})
121
+ post :membership, params: membership_params.merge(member: {login: 'george'})
131
122
  assert_response :ok
132
123
  end
133
124
  end
134
125
 
135
126
  test ":membership can delete an user membership" do
136
127
  assert_difference -> { Membership.count }, -1 do
137
- post :membership, membership_params.merge(_action: 'removed')
128
+ post :membership, params: membership_params.merge(_action: 'removed')
138
129
  assert_response :ok
139
130
  end
140
131
  end
141
132
 
142
133
  test ":membership can append an user membership" do
143
134
  assert_difference -> { Membership.count }, 1 do
144
- post :membership, membership_params.merge(member: {login: 'bob'})
135
+ post :membership, params: membership_params.merge(member: {login: 'bob'})
145
136
  assert_response :ok
146
137
  end
147
138
  end
148
139
 
149
140
  test ":membership can append an user twice" do
150
141
  assert_no_difference -> { Membership.count } do
151
- post :membership, membership_params
142
+ post :membership, params: membership_params
152
143
  assert_response :ok
153
144
  end
154
145
  end
155
146
 
156
147
  test ":membership can delete an user twice" do
157
148
  assert_no_difference -> { Membership.count } do
158
- post :membership, membership_params.merge(_action: 'removed', member: {login: 'bob'})
149
+ post :membership, params: membership_params.merge(_action: 'removed', member: {login: 'bob'})
159
150
  assert_response :ok
160
151
  end
161
152
  end
162
153
 
163
154
  test ":membership can append a user membership for an organization with capitals" do
164
155
  assert_difference -> { Membership.count }, 1 do
165
- post :membership, membership_params.merge(organization: {login: 'Shopify'}, member: {login: 'bob'})
156
+ post :membership, params: membership_params.merge(organization: {login: 'Shopify'}, member: {login: 'bob'})
166
157
  assert_response :ok
167
158
  end
168
159
  end
@@ -23,9 +23,6 @@ module Shipit
23
23
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
24
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
25
  # config.i18n.default_locale = :de
26
-
27
- # Do not swallow errors in after_commit/after_rollback callbacks.
28
- config.active_record.raise_in_transactional_callbacks = true
29
26
  end
30
27
  end
31
28
 
@@ -13,8 +13,8 @@ Rails.application.configure do
13
13
  config.eager_load = true
14
14
 
15
15
  # Configure static file server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
18
18
 
19
19
  # Show full error reports and disable caching.
20
20
  config.consider_all_requests_local = true