Use double instead of mock, stub instead of stub! to make rspec happy

This commit is contained in:
Marcin Kulik 2013-08-08 11:44:37 +02:00
parent 3f879e79da
commit e1286b407e
5 changed files with 8 additions and 8 deletions

View File

@ -114,7 +114,7 @@ describe FakesController do
it 'redirects to stored location' do
stored_path = double
path = double
@controller.stub!(:get_stored_location => stored_path)
@controller.stub(:get_stored_location => stored_path)
@controller.should_receive(:redirect_to).with(stored_path)
@controller.send(:redirect_back_or_to, path)
end

View File

@ -64,7 +64,7 @@ describe AsciicastsController do
end
context 'for html request' do
let(:view_counter) { mock('view_counter') }
let(:view_counter) { double('view_counter') }
before do
AsciicastDecorator.should_receive(:new).with(asciicast).

View File

@ -36,7 +36,7 @@ describe SessionsController do
context "user doesn't exist" do
let(:auth) { request.env["omniauth.auth"] }
let(:user) { stub("user", :id => 1, :persisted? => true) }
let(:user) { double("user", :id => 1, :persisted? => true) }
context "when nickname is not taken" do
it "should call create_with_omniauth" do

View File

@ -18,7 +18,7 @@ describe UserTokensController do
before do
login_as user
user.stub!(:add_user_token => user_token)
user.stub(:add_user_token => user_token)
@controller.should_receive(:ensure_authenticated!)
end
@ -26,7 +26,7 @@ describe UserTokensController do
let(:claimed) { 5 }
before do
user_token.stub!(:valid? => true)
user_token.stub(:valid? => true)
Asciicast.should_receive(:assign_user).
with(user_token.token, user).
@ -52,7 +52,7 @@ describe UserTokensController do
context 'when given token is invalid' do
before do
user_token.stub!(:valid? => false)
user_token.stub(:valid? => false)
end
it "doesn't call Asciicast.assign_user" do

View File

@ -21,7 +21,7 @@ describe UsersController do
:avatar_url => avatar_url
}
user.stub!(:save => true)
user.stub(:save => true)
end
it "assigns provider and uid" do
@ -52,7 +52,7 @@ describe UsersController do
context "when not valid data" do
before do
user.stub!(:save => false)
user.stub(:save => false)
end
it "renders user/new" do