Created
October 7, 2012 07:46
-
-
Save leafmind/3847457 to your computer and use it in GitHub Desktop.
vcr usage
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
# -*- encoding : utf-8 -*- | |
require 'spec_helper' | |
describe Livejournal::User do | |
let(:user_params) { {:nickname => 'fatumka', :password => '59909046'} } | |
let(:user) { FactoryGirl.create(:user) } | |
describe "#authorize!" do | |
it "should successfully authorize user and create livejournal_user row" do | |
VCR.use_cassette('livejournal/login_success') do | |
expect { | |
described_class.authorize!(user, user_params).should be_true | |
}.should change(Livejournal::User, :count).by(1) | |
end | |
end | |
it "should return false and not create user_row" do | |
VCR.use_cassette('livejournal/login_fail') do | |
params = user_params.merge :password => '12345' | |
expect { | |
described_class.authorize!(user, params).should be_nil | |
}.should_not change(Livejournal::User, :count).by(1) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment