Hi all,
I encounter a problem when i''m stubing out a library file.
The rails version is 2.3.4.
[How to reproduce]
1. Create a file payment_gateway.rb in subdirectory lib/.
[code]
class PaymentGateway
def self.collect
p ''lib/payment_gateway''
true
end
end
2. Create a file payment_gateway.rb in subdirectory test/mocks/test.
[code]
require ''lib/util/payment_gateway''
class PaymentGateway
def self.collect
p ''mock/payment_gateway''
false
end
end
3. Create a method in any unit test file to test this method.
The actual result is invoking the method in the mock file, and the
output is
''mock/payment_gateway''
false
But if i add the following code in the application_controller.rb
[code]
require ''util/payment_gateway''
The actual result is invoking the method in the lib file, and the output
is
''lib/payment_gateway''
true
I don''t know why is that, could anyone give me some help?
Thanks very much.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.