Created
August 10, 2011 00:29
-
-
Save typeoneerror/1135635 to your computer and use it in GitHub Desktop.
learning rspec
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
| require 'spec_helper' | |
| describe User do | |
| before(:each) do | |
| @user = User.new | |
| end | |
| context 'creating users' do | |
| it 'should be invalid without a facebook id and access token' do | |
| @user.should_not be_valid | |
| @user.errors[:facebook_id].should be_present | |
| @user.errors[:facebook_access_token].should be_present | |
| @user.facebook_id = '1234567890' | |
| @user.facebook_access_token = '253821371311540|access|token' | |
| @user.should be_valid | |
| end | |
| it 'should create a valid user and have a valid a token' do | |
| @user.facebook_id = '1234567890' | |
| @user.facebook_access_token = '253821371311540|fake_access_token|goes_here' | |
| @user.should be_valid | |
| @user.save!.should be_true | |
| @user.api_token.should_not be_empty | |
| @user.api_secret.should_not be_empty | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment