spec/lib/shamu/services/service_spec.rb in shamu-0.0.11 vs spec/lib/shamu/services/service_spec.rb in shamu-0.0.13
- old
+ new
@@ -52,15 +52,15 @@
describe Shamu::Services::Service do
let( :service ) { scorpion.new ServiceSpec::Service }
def transformer( &block )
- ->( records ) {
+ ->( records ) do
records.map do |r|
yield || r
end
- }
+ end
end
describe "#entity_list" do
it "maps each record" do
@@ -134,19 +134,19 @@
expect( list.first ).to be_present
end
it "matches on a custom field" do
- list = service.entity_lookup_list( records, [record.amount], ServiceSpec::NullEntity, match: :amount ) do |records|
+ list = service.entity_lookup_list( records, [record.amount], ServiceSpec::NullEntity, match: :amount ) do |records| # rubocop:disable Metrics/LineLength
records.map { |r| scorpion.fetch ServiceSpec::Entity, { record: r }, {} }
end
expect( list.first ).to be_present
end
it "matches with a custom proc" do
matcher = ->( record ) { record.amount }
- list = service.entity_lookup_list( records, [record.amount], ServiceSpec::NullEntity, match: matcher ) do |records|
+ list = service.entity_lookup_list( records, [record.amount], ServiceSpec::NullEntity, match: matcher ) do |records| # rubocop:disable Metrics/LineLength
records.map { |r| scorpion.fetch ServiceSpec::Entity, { record: r }, {} }
end
expect( list.first ).to be_present
end