Skip to content

Commit

Permalink
Crear factories
Browse files Browse the repository at this point in the history
  • Loading branch information
luciagirasoles committed Sep 1, 2022
1 parent 34cb699 commit bc1e442
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ group :test do
gem "selenium-webdriver"
gem "webdrivers"
gem "faker", "~> 2.22"
gem "factory_bot"
gem "factory_bot_rails"

# gem 'simplecov'
end

gem "devise", "~> 4.8"
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ GEM
erubi (1.10.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faker (2.22.0)
i18n (>= 1.8.11, < 2)
ffi (1.15.5)
Expand Down Expand Up @@ -250,7 +253,7 @@ DEPENDENCIES
capybara
debug
devise (~> 4.8)
factory_bot
factory_bot_rails
faker (~> 2.22)
image_processing (~> 1.2)
importmap-rails
Expand Down
7 changes: 7 additions & 0 deletions test/factories/documents.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FactoryBot.define do
factory :document do
title { Faker::Lorem.sentence }
association :owner, factory: :user
association :workspace
end
end
7 changes: 7 additions & 0 deletions test/factories/users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FactoryBot.define do
factory :user do
name { Faker::Name.name }
email { Fake::Internet.email }
password { "password" }
end
end
6 changes: 6 additions & 0 deletions test/factories/workspaces.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FactoryBot.define do
factory :workspace do
title { Faker::Lorem.sentence }
association :owner, factory: :user
end
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "rails/test_help"

class ActiveSupport::TestCase
include FactoryBot::Syntax::Methods
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)

Expand Down

0 comments on commit bc1e442

Please sign in to comment.