mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
Try without generating spring binstub
This commit is contained in:
parent
1f241f631d
commit
7ab8302e38
1 changed files with 87 additions and 94 deletions
|
@ -44,101 +44,94 @@ Feature: automatically reloading factory_bot definitions
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
And I run `bundle binstubs bundler spring --force` with a clean environment
|
# # And I run `bundle binstubs bundler spring --force` with a clean environment
|
||||||
And I write to "spring_stuff.rb" with:
|
# And I run `bundle exec spring binstub --all` with a clean environment
|
||||||
"""
|
|
||||||
puts Spring::VERSION
|
|
||||||
puts Spring.application_root
|
|
||||||
puts Spring.project_root_path
|
|
||||||
puts Spring.project_root_path.join("config/application.rb").exist?
|
|
||||||
"""
|
|
||||||
And I run `bin/rails runner spring_stuff.rb` with Spring enabled
|
|
||||||
# And I run `bin/spring binstub --all` with a clean environment
|
|
||||||
And I run `bin/spring server` with Spring enabled
|
|
||||||
And I run `bin/rails test` with Spring enabled
|
And I run `bin/rails test` with Spring enabled
|
||||||
# And I append to "app/models/user.rb" with:
|
And I append to "app/models/user.rb" with:
|
||||||
# """
|
"""
|
||||||
# # User model edited
|
# User model edited
|
||||||
# """
|
"""
|
||||||
# And I run `bin/rails test` with Spring enabled
|
And I run `bin/rails test` with Spring enabled
|
||||||
|
And I run `bundle exec spring stop` with a clean environment
|
||||||
# And I run `bin/spring stop` with a clean environment
|
# And I run `bin/spring stop` with a clean environment
|
||||||
Then the output should contain "asdf1 runs, 1 assertions"
|
Then the output should contain "1 runs, 1 assertions"
|
||||||
And the output should not contain "Failure:"
|
And the output should not contain "Failure:"
|
||||||
|
|
||||||
# Scenario: When using factory_bot_rails together with Spring
|
Scenario: When using factory_bot_rails together with Spring
|
||||||
# I want changes to my factory_bot definitions to trigger a reload
|
I want changes to my factory_bot definitions to trigger a reload
|
||||||
# So that I can use my updated definitions without stopping spring
|
So that I can use my updated definitions without stopping spring
|
||||||
#
|
|
||||||
# When I write to "app/models/user.rb" with:
|
When I write to "app/models/user.rb" with:
|
||||||
# """
|
"""
|
||||||
# class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
# end
|
end
|
||||||
# """
|
"""
|
||||||
# And I write to "test/factories.rb" with:
|
And I write to "test/factories.rb" with:
|
||||||
# """
|
"""
|
||||||
# # Empty definition file to be picked up by the file watcher
|
# Empty definition file to be picked up by the file watcher
|
||||||
#
|
|
||||||
# """
|
"""
|
||||||
# And I run `bundle binstubs bundler spring --force` with a clean environment
|
# And I run `bundle binstubs bundler spring --force` with a clean environment
|
||||||
# And I run `bin/spring binstub --all` with a clean environment
|
# And I run `bin/spring binstub --all` with a clean environment
|
||||||
# And I run `bin/rails test` with Spring enabled
|
And I run `bin/rails test` with Spring enabled
|
||||||
# And I append to "test/factories.rb" with:
|
And I append to "test/factories.rb" with:
|
||||||
# """
|
"""
|
||||||
# FactoryBot.define do
|
FactoryBot.define do
|
||||||
# factory :author, class: User do
|
factory :author, class: User do
|
||||||
# name { "Frank" }
|
name { "Frank" }
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# """
|
"""
|
||||||
# And I write to "test/unit/user_test.rb" with:
|
And I write to "test/unit/user_test.rb" with:
|
||||||
# """
|
"""
|
||||||
# require 'test_helper'
|
require 'test_helper'
|
||||||
#
|
|
||||||
# class UserTest < ActiveSupport::TestCase
|
class UserTest < ActiveSupport::TestCase
|
||||||
# test "user factory" do
|
test "user factory" do
|
||||||
# author = FactoryBot.create(:author)
|
author = FactoryBot.create(:author)
|
||||||
#
|
|
||||||
# assert_equal author.class.object_id, User.object_id
|
assert_equal author.class.object_id, User.object_id
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
# """
|
"""
|
||||||
# And I run `bin/rails test` with Spring enabled
|
And I run `bin/rails test` with Spring enabled
|
||||||
# And I run `bin/spring stop` with a clean environment
|
# And I run `bin/spring stop` with a clean environment
|
||||||
# Then the output should contain "1 runs, 1 assertions"
|
And I run `bundle exec spring stop` with a clean environment
|
||||||
# And the output should not contain "Failure:"
|
Then the output should contain "1 runs, 1 assertions"
|
||||||
#
|
And the output should not contain "Failure:"
|
||||||
# Scenario: Initializing the reloader with I18n support
|
|
||||||
# When I write to "app/models/user.rb" with:
|
Scenario: Initializing the reloader with I18n support
|
||||||
# """
|
When I write to "app/models/user.rb" with:
|
||||||
# class User
|
"""
|
||||||
# TRANSLATION = I18n.translate("translation_key")
|
class User
|
||||||
# end
|
TRANSLATION = I18n.translate("translation_key")
|
||||||
# """
|
end
|
||||||
# And I write to "config/locales/en.yml" with:
|
"""
|
||||||
# """
|
And I write to "config/locales/en.yml" with:
|
||||||
# en:
|
"""
|
||||||
# translation_key: "translation_value"
|
en:
|
||||||
# """
|
translation_key: "translation_value"
|
||||||
# And I write to "test/factories.rb" with:
|
"""
|
||||||
# """
|
And I write to "test/factories.rb" with:
|
||||||
# FactoryBot.define do
|
"""
|
||||||
# factory :user do
|
FactoryBot.define do
|
||||||
# User::TRANSLATION
|
factory :user do
|
||||||
# end
|
User::TRANSLATION
|
||||||
# end
|
end
|
||||||
# """
|
end
|
||||||
# And I write to "test/unit/user_test.rb" with:
|
"""
|
||||||
# """
|
And I write to "test/unit/user_test.rb" with:
|
||||||
# require 'test_helper'
|
"""
|
||||||
#
|
require 'test_helper'
|
||||||
# class UserTest < ActiveSupport::TestCase
|
|
||||||
# test "eser factory" do
|
class UserTest < ActiveSupport::TestCase
|
||||||
# user = FactoryBot.build(:user)
|
test "eser factory" do
|
||||||
#
|
user = FactoryBot.build(:user)
|
||||||
# assert_equal "translation_value", User::TRANSLATION
|
|
||||||
# end
|
assert_equal "translation_value", User::TRANSLATION
|
||||||
# end
|
end
|
||||||
# """
|
end
|
||||||
# And I run `bin/rails test` with a clean environment
|
"""
|
||||||
# Then the output should contain "1 runs, 1 assertions"
|
And I run `bin/rails test` with a clean environment
|
||||||
# And the output should not contain "Failure:"
|
Then the output should contain "1 runs, 1 assertions"
|
||||||
|
And the output should not contain "Failure:"
|
||||||
|
|
Loading…
Reference in a new issue