Commit 6a641193 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Change `be_success` to `be_successful` in specs

Fixes deprecation warning:

```
DEPRECATION WARNING: The success? predicate is deprecated and
will be removed in Rails 6.0.
Please use successful? as provided by Rack::Response::Helpers.
```
parent 224db2f8
...@@ -172,7 +172,7 @@ describe Groups::GroupMembersController do ...@@ -172,7 +172,7 @@ describe Groups::GroupMembersController do
it '[JS] removes user from members' do it '[JS] removes user from members' do
delete :destroy, params: { group_id: group, id: member }, xhr: true delete :destroy, params: { group_id: group, id: member }, xhr: true
expect(response).to be_success expect(response).to be_successful
expect(group.members).not_to include member expect(group.members).not_to include member
end end
end end
......
...@@ -186,7 +186,7 @@ describe Groups::MilestonesController do ...@@ -186,7 +186,7 @@ describe Groups::MilestonesController do
it "removes milestone" do it "removes milestone" do
delete :destroy, params: { group_id: group.to_param, id: milestone.iid }, format: :js delete :destroy, params: { group_id: group.to_param, id: milestone.iid }, format: :js
expect(response).to be_success expect(response).to be_successful
expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound) expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound)
end end
end end
......
...@@ -33,14 +33,14 @@ describe HealthCheckController do ...@@ -33,14 +33,14 @@ describe HealthCheckController do
get :index get :index
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq 'text/plain' expect(response.content_type).to eq 'text/plain'
end end
it 'supports passing the token in query params' do it 'supports passing the token in query params' do
get :index, params: { token: token } get :index, params: { token: token }
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq 'text/plain' expect(response.content_type).to eq 'text/plain'
end end
end end
...@@ -54,14 +54,14 @@ describe HealthCheckController do ...@@ -54,14 +54,14 @@ describe HealthCheckController do
it 'supports successful plaintext response' do it 'supports successful plaintext response' do
get :index get :index
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq 'text/plain' expect(response.content_type).to eq 'text/plain'
end end
it 'supports successful json response' do it 'supports successful json response' do
get :index, format: :json get :index, format: :json
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be true expect(json_response['healthy']).to be true
end end
...@@ -69,7 +69,7 @@ describe HealthCheckController do ...@@ -69,7 +69,7 @@ describe HealthCheckController do
it 'supports successful xml response' do it 'supports successful xml response' do
get :index, format: :xml get :index, format: :xml
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq 'application/xml' expect(response.content_type).to eq 'application/xml'
expect(xml_response['healthy']).to be true expect(xml_response['healthy']).to be true
end end
...@@ -77,7 +77,7 @@ describe HealthCheckController do ...@@ -77,7 +77,7 @@ describe HealthCheckController do
it 'supports successful responses for specific checks' do it 'supports successful responses for specific checks' do
get :index, params: { checks: 'email' }, format: :json get :index, params: { checks: 'email' }, format: :json
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
expect(json_response['healthy']).to be true expect(json_response['healthy']).to be true
end end
......
...@@ -114,7 +114,7 @@ describe HelpController do ...@@ -114,7 +114,7 @@ describe HelpController do
path: 'user/project/img/labels_default_v12_1' path: 'user/project/img/labels_default_v12_1'
}, },
format: :png format: :png
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq 'image/png' expect(response.content_type).to eq 'image/png'
expect(response.headers['Content-Disposition']).to match(/^inline;/) expect(response.headers['Content-Disposition']).to match(/^inline;/)
end end
......
...@@ -10,7 +10,7 @@ describe Profiles::KeysController do ...@@ -10,7 +10,7 @@ describe Profiles::KeysController do
it "does not generally work" do it "does not generally work" do
get :get_keys, params: { username: 'not-existent' } get :get_keys, params: { username: 'not-existent' }
expect(response).not_to be_success expect(response).not_to be_successful
end end
end end
...@@ -18,7 +18,7 @@ describe Profiles::KeysController do ...@@ -18,7 +18,7 @@ describe Profiles::KeysController do
it "does generally work" do it "does generally work" do
get :get_keys, params: { username: user.username } get :get_keys, params: { username: user.username }
expect(response).to be_success expect(response).to be_successful
end end
it "renders all keys separated with a new line" do it "renders all keys separated with a new line" do
...@@ -41,7 +41,7 @@ describe Profiles::KeysController do ...@@ -41,7 +41,7 @@ describe Profiles::KeysController do
it "does generally work" do it "does generally work" do
get :get_keys, params: { username: user.username } get :get_keys, params: { username: user.username }
expect(response).to be_success expect(response).to be_successful
end end
it "renders all non deploy keys separated with a new line" do it "renders all non deploy keys separated with a new line" do
......
...@@ -20,9 +20,7 @@ describe Projects::Ci::LintsController do ...@@ -20,9 +20,7 @@ describe Projects::Ci::LintsController do
get :show, params: { namespace_id: project.namespace, project_id: project } get :show, params: { namespace_id: project.namespace, project_id: project }
end end
it 'is success' do it { expect(response).to be_successful }
expect(response).to be_success
end
it 'renders show page' do it 'renders show page' do
expect(response).to render_template :show expect(response).to render_template :show
...@@ -78,9 +76,7 @@ describe Projects::Ci::LintsController do ...@@ -78,9 +76,7 @@ describe Projects::Ci::LintsController do
post :create, params: { namespace_id: project.namespace, project_id: project, content: content } post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end end
it 'is success' do it { expect(response).to be_successful }
expect(response).to be_success
end
it 'render show page' do it 'render show page' do
expect(response).to render_template :show expect(response).to render_template :show
......
...@@ -45,14 +45,14 @@ describe Projects::CommitController do ...@@ -45,14 +45,14 @@ describe Projects::CommitController do
it 'handles binary files' do it 'handles binary files' do
go(id: TestEnv::BRANCH_SHA['binary-encoding'], format: 'html') go(id: TestEnv::BRANCH_SHA['binary-encoding'], format: 'html')
expect(response).to be_success expect(response).to be_successful
end end
shared_examples "export as" do |format| shared_examples "export as" do |format|
it "does generally work" do it "does generally work" do
go(id: commit.id, format: format) go(id: commit.id, format: format)
expect(response).to be_success expect(response).to be_successful
end end
it "generates it" do it "generates it" do
...@@ -110,7 +110,7 @@ describe Projects::CommitController do ...@@ -110,7 +110,7 @@ describe Projects::CommitController do
id: commit.id id: commit.id
}) })
expect(response).to be_success expect(response).to be_successful
end end
end end
...@@ -177,7 +177,7 @@ describe Projects::CommitController do ...@@ -177,7 +177,7 @@ describe Projects::CommitController do
id: commit.id id: commit.id
}) })
expect(response).not_to be_success expect(response).not_to be_successful
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
end end
...@@ -234,7 +234,7 @@ describe Projects::CommitController do ...@@ -234,7 +234,7 @@ describe Projects::CommitController do
id: master_pickable_commit.id id: master_pickable_commit.id
}) })
expect(response).not_to be_success expect(response).not_to be_successful
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
end end
......
...@@ -79,7 +79,7 @@ describe Projects::CommitsController do ...@@ -79,7 +79,7 @@ describe Projects::CommitsController do
end end
it "renders as atom" do it "renders as atom" do
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq('application/atom+xml') expect(response.content_type).to eq('application/atom+xml')
end end
...@@ -104,7 +104,7 @@ describe Projects::CommitsController do ...@@ -104,7 +104,7 @@ describe Projects::CommitsController do
end end
it "renders as HTML" do it "renders as HTML" do
expect(response).to be_success expect(response).to be_successful
expect(response.content_type).to eq('text/html') expect(response.content_type).to eq('text/html')
end end
end end
......
...@@ -19,7 +19,7 @@ describe Projects::CompareController do ...@@ -19,7 +19,7 @@ describe Projects::CompareController do
end end
it 'returns successfully' do it 'returns successfully' do
expect(response).to be_success expect(response).to be_successful
end end
end end
...@@ -49,7 +49,7 @@ describe Projects::CompareController do ...@@ -49,7 +49,7 @@ describe Projects::CompareController do
it 'shows some diffs with ignore whitespace change option' do it 'shows some diffs with ignore whitespace change option' do
show_request show_request
expect(response).to be_success expect(response).to be_successful
diff_file = assigns(:diffs).diff_files.first diff_file = assigns(:diffs).diff_files.first
expect(diff_file).not_to be_nil expect(diff_file).not_to be_nil
expect(assigns(:commits).length).to be >= 1 expect(assigns(:commits).length).to be >= 1
...@@ -67,7 +67,7 @@ describe Projects::CompareController do ...@@ -67,7 +67,7 @@ describe Projects::CompareController do
it 'sets the diffs and commits ivars' do it 'sets the diffs and commits ivars' do
show_request show_request
expect(response).to be_success expect(response).to be_successful
expect(assigns(:diffs).diff_files.first).not_to be_nil expect(assigns(:diffs).diff_files.first).not_to be_nil
expect(assigns(:commits).length).to be >= 1 expect(assigns(:commits).length).to be >= 1
end end
...@@ -81,7 +81,7 @@ describe Projects::CompareController do ...@@ -81,7 +81,7 @@ describe Projects::CompareController do
it 'sets empty diff and commit ivars' do it 'sets empty diff and commit ivars' do
show_request show_request
expect(response).to be_success expect(response).to be_successful
expect(assigns(:diffs)).to eq([]) expect(assigns(:diffs)).to eq([])
expect(assigns(:commits)).to eq([]) expect(assigns(:commits)).to eq([])
end end
...@@ -94,7 +94,7 @@ describe Projects::CompareController do ...@@ -94,7 +94,7 @@ describe Projects::CompareController do
it 'sets empty diff and commit ivars' do it 'sets empty diff and commit ivars' do
show_request show_request
expect(response).to be_success expect(response).to be_successful
expect(assigns(:diffs)).to eq([]) expect(assigns(:diffs)).to eq([])
expect(assigns(:commits)).to eq([]) expect(assigns(:commits)).to eq([])
end end
......
...@@ -16,7 +16,7 @@ describe Projects::CycleAnalytics::EventsController do ...@@ -16,7 +16,7 @@ describe Projects::CycleAnalytics::EventsController do
it 'is empty' do it 'is empty' do
get_issue get_issue
expect(response).to be_success expect(response).to be_successful
expect(JSON.parse(response.body)['events']).to be_empty expect(JSON.parse(response.body)['events']).to be_empty
end end
end end
...@@ -32,7 +32,7 @@ describe Projects::CycleAnalytics::EventsController do ...@@ -32,7 +32,7 @@ describe Projects::CycleAnalytics::EventsController do
it 'is not empty' do it 'is not empty' do
get_issue get_issue
expect(response).to be_success expect(response).to be_successful
end end
it 'contains event detais' do it 'contains event detais' do
...@@ -49,7 +49,7 @@ describe Projects::CycleAnalytics::EventsController do ...@@ -49,7 +49,7 @@ describe Projects::CycleAnalytics::EventsController do
it 'is empty' do it 'is empty' do
get_issue(additional_params: { cycle_analytics: { start_date: 7 } }) get_issue(additional_params: { cycle_analytics: { start_date: 7 } })
expect(response).to be_success expect(response).to be_successful
expect(JSON.parse(response.body)['events']).to be_empty expect(JSON.parse(response.body)['events']).to be_empty
end end
......
...@@ -21,7 +21,7 @@ describe Projects::CycleAnalyticsController do ...@@ -21,7 +21,7 @@ describe Projects::CycleAnalyticsController do
project_id: project project_id: project
}) })
expect(response).to be_success expect(response).to be_successful
end end
end end
...@@ -34,7 +34,7 @@ describe Projects::CycleAnalyticsController do ...@@ -34,7 +34,7 @@ describe Projects::CycleAnalyticsController do
project_id: project project_id: project
}) })
expect(response).to be_success expect(response).to be_successful
expect(assigns(:cycle_analytics_no_data)).to eq(true) expect(assigns(:cycle_analytics_no_data)).to eq(true)
end end
end end
...@@ -55,7 +55,7 @@ describe Projects::CycleAnalyticsController do ...@@ -55,7 +55,7 @@ describe Projects::CycleAnalyticsController do
project_id: project project_id: project
}) })
expect(response).to be_success expect(response).to be_successful
expect(assigns(:cycle_analytics_no_data)).to eq(false) expect(assigns(:cycle_analytics_no_data)).to eq(false)
end end
end end
......
...@@ -28,7 +28,7 @@ describe Projects::MergeRequests::CreationsController do ...@@ -28,7 +28,7 @@ describe Projects::MergeRequests::CreationsController do
it 'renders new merge request widget template' do it 'renders new merge request widget template' do
get :new, params: get_diff_params get :new, params: get_diff_params
expect(response).to be_success expect(response).to be_successful
end end
end end
...@@ -56,7 +56,7 @@ describe Projects::MergeRequests::CreationsController do ...@@ -56,7 +56,7 @@ describe Projects::MergeRequests::CreationsController do
it 'limits total commits' do it 'limits total commits' do
get :new, params: large_diff_params get :new, params: large_diff_params
expect(response).to be_success expect(response).to be_successful
total = assigns(:total_commit_count) total = assigns(:total_commit_count)
expect(assigns(:commits)).to be_an Array expect(assigns(:commits)).to be_an Array
...@@ -70,7 +70,7 @@ describe Projects::MergeRequests::CreationsController do ...@@ -70,7 +70,7 @@ describe Projects::MergeRequests::CreationsController do
it 'shows total commits' do it 'shows total commits' do
get :new, params: large_diff_params get :new, params: large_diff_params
expect(response).to be_success expect(response).to be_successful
total = assigns(:total_commit_count) total = assigns(:total_commit_count)
expect(assigns(:commits)).to be_an CommitCollection expect(assigns(:commits)).to be_an CommitCollection
...@@ -89,7 +89,7 @@ describe Projects::MergeRequests::CreationsController do ...@@ -89,7 +89,7 @@ describe Projects::MergeRequests::CreationsController do
get :diffs, params: get_diff_params.merge(format: 'json') get :diffs, params: get_diff_params.merge(format: 'json')
expect(response).to be_success expect(response).to be_successful
expect(assigns[:diffs]).to be_nil expect(assigns[:diffs]).to be_nil
end end
end end
......
...@@ -66,7 +66,7 @@ describe Projects::MergeRequests::DiffsController do ...@@ -66,7 +66,7 @@ describe Projects::MergeRequests::DiffsController do
end end
it 'renders' do it 'renders' do
expect(response).to be_success expect(response).to be_successful
expect(response.body).to have_content('Subproject commit') expect(response.body).to have_content('Subproject commit')
end end
end end
......
...@@ -57,7 +57,7 @@ describe Projects::MergeRequestsController do ...@@ -57,7 +57,7 @@ describe Projects::MergeRequestsController do
go(format: :html) go(format: :html)
expect(response).to be_success expect(response).to be_successful
end end
end end
...@@ -66,7 +66,7 @@ describe Projects::MergeRequestsController do ...@@ -66,7 +66,7 @@ describe Projects::MergeRequestsController do
go(format: :html) go(format: :html)
expect(response).to be_success expect(response).to be_successful
end end
context "that is invalid" do context "that is invalid" do
...@@ -75,7 +75,7 @@ describe Projects::MergeRequestsController do ...@@ -75,7 +75,7 @@ describe Projects::MergeRequestsController do
it "renders merge request page" do it "renders merge request page" do
go(format: :html) go(format: :html)
expect(response).to be_success expect(response).to be_successful
end end
end end
end end
...@@ -124,7 +124,7 @@ describe Projects::MergeRequestsController do ...@@ -124,7 +124,7 @@ describe Projects::MergeRequestsController do
it "renders merge request page" do it "renders merge request page" do
go(format: :json) go(format: :json)
expect(response).to be_success expect(response).to be_successful
end end
end end
end end
......
...@@ -139,7 +139,7 @@ describe Projects::MilestonesController do ...@@ -139,7 +139,7 @@ describe Projects::MilestonesController do
expect(issue.milestone_id).to eq(milestone.id) expect(issue.milestone_id).to eq(milestone.id)
delete :destroy, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }, format: :js delete :destroy, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }, format: :js
expect(response).to be_success expect(response).to be_successful
expect(Event.recent.first.action).to eq(Event::DESTROYED) expect(Event.recent.first.action).to eq(Event::DESTROYED)
......
...@@ -158,7 +158,7 @@ describe Projects::ProjectMembersController do ...@@ -158,7 +158,7 @@ describe Projects::ProjectMembersController do
id: member id: member
}, xhr: true }, xhr: true
expect(response).to be_success expect(response).to be_successful
expect(project.members).not_to include member expect(project.members).not_to include member
end end
end end
......
...@@ -49,7 +49,7 @@ describe Projects::RefsController do ...@@ -49,7 +49,7 @@ describe Projects::RefsController do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
xhr_get(:js) xhr_get(:js)
expect(response).to be_success expect(response).to be_successful
end end
it 'renders JSON' do it 'renders JSON' do
...@@ -57,7 +57,7 @@ describe Projects::RefsController do ...@@ -57,7 +57,7 @@ describe Projects::RefsController do
xhr_get(:json) xhr_get(:json)
expect(response).to be_success expect(response).to be_successful
expect(json_response).to be_kind_of(Array) expect(json_response).to be_kind_of(Array)
end end
end end
......
...@@ -159,7 +159,7 @@ describe Projects::ServicesController do ...@@ -159,7 +159,7 @@ describe Projects::ServicesController do
context 'with approved services' do context 'with approved services' do
it 'renders edit page' do it 'renders edit page' do
expect(response).to be_success expect(response).to be_successful
end end
end end
end end
......
...@@ -19,7 +19,7 @@ describe UsersController do ...@@ -19,7 +19,7 @@ describe UsersController do
it 'renders the show template' do it 'renders the show template' do
get :show, params: { username: user.username } get :show, params: { username: user.username }
expect(response).to be_success expect(response).to be_successful
expect(response).to render_template('show') expect(response).to render_template('show')
end end
end end
...@@ -362,7 +362,7 @@ describe UsersController do ...@@ -362,7 +362,7 @@ describe UsersController do
it 'responds with success' do it 'responds with success' do
get :show, params: { username: user.username } get :show, params: { username: user.username }
expect(response).to be_success expect(response).to be_successful
end end
end end
...@@ -418,7 +418,7 @@ describe UsersController do ...@@ -418,7 +418,7 @@ describe UsersController do
it 'responds with success' do it 'responds with success' do
get :projects, params: { username: user.username } get :projects, params: { username: user.username }
expect(response).to be_success expect(response).to be_successful
end end
end end
......
...@@ -8,7 +8,7 @@ shared_examples 'disabled when using an external authorization service' do ...@@ -8,7 +8,7 @@ shared_examples 'disabled when using an external authorization service' do
it 'works when the feature is not enabled' do it 'works when the feature is not enabled' do
subject subject
expect(response).to be_success expect(response).to be_successful
end end
it 'renders a 404 with a message when the feature is enabled' do it 'renders a 404 with a message when the feature is enabled' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment