Sha256: a6cf0f1fa0b168473b2c19833de9a477cb34b7215bdf3a0819ad3d2604dc6862
Contents?: true
Size: 1.51 KB
Versions: 6
Compression:
Stored size: 1.51 KB
Contents
require 'test_helper' class RollbacksControllerTest < ActionController::TestCase setup do Deploy.where(status: %w(running pending)).update_all(status: 'success') @stack = stacks(:shipit) @deploy = deploys(:shipit) session[:user_id] = users(:walrus).id end test ":create persists a new rollback" do assert_difference '@stack.rollbacks.count', +1 do post :create, stack_id: @stack.to_param, rollback: {parent_id: @deploy.id} end end test ":create redirects to the new deploy" do post :create, stack_id: @stack.to_param, rollback: {parent_id: @deploy.id} assert_redirected_to stack_deploy_path(@stack, Rollback.last) end test ":create locks deploys" do post :create, stack_id: @stack.to_param, rollback: {parent_id: @deploy.id} assert @stack.reload.locked? end test ":create redirects back to the :new page if there is an active deploy" do deploys(:shipit_running).update_column(:status, 'running') assert_no_difference '@stack.deploys.count' do post :create, stack_id: @stack.to_param, rollback: {parent_id: @deploy.id} end assert_redirected_to rollback_stack_deploy_path(@stack, @deploy) end test ":create with `force` option ignore the active deploys" do deploys(:shipit_running).update_column(:status, 'running') assert_difference '@stack.deploys.count', +1 do post :create, stack_id: @stack.to_param, rollback: {parent_id: @deploy.id}, force: true end assert_redirected_to stack_deploy_path(@stack, Rollback.last) end end
Version data entries
6 entries across 6 versions & 1 rubygems