Skip to content

Commit

Permalink
Merge pull request #12268 from openSUSE/depfu/update/srcapi/rubocop-r…
Browse files Browse the repository at this point in the history
…spec-2.9.0

[src/api] Update rubocop-rspec: 2.8.0 → 2.9.0 (minor)
  • Loading branch information
dmarcoux committed Mar 3, 2022
2 parents b77a620 + 3f690d9 commit c0d3482
Show file tree
Hide file tree
Showing 23 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/api/Gemfile.lock
Expand Up @@ -410,7 +410,7 @@ GEM
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (2.8.0)
rubocop-rspec (2.9.0)
rubocop (~> 1.19)
ruby-ldap (0.9.20)
ruby-progressbar (1.11.0)
Expand Down
Expand Up @@ -130,7 +130,7 @@
end

it 'toggles the delivered attribute' do
expect(notification.reload.delivered).to eq(true)
expect(notification.reload.delivered).to be(true)
end

it { expect(response).to have_http_status(:success) }
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/controllers/person/token_controller_spec.rb
Expand Up @@ -24,7 +24,7 @@

it { expect(response).not_to render_template(:index) }
it { expect(response).to have_http_status(:forbidden) }
it { expect(assigns(:list)).to be(nil) }
it { expect(assigns(:list)).to be_nil }
end

context 'called for a user that does not exist' do
Expand All @@ -35,7 +35,7 @@

it { expect(response).not_to render_template(:index) }
it { expect(response).to have_http_status(:forbidden) }
it { expect(assigns(:list)).to be(nil) }
it { expect(assigns(:list)).to be_nil }
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/controllers/webui/comments_controller_spec.rb
Expand Up @@ -92,7 +92,7 @@
delete :destroy, params: { id: other_comment.id }
end

it { expect(flash[:success]).to eq(nil) }
it { expect(flash[:success]).to be_nil }
it { expect(Comment.where(id: comment.id)).to eq([comment]) }
end

Expand Down
12 changes: 6 additions & 6 deletions src/api/spec/controllers/webui/project_controller_spec.rb
Expand Up @@ -59,8 +59,8 @@

it { expect(response).to redirect_to(project_show_path(project)) }
it { expect(flash[:error]).to eq('Failed to update project') }
it { expect(project.title).to be(nil) }
it { expect(project.description).to be(nil) }
it { expect(project.title).to be_nil }
it { expect(project.description).to be_nil }
end
end

Expand Down Expand Up @@ -141,7 +141,7 @@
@json_response = JSON.parse(response.body)
end

it { expect(@json_response).to eq(nil) }
it { expect(@json_response).to be_nil }
end

context 'without search term' do
Expand Down Expand Up @@ -211,7 +211,7 @@
end

it 'does not show a restoration hint' do
expect(assigns(:show_restore_message)).to eq(false)
expect(assigns(:show_restore_message)).to be(false)
end
end

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

it 'shows a hint for restoring the deleted project' do
expect(assigns(:show_restore_message)).to eq(true)
expect(assigns(:show_restore_message)).to be(true)
end
end
end
Expand All @@ -239,7 +239,7 @@

post :restore, params: { project: 'not-allowed-to-create' }

expect(Project.find_by_name('not-allowed-to-create')).to eq(nil)
expect(Project.find_by_name('not-allowed-to-create')).to be_nil
expect(flash[:error]).to match(/not authorized to create/)
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/controllers/webui/request_controller_spec.rb
Expand Up @@ -361,7 +361,7 @@
}
end

it { expect(bs_request).not_to be(nil) }
it { expect(bs_request).not_to be_nil }
it { expect(bs_request.description).to eq('blah blah blash') }
it { expect(response).to redirect_to(request_show_path(number: bs_request)) }
end
Expand Down
Expand Up @@ -49,8 +49,8 @@
end

it { expect(response).to redirect_to(request_show_path(number: bs_request)) }
it { expect(flash[:success]).to be(nil) }
it { expect(bs_request).not_to be(nil) }
it { expect(flash[:success]).to be_nil }
it { expect(bs_request).not_to be_nil }
it { expect(bs_request.description).to eq('change it!') }

it 'creates a request action with correct data' do
Expand All @@ -77,7 +77,7 @@

it { expect(flash[:error]).to eq("Package not found: #{new_devel_project}/non-existant") }
it { expect(response).to redirect_to(package_show_path(project: project, package: package)) }
it { expect(bs_request).to be(nil) }
it { expect(bs_request).to be_nil }
end
end
end
Expand Up @@ -84,7 +84,7 @@
post :create, params: { status_message: { message: 'Some message', severity: 'green' } }
end

