mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Rubocop: Correct Lint/ParenthesesAsGroupedExpression offences
This commit is contained in:
@@ -84,16 +84,6 @@ Lint/NonLocalExitFromIterator:
|
||||
Exclude:
|
||||
- 'app/models/product_importer.rb'
|
||||
|
||||
# Offense count: 9
|
||||
Lint/ParenthesesAsGroupedExpression:
|
||||
Exclude:
|
||||
- 'spec/features/admin/enterprises_spec.rb'
|
||||
- 'spec/features/admin/order_cycles_spec.rb'
|
||||
- 'spec/models/cart_spec.rb'
|
||||
- 'spec/models/spree/ability_spec.rb'
|
||||
- 'spec/performance/injection_helper_spec.rb'
|
||||
- 'spec/support/performance_helper.rb'
|
||||
|
||||
# Offense count: 5
|
||||
Lint/ShadowingOuterLocalVariable:
|
||||
Exclude:
|
||||
|
||||
@@ -72,7 +72,7 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory :order_cycle_with_overrides, parent: :order_cycle do
|
||||
after (:create) do |oc|
|
||||
after(:create) do |oc|
|
||||
oc.variants.each do |variant|
|
||||
create(:variant_override, variant: variant, hub: oc.distributors.first, price: variant.price + 100)
|
||||
end
|
||||
|
||||
@@ -92,7 +92,7 @@ feature %q{
|
||||
choose "Visible to registered customers only"
|
||||
expect(page).to have_no_checked_field "enterprise_require_login_false"
|
||||
|
||||
within (".side_menu") { click_link "Users" }
|
||||
within(".side_menu") { click_link "Users" }
|
||||
select2_search user.email, from: 'Owner'
|
||||
expect(page).to have_no_selector '.select2-drop-mask' # Ensure select2 has finished
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ feature %q{
|
||||
|
||||
# And it should have some variants selected
|
||||
selected_initial_variants = initial_variants.take initial_variants.size - 1
|
||||
OrderCycle.last.variants.map(&:id).should match_array (selected_initial_variants.map(&:id) + [v1.id, v2.id])
|
||||
OrderCycle.last.variants.map(&:id).should match_array(selected_initial_variants.map(&:id) + [v1.id, v2.id])
|
||||
|
||||
# And the collection details should have been updated
|
||||
OrderCycle.last.exchanges.where(pickup_time: 'New time 0', pickup_instructions: 'New instructions 0').should be_present
|
||||
|
||||
@@ -47,7 +47,7 @@ describe Cart do
|
||||
let(:product_from_other_distributor) { FactoryGirl.create(:product, :distributors => [other_distributor]) }
|
||||
let(:order) { FactoryGirl.create(:order, :distributor => distributor) }
|
||||
|
||||
before (:each) do
|
||||
before do
|
||||
FactoryGirl.create(:line_item, :order => order, :product => product)
|
||||
order.reload
|
||||
subject.orders << order
|
||||
@@ -88,7 +88,7 @@ describe Cart do
|
||||
describe 'existing order for distributor and order cycle' do
|
||||
let(:order) { FactoryGirl.create(:order, :distributor => distributor, :order_cycle => order_cycle) }
|
||||
|
||||
before (:each) do
|
||||
before do
|
||||
subject.orders << order
|
||||
subject.save!
|
||||
end
|
||||
|
||||
@@ -438,7 +438,7 @@ module Spree
|
||||
end
|
||||
|
||||
context 'Order Cycle co-ordinator, distributor enterprise manager' do
|
||||
let (:user) do
|
||||
let(:user) do
|
||||
user = create(:user)
|
||||
user.spree_roles = []
|
||||
d1.enterprise_roles.build(user: user).save
|
||||
@@ -470,7 +470,7 @@ module Spree
|
||||
end
|
||||
|
||||
context 'enterprise manager' do
|
||||
let (:user) do
|
||||
let(:user) do
|
||||
user = create(:user)
|
||||
user.spree_roles = []
|
||||
s1.enterprise_roles.build(user: user).save
|
||||
@@ -504,7 +504,7 @@ module Spree
|
||||
end
|
||||
|
||||
context 'enterprise owner' do
|
||||
let (:user) { s1.owner }
|
||||
let(:user) { s1.owner }
|
||||
|
||||
it 'should have the ability to welcome and register enterprises that I own' do
|
||||
should have_ability([:welcome, :register], for: s1)
|
||||
|
||||
@@ -24,6 +24,7 @@ describe InjectionHelper, type: :helper, performance: true do
|
||||
puts result
|
||||
end
|
||||
|
||||
puts (results.sum / results.count * 1000).round 0
|
||||
avg = (results.sum / results.count * 1000).round(0)
|
||||
puts avg
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,7 +12,8 @@ module OpenFoodNetwork
|
||||
result.total
|
||||
end.drop(1) # Do not return the first sample
|
||||
|
||||
puts (results.sum / results.count * 1000).round 0
|
||||
avg = (results.sum / results.count * 1000).round(0)
|
||||
puts avg
|
||||
|
||||
results
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user