Skip to content

Instantly share code, notes, and snippets.

@joekr
Last active December 25, 2015 21:49
Show Gist options
  • Save joekr/7045514 to your computer and use it in GitHub Desktop.
Save joekr/7045514 to your computer and use it in GitHub Desktop.
Rspec a public method which calls a private method.
class User < ActiveRecord::Base
def my_public_method
self.my_private_method
end
private
def my_private_method
true
end
end
require 'spec_helper'
describe User do
before(:each) do
@user = FactoryGirl.create(:user)
end
it "should return true" do
user.my_public_method.should eq(true)
end
end
@cheshire137
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment