Commit 9daaf17bc51c1e6d717dc29c070cb948f9ce055a
1 parent
31351f19
Exists in
colab
and in
4 other branches
Removed default id from User factory, and fixed tests that depend on it
Signed off by: Daniel Miranda <danielkza2@gmail.com>
Showing
3 changed files
with
6 additions
and
4 deletions
Show diff stats
spec/controllers/users_controller_spec.rb
@@ -2,7 +2,7 @@ require 'rails_helper' | @@ -2,7 +2,7 @@ require 'rails_helper' | ||
2 | 2 | ||
3 | describe UsersController, :type => :controller do | 3 | describe UsersController, :type => :controller do |
4 | describe 'projects' do | 4 | describe 'projects' do |
5 | - let(:user) { FactoryGirl.build(:user) } | 5 | + let(:user) { FactoryGirl.build(:user, :with_id) } |
6 | 6 | ||
7 | before :each do | 7 | before :each do |
8 | User.expects(:find).with(user.id).returns(user) | 8 | User.expects(:find).with(user.id).returns(user) |
spec/factories/users.rb
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | 2 | ||
3 | FactoryGirl.define do | 3 | FactoryGirl.define do |
4 | factory :user do | 4 | factory :user do |
5 | - sequence(:id, 5) | ||
6 | name "Diego Martinez" | 5 | name "Diego Martinez" |
7 | email "diego@email.com" | 6 | email "diego@email.com" |
8 | password "password" | 7 | password "password" |
@@ -16,7 +15,10 @@ FactoryGirl.define do | @@ -16,7 +15,10 @@ FactoryGirl.define do | ||
16 | factory :mezuro_user do | 15 | factory :mezuro_user do |
17 | name "Mezuro Default user" | 16 | name "Mezuro Default user" |
18 | email "mezuro@librelist.com" | 17 | email "mezuro@librelist.com" |
19 | - password Devise.friendly_token.first(10) | 18 | + end |
19 | + | ||
20 | + trait :with_id do | ||
21 | + sequence(:id, 1) | ||
20 | end | 22 | end |
21 | end | 23 | end |
22 | end | 24 | end |
spec/models/reading_group_spec.rb
@@ -76,7 +76,7 @@ describe ReadingGroup, :type => :model do | @@ -76,7 +76,7 @@ describe ReadingGroup, :type => :model do | ||
76 | 76 | ||
77 | describe 'class methods' do | 77 | describe 'class methods' do |
78 | describe 'public_or_owned_by_user' do | 78 | describe 'public_or_owned_by_user' do |
79 | - let!(:user) { FactoryGirl.build(:user) } | 79 | + let!(:user) { FactoryGirl.build(:user, :with_id) } |
80 | 80 | ||
81 | let!(:owned_private_attrs) { FactoryGirl.build(:reading_group_attributes, :private, user_id: user.id) } | 81 | let!(:owned_private_attrs) { FactoryGirl.build(:reading_group_attributes, :private, user_id: user.id) } |
82 | let!(:owned_public_attrs) { FactoryGirl.build(:reading_group_attributes, user_id: user.id) } | 82 | let!(:owned_public_attrs) { FactoryGirl.build(:reading_group_attributes, user_id: user.id) } |