Last active
December 25, 2015 21:49
-
-
Save joekr/7045514 to your computer and use it in GitHub Desktop.
Rspec a public method which calls a private method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
def my_public_method | |
self.my_private_method | |
end | |
private | |
def my_private_method | |
true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't use should