From 1899e2fa980db55d0322d509f1c920ec3f7fdae2 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Mon, 14 Aug 2017 12:56:54 +0200 Subject: [PATCH] Fix rubocop failures --- app/controllers/admin/bulk_line_items_controller.rb | 1 - .../admin/bulk_line_items_controller_spec.rb | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/controllers/admin/bulk_line_items_controller.rb b/app/controllers/admin/bulk_line_items_controller.rb index 9f521f1c52..c0c1b60b91 100644 --- a/app/controllers/admin/bulk_line_items_controller.rb +++ b/app/controllers/admin/bulk_line_items_controller.rb @@ -1,6 +1,5 @@ module Admin class BulkLineItemsController < Spree::Admin::BaseController - # GET /admin/bulk_line_items.json # def index diff --git a/spec/controllers/admin/bulk_line_items_controller_spec.rb b/spec/controllers/admin/bulk_line_items_controller_spec.rb index eceddc918f..78f33e9cf8 100644 --- a/spec/controllers/admin/bulk_line_items_controller_spec.rb +++ b/spec/controllers/admin/bulk_line_items_controller_spec.rb @@ -6,7 +6,7 @@ describe Admin::BulkLineItemsController do describe '#index' do render_views - let(:line_item_attributes) { [:id, :quantity, :max_quantity, :price, :supplier, :final_weight_volume, :units_product, :units_variant, :order] } + let(:line_item_attributes) { %i[id quantity max_quantity price supplier final_weight_volume units_product units_variant order] } let!(:dist1) { FactoryGirl.create(:distributor_enterprise) } let!(:order1) { FactoryGirl.create(:order, state: 'complete', completed_at: 1.day.ago, distributor: dist1, billing_address: FactoryGirl.create(:address) ) } let!(:order2) { FactoryGirl.create(:order, state: 'complete', completed_at: Time.zone.now, distributor: dist1, billing_address: FactoryGirl.create(:address) ) } @@ -26,7 +26,6 @@ describe Admin::BulkLineItemsController do end context "as an administrator" do - before do controller.stub spree_current_user: quick_login_as_admin end @@ -37,7 +36,7 @@ describe Admin::BulkLineItemsController do end it "retrieves a list of line_items with appropriate attributes, including line items with appropriate attributes" do - keys = json_response.first.keys.map{ |key| key.to_sym } + keys = json_response.first.keys.map(&:to_sym) line_item_attributes.all?{ |attr| keys.include? attr }.should == true end @@ -52,7 +51,7 @@ describe Admin::BulkLineItemsController do end it "returns distributor object with id key" do - json_response.map{ |line_item| line_item['supplier'] }.all?{ |d| d.has_key?('id') }.should == true + json_response.map{ |line_item| line_item['supplier'] }.all?{ |d| d.key?('id') }.should == true end end @@ -107,7 +106,7 @@ describe Admin::BulkLineItemsController do end it "retrieves a list of line_items" do - keys = json_response.first.keys.map{ |key| key.to_sym } + keys = json_response.first.keys.map(&:to_sym) line_item_attributes.all?{ |attr| keys.include? attr }.should == true end end @@ -119,7 +118,7 @@ describe Admin::BulkLineItemsController do end it "retrieves a list of line_items" do - keys = json_response.first.keys.map{ |key| key.to_sym } + keys = json_response.first.keys.map(&:to_sym) line_item_attributes.all?{ |attr| keys.include? attr }.should == true end end