how to check method calling in rspec

June 08, 2015

Reading time ~1 minute

You can check a method is called or not by using receive in rspec.

describe "#method" do
  it "should call method_b" do
    @user = Persion.new
    expect(@user).to receive(:method_b)
    
    @user.method # method_b is called in method
  end
end
  • You should call receive before method_b is called
  • You can specify call count
expect(@user).to receive(:method_b).once
expect(@user).to receive(:method_b).twice

add ticket number to git commit automatically

Most of ticket tracker like Github, pivotal tracker have function to connect your commit to ticket(story).But every time when you commit ...… Continue reading

I will build frontend and backend separately

Published on September 28, 2016

order of angular controller's initialisation

Published on October 05, 2015