Skip to content

Instantly share code, notes, and snippets.

@leafmind
Created October 7, 2012 07:46
Show Gist options
  • Save leafmind/3847457 to your computer and use it in GitHub Desktop.
Save leafmind/3847457 to your computer and use it in GitHub Desktop.
vcr usage
# -*- 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