Created
          May 31, 2013 03:56 
        
      - 
      
- 
        Save mehulkar/5682867 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or 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
    
  
  
    
  | # Lines 16-17 and 21-22 don't make sense to me. | |
| # If I stub a method on the user object, | |
| # why is it not stubeed for the same object on the association? | |
| describe "#approved" do | |
| let(:user) { FactoryGirl.create(:user) } | |
| subject(:bulletin) { FactoryGirl.build(:bulletin_post) } | |
| it "is false if the user is not approved" do | |
| # user.stub(:approved?) { true } | |
| bulletin.user_id = user.id | |
| # bulletin.user === user | |
| # => true | |
| # user.approved? | |
| # => true | |
| # bulletin.user.approved? | |
| # => false | |
| bulletin.user.stub(:approved?) { true } | |
| # user.approved? | |
| # => true | |
| # bulletin.user.approved? | |
| # => true | |
| expect(bulletin.approved?).to eq(false) | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
@dchelimsky @icco sorry I didn't get notified of your responses.
So in line 11, if I were to assign
bulletin.user = userinstead ofuser_id, it should be the same data?@icco, this test is testing that if the
userwho posted the Bulletin is not approved, the bulletin should not be approved either. Theapproved?property is on both models.