Commit 2da8268dd7171366ea2f7dacbca292a87020a10c
1 parent
8aa4819c
Exists in
colab
and in
4 other branches
Revert "Added seeds script to set the default configurations to public"
Showing
4 changed files
with
4 additions
and
30 deletions
Show diff stats
db/seeds.rb
| @@ -5,22 +5,3 @@ | @@ -5,22 +5,3 @@ | ||
| 5 | # | 5 | # |
| 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) |
| 7 | # Mayor.create(name: 'Emanuel', city: cities.first) | 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,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, :with_id) } | 5 | + let(:user) { FactoryGirl.build(:user) } |
| 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,23 +2,16 @@ | @@ -2,23 +2,16 @@ | ||
| 2 | 2 | ||
| 3 | FactoryGirl.define do | 3 | FactoryGirl.define do |
| 4 | factory :user do | 4 | factory :user do |
| 5 | + id 1 | ||
| 5 | name "Diego Martinez" | 6 | name "Diego Martinez" |
| 6 | email "diego@email.com" | 7 | email "diego@email.com" |
| 7 | password "password" | 8 | password "password" |
| 8 | 9 | ||
| 9 | factory :another_user do | 10 | factory :another_user do |
| 11 | + id 2 | ||
| 10 | name "Heitor Reis" | 12 | name "Heitor Reis" |
| 11 | email "hr@email.com" | 13 | email "hr@email.com" |
| 12 | password "password" | 14 | password "password" |
| 13 | end | 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 | end | 16 | end |
| 24 | end | 17 | 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, :with_id) } | 79 | + let!(:user) { FactoryGirl.build(:user) } |
| 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) } |
-
mentioned in commit 65c80c91f8a018381913673744241ad449878826