Skip to content

Commit 64c4958

Browse files
lulalalaJonRowe
authored andcommitted
Refactor save related stub lookup
1 parent c0acfec commit 64c4958

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/rspec/active_model/mocks/mocks.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,9 @@ def self.param_delimiter; "-"; end
144144
include ActiveModel::Validations
145145
end
146146
if defined?(ActiveRecord)
147-
[:save, :update_attributes, :update].each do |key|
148-
if stubs[key] == false
149-
RSpec::Mocks.allow_message(m.errors, :empty?).and_return(false)
150-
RSpec::Mocks.allow_message(m.errors, :blank?).and_return(false)
151-
end
147+
if stubs.values_at(:save, :update_attributes, :update).include?(false)
148+
RSpec::Mocks.allow_message(m.errors, :empty?).and_return(false)
149+
RSpec::Mocks.allow_message(m.errors, :blank?).and_return(false)
152150
end
153151
end
154152

0 commit comments

Comments
 (0)