Use factory_girl helpers instead of FactoryGirl.build/create

This commit is contained in:
Marcin Kulik 2013-12-09 17:19:14 +01:00
parent 613621023c
commit 8afb6f157f
3 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@ require 'spec_helper'
describe Comment do
it "factory should be valid" do
expect(FactoryGirl.build(:comment)).to be_valid
expect(build(:comment)).to be_valid
end
end

View File

@ -92,7 +92,7 @@ describe User do
before { user.save }
context "when user doesn't have given token" do
let(:token) { FactoryGirl.attributes_for(:user_token)[:token] }
let(:token) { attributes_for(:user_token)[:token] }
it 'returns created UserToken' do
ut = user.add_user_token(token)
@ -102,7 +102,7 @@ describe User do
end
context "when user doesn't have given token" do
let(:existing_token) { FactoryGirl.create(:user_token, :user => user) }
let(:existing_token) { create(:user_token, :user => user) }
let(:token) { existing_token.token }
it 'returns existing UserToken' do

View File

@ -2,6 +2,6 @@ require 'spec_helper'
describe UserToken do
it "has valid factory" do
expect(FactoryGirl.build(:user_token)).to be_valid
expect(build(:user_token)).to be_valid
end
end