Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use active support's Hash#except

  • Loading branch information...
commit eb73dc1979d317460aa85eaa940b0127bdca3e57 1 parent 50a66d0
@joshuaclayton joshuaclayton authored
View
2  lib/factory_girl/proxy.rb
@@ -1,3 +1,5 @@
+require "active_support/core_ext/hash/except"
+
module FactoryGirl
class Proxy #:nodoc:
def initialize(klass, callbacks = [])
View
6 lib/factory_girl/proxy/build.rb
@@ -25,7 +25,7 @@ def associate(name, factory_name, overrides)
def association(factory_name, overrides = {})
method = get_method(overrides[:method])
factory = FactoryGirl.factory_by_name(factory_name)
- factory.run(method, remove_method(overrides))
+ factory.run(method, overrides.except(:method))
end
def result(to_create)
@@ -35,10 +35,6 @@ def result(to_create)
private
- def remove_method(overrides)
- overrides.dup.delete_if {|key, value| key == :method}
- end
-
def get_method(method)
case method
when :build then Proxy::Build
View
6 lib/factory_girl/proxy/stub.rb
@@ -65,11 +65,7 @@ def associate(name, factory_name, overrides)
def association(factory_name, overrides = {})
factory = FactoryGirl.factory_by_name(factory_name)
- factory.run(Proxy::Stub, remove_method(overrides))
- end
-
- def remove_method(overrides)
- overrides.dup.delete_if {|key, value| key == :method}
+ factory.run(Proxy::Stub, overrides.except(:method))
end
def result(to_create)
Please sign in to comment.
Something went wrong with that request. Please try again.