it { expect(flash[:error]).not_to be(nil) }
it { expect(flash[:error]).not_to be_nil }
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/controllers/webui/users_controller_spec.rb
Expand Up @@ -121,7 +121,7 @@
email: already_registered_user.email, password: 'buildservice' }
end

it { expect(flash[:error]).not_to be(nil) }
it { expect(flash[:error]).not_to be_nil }
it { expect(response).to redirect_to root_path }
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/features/webui/maintenance_workflow_spec.rb
Expand Up @@ -58,7 +58,7 @@
source_project: "#{user.home_project}:branches:#{update_project}",
source_package: package.name
)
expect(new_bs_request_action.pick(:source_rev)).not_to be(nil)
expect(new_bs_request_action.pick(:source_rev)).not_to be_nil

logout

Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/helpers/webui/user_helper_spec.rb
Expand Up @@ -12,7 +12,7 @@
let(:requester) { create(:user, login: 'Ana') }

it 'do not show the requester if they are the same as the creator' do
expect(requester_str(creator.login, creator.login, nil)).to be(nil)
expect(requester_str(creator.login, creator.login, nil)).to be_nil
end

it 'show the requester if they are different from the creator' do
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/jobs/bs_request_action_webui_infos_job_spec.rb
Expand Up @@ -55,7 +55,7 @@
subject { BsRequestActionWebuiInfosJob.new.perform(request_action) }

it { expect { subject }.not_to raise_error }
it { expect(subject).to eq(nil) }
it { expect(subject).to be_nil }
end

context 'with non existing source package' do
Expand All @@ -75,7 +75,7 @@
subject { BsRequestActionWebuiInfosJob.new.perform(request_action) }

it { expect { subject }.not_to raise_error }
it { expect(subject).to eq(nil) }
it { expect(subject).to be_nil }
end

context 'for a superseded request' do
Expand Down
12 changes: 6 additions & 6 deletions src/api/spec/lib/routes_helper/role_matcher_spec.rb
Expand Up @@ -7,7 +7,7 @@
context 'when the request is from a bot' do
let(:request) { instance_double(ActionDispatch::Request, bot?: true) }

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context 'when the request is from a user with a disabled account' do
Expand All @@ -18,7 +18,7 @@
allow(WebuiControllerService::UserChecker).to receive(:new).and_return(user_checker)
end

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context 'when the request is from an anonymous user' do
Expand All @@ -31,7 +31,7 @@
allow(session).to receive(:[]).with(:login).and_return(nil)
end

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context 'when the request is from a user without any role' do
Expand All @@ -45,7 +45,7 @@
allow(session).to receive(:[]).with(:login).and_return(user.login)
end

it { is_expected.to eq(false) }
it { is_expected.to be(false) }
end

context 'when the request is from a staff user' do
Expand All @@ -59,7 +59,7 @@
allow(session).to receive(:[]).with(:login).and_return(user.login)
end

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end

context 'when the request is from an admin user' do
Expand All @@ -73,7 +73,7 @@
allow(session).to receive(:[]).with(:login).and_return(user.login)
end

it { is_expected.to eq(true) }
it { is_expected.to be(true) }
end
end
end
4 changes: 2 additions & 2 deletions src/api/spec/mixins/parse_package_diff_spec.rb
Expand Up @@ -128,8 +128,8 @@
it { expect(subject[issue.label][:name]).to eq(issue.name) }
it { expect(subject[issue.label][:tracker]).to eq(issue_tracker.name) }

it { expect(subject[:empty]).to eq(nil) }
it { expect(subject[deleted_issue.label]).to eq(nil) }
it { expect(subject[:empty]).to be_nil }
it { expect(subject[deleted_issue.label]).to be_nil }
end
end
end
14 changes: 7 additions & 7 deletions src/api/spec/models/bs_request_spec.rb
Expand Up @@ -384,7 +384,7 @@
]
end

it { expect(BsRequest.truncated_diffs?(request_actions)).to eq(false) }
it { expect(BsRequest.truncated_diffs?(request_actions)).to be(false) }
end

context 'when there is no sourcediff' do
Expand All @@ -395,7 +395,7 @@
]
end

it { expect(BsRequest.truncated_diffs?(request_actions)).to eq(false) }
it { expect(BsRequest.truncated_diffs?(request_actions)).to be(false) }
end

context 'when the sourcediff is empty' do
Expand All @@ -406,31 +406,31 @@
]
end

it { expect(BsRequest.truncated_diffs?(request_actions)).to eq(false) }
it { expect(BsRequest.truncated_diffs?(request_actions)).to be(false) }
end

