ruby - RSpec testing module methods/ -


i have next modules.

module   module b           def self.method_b(value)       #code     end   end  end 

and

module   module c     def self.method_c(value)        a::b.method_b(value)     end   end end 

how test these module? how create stub self.method_b?

spec_helper.rb

rspec.configure |config|  config.mock_with :mocha end 

thanks.

you have switched out built-in rspec mocking library mocha. has different api. try:

a::b.stubs(:method_b).returns('value') 

Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -