Use factory_girl helpers instead of FactoryGirl.build/create
This commit is contained in:
parent
613621023c
commit
8afb6f157f
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user