Project

General

Profile

Revision fb471374

Added by Michael Moll about 4 years ago

Update to Rails 5.1

  • Fixes #21814 - Add Rails 5 migrations
  • Refs #22045 - update TargetRailsVersion for rubocop
  • Refs #22045 - use ApplicationRecord
  • Refs #22045 - stop using HttpPositionalArguments
  • Fixes #22046 - use rubocop 0.52

View differences:

test/functionals/containers_controller_test.rb
7 7
  end
8 8

  
9 9
  test 'redirect if Docker provider is not available' do
10
    get :index, {}, set_session_user
10
    get :index, session: set_session_user
11 11
    assert_redirected_to new_compute_resource_path
12 12
  end
13 13

  
......
16 16
    # Avoid rendering errors by not retrieving any container
17 17
    ComputeResource.any_instance.stubs(:vms).returns([])
18 18
    FactoryBot.create(:docker_cr)
19
    get :index, {}, set_session_user
19
    get :index, session: set_session_user
20 20
    assert_template 'index'
21 21
  end
22 22

  
......
31 31

  
32 32
    test 'deleting an unmanaged container redirects to containers index' do
33 33
      ComputeResource.any_instance.expects(:destroy_vm).with(@container.id)
34
      delete :destroy, { :compute_resource_id => @container_resource,
35
                         :id                  => @container.id }, set_session_user
34
      delete :destroy, params: { :compute_resource_id => @container_resource, :id => @container.id }, session: set_session_user
36 35
      assert_redirected_to containers_path
37 36
      assert_equal "Container #{@container.id} is being deleted.",
38 37
        flash[:notice]
......
42 41
      ComputeResource.any_instance.stubs(:destroy_vm).
43 42
        raises(::Foreman::Exception.new('Could not destroy Docker container'))
44 43
      @request.env['HTTP_REFERER'] = "http://test.host/#{containers_path}"
45
      delete :destroy, { :compute_resource_id => @container_resource,
46
                         :id                  => @container.id }, set_session_user
44
      delete :destroy, params: { :compute_resource_id => @container_resource, :id => @container.id }, session: set_session_user
47 45
      assert @container.present?
48 46
      assert_redirected_to :back
49 47
      assert_equal 'Your container could not be deleted in Docker',
......
58 56
        with('randomuuid')
59 57
      Container.any_instance.expects(:uuid).returns('randomuuid').at_least_once
60 58
      Container.any_instance.expects(:destroy)
61
      delete :destroy, { :id => managed_container.id }, set_session_user
59
      delete :destroy, params: { :id => managed_container.id }, session: set_session_user
62 60
      assert_redirected_to containers_path
63 61
      assert_equal "Container #{managed_container.uuid} is being deleted.",
64 62
        flash[:notice]
......
72 70
      ComputeResource.any_instance.expects(:destroy_vm).
73 71
        with(@container.id).returns(true)
74 72
      Container.any_instance.expects(:destroy)
75
      delete :destroy, { :compute_resource_id => @container_resource.id,
76
                         :id                  => @container.id }, set_session_user
73
      delete :destroy, params: { :compute_resource_id => @container_resource.id, :id => @container.id }, session: set_session_user
77 74
      assert_redirected_to containers_path
78 75
      assert_equal "Container #{managed_container.uuid} is being deleted.",
79 76
        flash[:notice]
......
85 82
      managed_container = FactoryBot.create(
86 83
        :container,
87 84
        :compute_resource => @container_resource)
88
      delete :destroy, { :id => managed_container.id }, set_session_user
85
      delete :destroy, params: { :id => managed_container.id }, session: set_session_user
89 86
      assert managed_container.present? # Foreman container would not be deleted
90 87
      assert_redirected_to containers_path
91 88
      assert_equal 'Your container could not be deleted in Docker',
......
103 100
      .returns(mock_container)
104 101
    mock_container.expects(:commit).with(commit_hash)
105 102

  
106
    post :commit, { :commit => commit_hash,
107
                    :id     => container.id }, set_session_user
103
    post :commit, params: { :commit => commit_hash, :id => container.id }, session: set_session_user
108 104
  end
109 105
end

Also available in: Unified diff