context 'when the diff is at least one diff that has a shown attribute' do
let(:request_actions) do
[{ type: :submit, sourcediff: [{ 'files' => [['./my_file', { 'diff' => { 'shown' => '200' } }]] }] }]
end

it { expect(BsRequest.truncated_diffs?(request_actions)).to eq(true) }
it { expect(BsRequest.truncated_diffs?(request_actions)).to be(true) }
end

context 'when none of the diffs has a shown attribute' do
let(:request_actions) do
[{ type: :submit, sourcediff: [{ 'files' => [['./my_file', { 'diff' => { 'rev' => '1' } }]] }] }]
end

it { expect(BsRequest.truncated_diffs?(request_actions)).to eq(false) }
it { expect(BsRequest.truncated_diffs?(request_actions)).to be(false) }
end

context "when there is a sourcediff attribute with no 'files'" do
let(:request_actions) do
[{ type: :submit, sourcediff: [{ 'other_data' => 'foo' }] }]
end

it { expect(BsRequest.truncated_diffs?(request_actions)).to eq(false) }
it { expect(BsRequest.truncated_diffs?(request_actions)).to be(false) }
end
end

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

it 'sets the value for diff_not_cached' do
action_details = request.send(:action_details, opts, xml: request.bs_request_actions.last)
expect(action_details[:diff_not_cached]).to eq(false)
expect(action_details[:diff_not_cached]).to be(false)
end
end
end
Expand Down
24 changes: 12 additions & 12 deletions src/api/spec/models/configuration_spec.rb
Expand Up @@ -39,12 +39,12 @@

it 'returns true if config option `ldap_mode` is set to :on' do
stub_const('CONFIG', CONFIG.merge('ldap_mode' => :on))
expect(config.ldap_enabled?).to eq(true)
expect(config.ldap_enabled?).to be(true)
end

it 'returns false if config option `ldap_mode` is not set to :on' do
stub_const('CONFIG', CONFIG.merge('ldap_mode' => :off))
expect(config.ldap_enabled?).to eq(false)
expect(config.ldap_enabled?).to be(false)
end
end

Expand All @@ -53,13 +53,13 @@

it 'returns false if config option `change_password` is set to false' do
allow(config).to receive(:change_password).and_return(false)
expect(config.passwords_changable?).to eq(false)
expect(config.passwords_changable?).to be(false)
end

context 'external authentication services' do
it 'returns false if config option `proxy_auth_mode` is set to :on' do
stub_const('CONFIG', CONFIG.merge('proxy_auth_mode' => :on))
expect(config.passwords_changable?).to eq(false)
expect(config.passwords_changable?).to be(false)
end

context 'in LDAP mode' do
Expand All @@ -70,23 +70,23 @@
end

it 'returns false if no user is given' do
expect(config.passwords_changable?).to eq(false)
expect(config.passwords_changable?).to be(false)
end

it 'returns false if user is configured to use the LDAP auth service' do
expect(config.passwords_changable?(user)).to eq(false)
expect(config.passwords_changable?(user)).to be(false)
end

it 'returns true if user is configured to use local authentication' do
user.update(ignore_auth_services: true)
expect(config.passwords_changable?(user)).to eq(true)
expect(config.passwords_changable?(user)).to be(true)
end
end
end

context 'without external authentication services' do
it 'returns true' do
expect(config.passwords_changable?).to eq(true)
expect(config.passwords_changable?).to be(true)
end
end
end
Expand All @@ -100,12 +100,12 @@
end

it 'returns false if proxy_auth_account_page is not present' do
expect(config.accounts_editable?).to eq(false)
expect(config.accounts_editable?).to be(false)
end

it 'returns true if proxy_auth_account_page is present' do
stub_const('CONFIG', CONFIG.merge('proxy_auth_account_page' => 'https://opensuse.org'))
expect(config.accounts_editable?).to eq(true)
expect(config.accounts_editable?).to be(true)
end
end

Expand All @@ -117,11 +117,11 @@
end

it 'returns false' do
expect(config.accounts_editable?).to eq(false)
expect(config.accounts_editable?).to be(false)
end

it 'returns true for a user that is configured to ignore_auth_services' do
expect(config.accounts_editable?(user)).to eq(true)
expect(config.accounts_editable?(user)).to be(true)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/models/distribution_spec.rb
Expand Up @@ -31,7 +31,7 @@
let(:xmlhash) { nil }

it { is_expected.to be_a(Distribution) }
it { expect(subject.vendor).to be(nil) }
it { expect(subject.vendor).to be_nil }
end
end

Expand Down

0 comments on commit c0d3482

Please sign in to comment.