From 8afb6f157ffa28bcefa4f5eabfbf508ee3900997 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Mon, 9 Dec 2013 17:19:14 +0100 Subject: [PATCH] Use factory_girl helpers instead of FactoryGirl.build/create --- spec/models/comment_spec.rb | 2 +- spec/models/user_spec.rb | 4 ++-- spec/models/user_token_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 11f56e0..428c39b 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 88ee9a8..5e92bd3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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 diff --git a/spec/models/user_token_spec.rb b/spec/models/user_token_spec.rb index a106311..339f4fe 100644 --- a/spec/models/user_token_spec.rb +++ b/spec/models/user_token_spec.rb @@ -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