Skip to content

Commit

Permalink
[ci] rails 5: Update syntax for ajax requests for ActionController::T…
Browse files Browse the repository at this point in the history
…estCase and ActionDispatch::Integration

Old syntax:
  xhr :get, :create, params: { id: 1 }

New syntax example:
  get :create, params: { id: 1 }, xhr: true

https://github.com/rails/rails/blob/v5.0.0/actionpack/CHANGELOG.md
  • Loading branch information
bgeuken committed Aug 24, 2016
1 parent 02271b2 commit 1724de0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/api/spec/controllers/webui/monitor_controller_spec.rb
Expand Up @@ -19,7 +19,7 @@

describe "GET #update_building" do
before do
xhr :get, :update_building
get :update_building, xhr: true
@json_response = JSON.parse(response.body)
end

Expand All @@ -35,7 +35,7 @@
create_list(:status_history, 10, source: 'waiting', range: 10000..42000)
# i586
create_list(:status_history, 5, source: 'squeue_high', architecture: 'i586')
xhr :get, :events, {arch: 'x86_64', range: 8760}
get :events, params: { arch: 'x86_64', range: 8760 }, xhr: true
@json_response = JSON.parse(response.body)
end

Expand Down
6 changes: 3 additions & 3 deletions src/api/spec/controllers/webui/project_controller_spec.rb
Expand Up @@ -329,7 +329,7 @@
login user
apache2_project
another_project.projects_linking_to << apache_project
xhr :get, :linking_projects, project: apache_project
get :linking_projects, params: { project: apache_project }, xhr: true
end

it { expect(Project.count).to eq(4) }
Expand Down Expand Up @@ -357,7 +357,7 @@
summary = Xmlhash::XMLHash.new({'statuscount' => {'code' => 'succeeded', 'count' => 1} })
build_result = { 'result' => Xmlhash::XMLHash.new({'repository' => 'openSUSE', 'arch' => 'x86_64', 'summary' => summary }) }
Buildresult.stubs(:find_hashed).returns(Xmlhash::XMLHash.new(build_result))
xhr :get, :buildresult, project: project_with_package
get :buildresult, params: { project: project_with_package }, xhr: true
expect(assigns(:buildresult)).to match_array([["openSUSE", [["x86_64", [[:succeeded, 1]]]]]])
end
end
Expand All @@ -366,7 +366,7 @@
it 'assigns only linking_projects' do
apache2_project
another_project.projects_linking_to << apache_project
xhr :get, :delete_dialog, project: apache_project
get :delete_dialog, params: { project: apache_project }, xhr: true
expect(assigns(:linking_projects)).to match_array([another_project.name])
end
end
Expand Down

0 comments on commit 1724de0

Please sign in to comment.