Skip to content
New issue

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

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

Already on GitHub? # to your account

chore: update rubocop #1061

Merged
merged 3 commits into from
Oct 14, 2024
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
47 changes: 18 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ GEM
byebug (11.1.3)
childprocess (5.0.0)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crass (1.0.6)
dalli (3.2.8)
Expand Down Expand Up @@ -124,7 +124,7 @@ GEM
globalid (1.2.1)
activesupport (>= 6.1)
hashie (5.0.0)
i18n (1.14.4)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
icalendar (2.10.2)
ice_cube (~> 0.16)
Expand Down Expand Up @@ -189,7 +189,7 @@ GEM
method_source (1.0.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.3)
minitest (5.25.1)
multi_xml (0.6.0)
net-http (0.4.1)
uri
Expand Down Expand Up @@ -249,8 +249,8 @@ GEM
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
parallel (1.24.0)
parser (3.3.0.5)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
partially_useful (6.0.0)
Expand All @@ -265,7 +265,7 @@ GEM
public_suffix (5.0.5)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
racc (1.8.1)
rack (2.2.9)
rack-cache (1.17.0)
rack (>= 0.4)
Expand Down Expand Up @@ -317,10 +317,9 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.6.0)
regexp_parser (2.9.0)
regexp_parser (2.9.2)
request_store (1.6.0)
rack (>= 1.4)
rexml (3.2.6)
rspec-collection_matchers (1.2.1)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.13.0)
Expand All @@ -340,35 +339,25 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rubocop (1.63.0)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-rails (2.24.1)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-rails (2.26.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.29.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.2)
rubocop (~> 1.40)
rubocop-rspec (3.1.0)
rubocop (~> 1.61)
ruby-ll (2.1.3)
ansi
ast
Expand Down Expand Up @@ -415,7 +404,7 @@ GEM
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
uri (0.13.0)
validate_url (1.0.15)
activemodel (>= 3.0.0)
Expand All @@ -434,7 +423,7 @@ GEM
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whitelabel (0.4.0)
zeitwerk (2.6.13)
zeitwerk (2.7.0)

PLATFORMS
ruby
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/likes_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

expect do
post(:create, params: data)
end.to change(Like, :count).by(0)
end.not_to change(Like, :count)
end

it 'validetes likes' do
Expand Down Expand Up @@ -69,7 +69,7 @@

expect do
delete(:destroy, params: { topic_id: topic.id, id: like.id })
end.to change(Like, :count).by(0)
end.not_to change(Like, :count)
expect(flash[:alert]).to be_blank
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/participants_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
it 'shoulds alert a duplicate flash' do
expect do
post :create, params: { event_id: event.to_param }
end.to change(Participant, :count).by(0)
end.not_to change(Participant, :count)
expect(flash[:alert]).not_to be_nil
expect(response).to redirect_to(event)
end
Expand All @@ -37,7 +37,7 @@
it 'shoulds alert a closed flash' do
expect do
post :create, params: { event_id: event.to_param }
end.to change(Participant, :count).by(0)
end.not_to change(Participant, :count)
expect(flash[:alert]).not_to be_nil
expect(response).to redirect_to(event)
end
Expand Down Expand Up @@ -65,7 +65,7 @@

expect do
delete(:destroy, params: { id: @participant.to_param, event_id: @event.to_param })
end.to change(Participant, :count).by(0)
end.not_to change(Participant, :count)
expect(response).to redirect_to(@event)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/topics_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
it 'does not create a topic if not signed in' do
expect do
post(:create, params: { topic: topic_data })
end.to change(Topic, :count).by(0)
end.not_to change(Topic, :count)
expect(response).to redirect_to(login_path)
end
end
Expand Down
5 changes: 2 additions & 3 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
allow(@controller).to receive_messages(current_user: event.user)
expect do
delete :destroy, params: { id: event.user.id }
end.to change(User, :count).by(0)
end.not_to change(User, :count)

expect(flash[:alert]).not_to be_nil
expect(response).to redirect_to(edit_user_path(event.user))
Expand All @@ -91,8 +91,7 @@
it 'does not update injected properties' do
allow(controller).to receive_messages(current_user: user)

put :update, params: data
expect(user.nickname).to eql(user.nickname)
expect { put :update, params: unallowed_data }.not_to change(user, :nickname)
end

it 'updates nothing for wrong user' do
Expand Down
14 changes: 7 additions & 7 deletions spec/lib/preview_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

pg.generate_preview

expect(pg.video?).to eq(true)
expect(pg.image?).to eq(false)
expect(pg.video?).to be(true)
expect(pg.image?).to be(false)
expect(pg.type).to eq(:video)
expect(pg.code).to eq('code')
end
Expand All @@ -46,8 +46,8 @@

pg.generate_preview

expect(pg.video?).to eq(false)
expect(pg.image?).to eq(true)
expect(pg.video?).to be(false)
expect(pg.image?).to be(true)

expect(pg.type).to eq(:image)
expect(pg.code).to eq('src')
Expand All @@ -61,9 +61,9 @@

pg.generate_preview

expect(pg.video?).to eq(false)
expect(pg.image?).to eq(false)
expect(pg.none?).to eq(true)
expect(pg.video?).to be(false)
expect(pg.image?).to be(false)
expect(pg.none?).to be(true)
end
end
end
4 changes: 2 additions & 2 deletions spec/models/usergroup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@
describe '#custom_recurring' do
specify do
expect(colognerb.custom_recurring).to be true
expect(rughh.custom_recurring).to be nil
expect(rughh.custom_recurring).to be_nil
end
end

describe '#localized_custom_recurrence' do
context 'no custom recurring' do
it 'returns nil' do
expect(rughh.localized_custom_recurrence).to be nil
expect(rughh.localized_custom_recurrence).to be_nil
end
end

Expand Down
3 changes: 1 addition & 2 deletions spec/views/events/_info.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
let(:user) { nil }

before do
allow(view).to receive(:signed_in?).and_return(user.present?)
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive_messages(signed_in?: user.present?, current_user: user)
end

it 'displays the title' do
Expand Down
2 changes: 2 additions & 0 deletions spec/views/events/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(events: paged(event))

render

expect(rendered).to include(event.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/events/index.xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
it 'renders successfully' do
allow(view).to receive_messages(events:)
render

expect(rendered).to include(events.first.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/home/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
allow(view).to receive_messages(zoom:)

render

expect(rendered).to include(event.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/labels/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
Whitelabel.reset!

render

expect(rendered).to include(Whitelabel.labels.select(&:enabled?).first.label_id)
end
end
2 changes: 2 additions & 0 deletions spec/views/locations/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(locations:)

render

expect(rendered).to include(locations.first.name)
end
end
4 changes: 3 additions & 1 deletion spec/views/locations/none.html_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
require 'spec_helper'

describe 'locations/none' do
let(:organizers) { [build(:user, id: 123)] }
let!(:organizers) { [build(:user, id: 123)] }
let(:stats) { { participants: 10, topics: 2 } }

it 'renders successfully' do
%w[en de].each do |locale|
I18n.with_locale(locale) do
allow(view).to receive_messages(organizers:, stats:)
render

expect(rendered).to include(organizers.first.name)
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/views/locations/show.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
view.lookup_context.prefixes = %w[locations application]

render

expect(rendered).to include(location.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/sitemaps/show.xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(urls: example_urls)

render

expect(rendered).to include(example_urls.first)
end
end
2 changes: 2 additions & 0 deletions spec/views/topics/edit.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
allow(view).to receive_messages(current_user: user, topic:, undone_topics: [topic])

render

expect(rendered).to include(topic.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/topics/index.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(events: paged(event))

render

expect(rendered).to include(event.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/topics/new.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(signed_in?: true, topic:, undone_topics: [topic])

render

expect(rendered).to include(topic.name.to_s)
end
end
4 changes: 4 additions & 0 deletions spec/views/topics/show.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
allow(view).to receive_messages(topic:, signed_in?: false)

render

expect(rendered).to include(topic.name)
end

context 'materials' do
let(:materials) { [build(:material)] }

it 'renders without an error' do
render partial: 'materials', locals: { materials: }

expect(rendered).to include(materials.first.name)
end
end
end
2 changes: 2 additions & 0 deletions spec/views/users/edit.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(current_user: user, user:)

render

expect(rendered).to include(user.name)
end
end
2 changes: 2 additions & 0 deletions spec/views/users/show.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
allow(view).to receive_messages(current_user: user, user:)

render

expect(rendered).to include(user.nickname)
end
end
Loading