Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase compatibility with rails6 #8770

Merged
merged 2 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/app/mixins/can_render_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# and use my_model to access the model instead of self
module CanRenderModel
def render_xml(locals = {})
action_view = ActionView::Base.new(Rails.configuration.paths['app/views'])
action_view = ActionView::Base.new(Rails.configuration.paths['app/views'].to_ary)
locals[:my_model] = self
action_view.render partial: "models/#{self.class.name.underscore}", formats: [:xml],
locals: locals
Expand Down
8 changes: 4 additions & 4 deletions src/api/spec/controllers/cloud/upload_jobs_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
expect(Xmlhash.parse(response.body)).to eq(Xmlhash.parse(xml_response_list))
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end
end

Expand Down Expand Up @@ -96,7 +96,7 @@
expect(Xmlhash.parse(response.body)).to eq(Xmlhash.parse(xml_response_list))
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end
end

Expand Down Expand Up @@ -146,7 +146,7 @@

it { expect(Cloud::User::UploadJob.last.job_id).to eq(6) }
it { expect(Cloud::User::UploadJob.last.user).to eq(user_with_ec2_configuration) }
it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
it { expect(Xmlhash.parse(response.body)).to eq(Xmlhash.parse(xml_response_list)) }
end
end
Expand All @@ -161,7 +161,7 @@
delete :destroy, params: { id: upload_job.job_id }, format: 'xml'
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end

context 'of a not existing upload job' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
post :create, body: body, params: { id: service_token.id, project: project.name, package: package.name, format: :xml }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end

context 'when token is invalid' do
Expand Down
8 changes: 4 additions & 4 deletions src/api/spec/controllers/source_attribute_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
body: xml_attrib
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end

context 'update invalid attribute' do
Expand All @@ -91,7 +91,7 @@
body: wrong_xml_attrib
end

it { expect(response).not_to be_success }
it { expect(response).not_to have_http_status(:success) }

it 'gives the right status code' do
resp = Xmlhash.parse(response.body)
Expand All @@ -110,7 +110,7 @@
format: :xml }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
it { expect(project.reload.attribs).to be_empty }
end

Expand All @@ -124,7 +124,7 @@
format: :xml }
end

it { expect(response).not_to be_success }
it { expect(response).not_to have_http_status(:success) }
it { expect(project.attribs).not_to be_empty }

it 'gives the right status code' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
get :show, params: { project: project }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end

context 'when the project doesnt exist' do
Expand Down Expand Up @@ -44,7 +44,7 @@
put :update, params: { project: project, comment: 'Updated by test' }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
it { expect(project.config.content).to include('Updated', 'by', 'test') }
end

Expand All @@ -56,7 +56,7 @@
put :update, params: { project: project, comment: 'add preinstall' }, body: config
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
it { expect(project.config.content).to include('Preinstall') }
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
get :show, params: { project: project }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
it { expect(Xmlhash.parse(response.body)['name']).to eq(project.name) }
end

Expand All @@ -33,7 +33,7 @@
put :update, params: { project: project }, body: meta, format: :xml
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
it { expect(project.meta.content).to eq(meta) }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package: 'foo', format: :xml }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end

context 'package do not exist' do
Expand All @@ -29,7 +29,7 @@
package: 'bar', format: :xml }
end

it { expect(response).not_to be_success }
it { expect(response).not_to have_http_status(:success) }
end
end

Expand All @@ -54,7 +54,7 @@
body: meta, format: :xml
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end

context 'bad XML' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
get :new, params: { project: 'AzureImages', package: 'MyAzureImage', repository: 'standard', arch: 'x86_64', filename: 'appliance.raw.xz' }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }

it {
expect(assigns(:upload_job)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
get :new, params: { project: 'EC2Images', package: 'MyEC2Image', repository: 'standard', arch: 'x86_64', filename: 'appliance.raw.xz' }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }

it {
expect(assigns(:upload_job)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
get :show, params: { upload_id: upload_job.job_id }
end

it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
it { expect(response.body).to eq(log) }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

it { expect(assigns(:upload_jobs).length).to eq(1) }
it { expect(assigns(:upload_jobs).first.id).to eq('6') }
it { expect(response).to be_success }
it { expect(response).to have_http_status(:success) }
end
end

Expand Down
10 changes: 5 additions & 5 deletions src/api/spec/controllers/webui/groups/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
it 'adds the user to the group' do
expect(response).to redirect_to(group_show_path(title: group.title))
expect(flash[:success]).to eq("Added user '#{user}' to group '#{group}'")
expect(group.users.where(groups_users: { user: user })).to exist
expect(group.users.where(groups_users: { user_id: user })).to exist
end
end

Expand All @@ -28,7 +28,7 @@
end

it { expect(flash[:error]).to eq("User 'unknown_user' not found") }
it { expect(group.users.where(groups_users: { user: user })).not_to exist }
it { expect(group.users.where(groups_users: { user_id: user })).not_to exist }
end

context 'when the group does not exist' do
Expand Down Expand Up @@ -78,7 +78,7 @@
it 'removes the user from the group' do
expect(response).to have_http_status(:success)
expect(flash[:success]).to eq("Removed user from group '#{group}'")
expect(group.users.where(groups_users: { user: user })).not_to exist
expect(group.users.where(groups_users: { user_id: user })).not_to exist
end
end

Expand All @@ -89,7 +89,7 @@

it { expect(response).to have_http_status(:not_found) }
it { expect(flash[:error]).to eq("User 'unknown_user' not found in group '#{group}'") }
it { expect(group.users.where(groups_users: { user: user })).not_to exist }
it { expect(group.users.where(groups_users: { user_id: user })).not_to exist }
end

context 'when the group does not exist' do
Expand Down Expand Up @@ -154,7 +154,7 @@

it { expect(response).to have_http_status(:not_found) }
it { expect(flash[:error]).to eq("User 'unknown_user' not found in group '#{group}'") }
it { expect(group.users.where(groups_users: { user: user })).not_to exist }
it { expect(group.users.where(groups_users: { user_id: user })).not_to exist }
end

context 'when the group does not exist' do
Expand Down