From 9b3bd4b221a6e847f4a5a4fa774a405d967db5d2 Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 27 Aug 2020 15:56:17 +0100 Subject: [PATCH] Hound --- spec/lib/administrate/search_spec.rb | 5 ++++- spec/lib/fields/deferred_spec.rb | 15 +++++++++++---- spec/lib/fields/has_many_spec.rb | 14 ++++++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/spec/lib/administrate/search_spec.rb b/spec/lib/administrate/search_spec.rb index 462dd8bf9a..d0bd0eb1d2 100644 --- a/spec/lib/administrate/search_spec.rb +++ b/spec/lib/administrate/search_spec.rb @@ -26,7 +26,10 @@ class Address < MockRecord; end class Foo < MockRecord belongs_to :role - belongs_to :author, class_name: "Administrate::SearchSpecMocks::Person" + belongs_to( + :author, + class_name: "Administrate::SearchSpecMocks::Person", + ) has_one :address end diff --git a/spec/lib/fields/deferred_spec.rb b/spec/lib/fields/deferred_spec.rb index 8218d7c35e..45ff380602 100644 --- a/spec/lib/fields/deferred_spec.rb +++ b/spec/lib/fields/deferred_spec.rb @@ -34,14 +34,16 @@ context "when not given a `foreign_key` option" do it "delegates to the backing class" do deferred = Administrate::Field::Deferred.new( - Administrate::Field::String + Administrate::Field::String, ) allow(Administrate::Field::String).to receive(:permitted_attribute) deferred.permitted_attribute(:foo, resource_class: LineItem) - expect(Administrate::Field::String). - to have_received(:permitted_attribute).with(:foo, resource_class: LineItem) + expect(Administrate::Field::String).to( + have_received(:permitted_attribute). + with(:foo, resource_class: LineItem), + ) end end @@ -53,8 +55,13 @@ field, class_name: "Foo::Bar", ) + deferred.permitted_attribute(:bars) - expect(field).to have_received(:permitted_attribute).with(:bars, class_name: "Foo::Bar") + + expect(field).to( + have_received(:permitted_attribute). + with(:bars, class_name: "Foo::Bar"), + ) end end end diff --git a/spec/lib/fields/has_many_spec.rb b/spec/lib/fields/has_many_spec.rb index 31f558b5bf..b91e62eac4 100644 --- a/spec/lib/fields/has_many_spec.rb +++ b/spec/lib/fields/has_many_spec.rb @@ -19,7 +19,12 @@ describe "#associated_collection" do it "returns an index page for the dashboard of the associated attribute" do customer = FactoryBot.build(:customer) - field = Administrate::Field::HasMany.new(:orders, Order.all, :show, resource: customer) + field = Administrate::Field::HasMany.new( + :orders, + Order.all, + :show, + resource: customer, + ) page = field.associated_collection @@ -217,7 +222,12 @@ customer = FactoryBot.create(:customer, :with_orders) options = { sort_by: :address_line_two, direction: :desc } association = Administrate::Field::HasMany.with_options(options) - field = association.new(:orders, customer.orders, :show, resource: customer) + field = association.new( + :orders, + customer.orders, + :show, + resource: customer, + ) reversed_order = customer.orders.sort_by(&:address_line_two).map(&:id) correct_order = customer.orders.sort do |a, b|