Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active November 20, 2015 03:56
Show Gist options
  • Select an option

  • Save YumaInaura/75ff7ee8f932b3941478 to your computer and use it in GitHub Desktop.

Select an option

Save YumaInaura/75ff7ee8f932b3941478 to your computer and use it in GitHub Desktop.
Rspec で クラスメソッドのスタブを作る方法 ref: http://qiita.com/Yinaura/items/dfc09fd6d4b953181e2d
class Example
def self.class_method
'This is real class method'
end
end
require 'spec_helper'
describe do
before do
allow(Example).to receive(:class_method).and_return('This is stub class method')
end
it do
p Example.class_method
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment