Skip to content

Commit

Permalink
Run rubocop -a on spec
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-contreras committed Mar 1, 2024
1 parent be071d1 commit fa9a44d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
it 'sends an email to the correct user in the correct language' do
perform_enqueued_jobs
mail = ActionMailer::Base.deliveries.last
refute_nil mail
expect(mail).not_to be_nil
expect([registered_user.mail]).to eq(mail.to)
mail.parts.each do |part|
expect(part.body.encoded).to include(I18n.t(:notice_account_activated, locale: 'de'))
Expand Down
15 changes: 10 additions & 5 deletions spec/features/projects/projects_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,14 @@ def expect_projects_in_order(*projects)
development_project.update(
description: 'I am a nice project with a very long long long long long long long long long description',
status_explanation: '<figure>I am a nice project status description with a figure</figure>',
custom_field_values: { custom_field.id => 'This is a short value', long_text_custom_field.id => 'This is a very long long long long long long long value' }
custom_field_values: { custom_field.id => 'This is a short value',
long_text_custom_field.id => 'This is a very long long long long long long long value' }
)

development_project.save!
login_as(admin)
Setting.enabled_projects_columns += [custom_field.column_name, long_text_custom_field.column_name, 'description', 'status_explanation']
Setting.enabled_projects_columns += [custom_field.column_name, long_text_custom_field.column_name, 'description',
'status_explanation']
projects_page.visit!

tr_project_development = page.first('tr', text: 'Development project')
Expand All @@ -275,12 +277,15 @@ def expect_projects_in_order(*projects)
expect(td_project_development_status_description).to have_css('button', text: 'Expand')
expect(td_project_development_status_description).to have_text('Preview not available')

# Check if a long-text costum field which has a short text as value is not truncated and there is no Expand button there
# Check if a long-text custom field which has a short text as value is not truncated and there is no Expand button there
td_project_development_short_cf = tr_project_development.first('td', text: 'This is a short value')
expect(td_project_development_short_cf).to have_no_css('button', text: 'Expand')

# Check if a long-text costum field which has a long text as value is truncated and there is an Expand button there
td_project_development_long_cf = tr_project_development.first('td', text: 'This is a very long long long long long long long value')
# Check if a long-text custom field which has a long text as value is truncated and there is an Expand button there
td_project_development_long_cf = tr_project_development.first(
'td',
text: 'This is a very long long long long long long long value'
)
expect(td_project_development_long_cf).to have_css('button', text: 'Expand')
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
subject: "WP 1->1, 2->2").tap do |wp|
wp.custom_field_values = {
version_cf1.id => [version_1.id.to_s],
version_cf2.id => [version_2.id.to_s],
version_cf2.id => [version_2.id.to_s]
}
wp.save!
end
Expand Down
10 changes: 8 additions & 2 deletions spec/services/workflows/bulk_update_service_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,14 @@
expect(Workflow.where(type_id: type.id, role_id: role.id).count)
.to be 3

refute_nil Workflow.where(role_id: role.id, type_id: type.id, old_status_id: status3.id, new_status_id: status2.id).first
assert_nil Workflow.where(role_id: role.id, type_id: type.id, old_status_id: status5.id, new_status_id: status4.id).first
expect(Workflow.where(role_id: role.id,
type_id: type.id,
old_status_id: status3.id,
new_status_id: status2.id).first).not_to be_nil
expect(Workflow.where(role_id: role.id,
type_id: type.id,
old_status_id: status5.id,
new_status_id: status4.id).first).to be_nil
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/support/rspec_retry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
##
# Helper to pass options to retriable while logging
# failures
def retry_block(args: {}, screenshot: false, &block)
def retry_block(args: {}, screenshot: false, &)
if ENV["RSPEC_RETRY_RETRY_COUNT"] == "0"
yield
return
Expand Down Expand Up @@ -76,7 +76,7 @@ def retry_block(args: {}, screenshot: false, &block)
end
end

Retriable.retriable(on_retry: log_errors, **args, &block)
Retriable.retriable(on_retry: log_errors, **args, &)
end

def backtrace_up_to_spec_file(exception)
Expand Down
8 changes: 4 additions & 4 deletions spec/support/shared_let.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#
# Since test-prof added `let_it_be` this is only a wrapper for it
# before_all / let_it_be fixture
def shared_let(key, reload: true, refind: false, &block)
let_it_be(key, reload:, refind:, &block)
def shared_let(key, reload: true, refind: false, &)
let_it_be(key, reload:, refind:, &)
end

# Defines an object to be used by default for all FactoryBot association
Expand All @@ -55,9 +55,9 @@ def shared_let(key, reload: true, refind: false, &block)
#
# shared_association_default(:user) { create(:user) }
#
def shared_association_default(key, factory_name: key, &block)
def shared_association_default(key, factory_name: key, &)
# unique let identifier to prevent clashes
let_it_be(key, reload: true, &block)
let_it_be(key, reload: true, &)

before_all do
set_factory_default(factory_name, send(key))
Expand Down

0 comments on commit fa9a44d

Please sign in to comment.