Commit 2da8268dd7171366ea2f7dacbca292a87020a10c

Authored by Rafael Manzo
1 parent 8aa4819c

Revert "Added seeds script to set the default configurations to public"

db/seeds.rb
... ... @@ -5,22 +5,3 @@
5 5 #
6 6 # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 7 # Mayor.create(name: 'Emanuel', city: cities.first)
8   -
9   -# Default mezuro user, the owner of the public kalibro configurations
10   -password = Devise.friendly_token
11   -default_user = FactoryGirl.create(:mezuro_user, password: password)
12   -
13   -puts "-- Default user created:"
14   -puts " Email: #{default_user.email}"
15   -puts " Password: #{password}"
16   -
17   -# The database should have only the default public
18   -# configurations when this file is executed
19   -kalibro_configurations = KalibroConfiguration.all
20   -kalibro_configurations.each do |configuration|
21   - attributes = KalibroConfigurationAttributes.new
22   - attributes.kalibro_configuration_id = configuration.id
23   - attributes.public = true
24   - attributes.user_id = default_user.id
25   - attributes.save
26   -end
... ...
spec/controllers/users_controller_spec.rb
... ... @@ -2,7 +2,7 @@ require 'rails_helper'
2 2  
3 3 describe UsersController, :type => :controller do
4 4 describe 'projects' do
5   - let(:user) { FactoryGirl.build(:user, :with_id) }
  5 + let(:user) { FactoryGirl.build(:user) }
6 6  
7 7 before :each do
8 8 User.expects(:find).with(user.id).returns(user)
... ...
spec/factories/users.rb
... ... @@ -2,23 +2,16 @@
2 2  
3 3 FactoryGirl.define do
4 4 factory :user do
  5 + id 1
5 6 name "Diego Martinez"
6 7 email "diego@email.com"
7 8 password "password"
8 9  
9 10 factory :another_user do
  11 + id 2
10 12 name "Heitor Reis"
11 13 email "hr@email.com"
12 14 password "password"
13 15 end
14   -
15   - factory :mezuro_user do
16   - name "Mezuro Default user"
17   - email "mezuro@librelist.com"
18   - end
19   -
20   - trait :with_id do
21   - sequence(:id, 1)
22   - end
23 16 end
24 17 end
... ...
spec/models/reading_group_spec.rb
... ... @@ -76,7 +76,7 @@ describe ReadingGroup, :type => :model do
76 76  
77 77 describe 'class methods' do
78 78 describe 'public_or_owned_by_user' do
79   - let!(:user) { FactoryGirl.build(:user, :with_id) }
  79 + let!(:user) { FactoryGirl.build(:user) }
80 80  
81 81 let!(:owned_private_attrs) { FactoryGirl.build(:reading_group_attributes, :private, user_id: user.id) }
82 82 let!(:owned_public_attrs) { FactoryGirl.build(:reading_group_attributes, user_id: user.id) }
... ...