Skip to content

Commit ada4732

Browse files
committed
Add tentative test
1 parent 57ddb9d commit ada4732

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

features/generators.feature

+16
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,19 @@ Feature:
9090
And I run `bundle exec rails generate model User name:string age:integer` with a clean environment
9191
Then the output should not contain "test/factories/users.rb"
9292
And the output should contain "test/fixtures/users.yml"
93+
94+
Scenario: The factory_bot_rails authentication generator, coupled with rspec-rails, creates a user factory file
95+
When I add "rspec-rails" with options `github: "rspec/rspec-rails", branch: "main"` as a dependency
96+
And I run `bundle install --verbose` with a clean environment
97+
Then the output should contain "rspec-rails"
98+
And I run `bundle exec rails generate authentication` with a clean environment
99+
Then the output should contain "test/factories/users.rb"
100+
And the file "test/factories/users.rb" should contain exactly:
101+
"""
102+
FactoryBot.define do
103+
factory :user do
104+
email_address { "[email protected]" }
105+
password_digest { "MyString" }
106+
end
107+
end
108+
"""

features/step_definitions/rails_steps.rb

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
append_to_file("Gemfile", %(gem "#{gem_name}"\n))
2929
end
3030

31+
When(/^I add "([^"]+)" with options `(.+)` as a dependency$/) do |gem_name, options|
32+
append_to_file("Gemfile", %(gem "#{gem_name}", #{options}\n))
33+
end
34+
3135
When(/^I print out "([^"]*)"$/) do |path|
3236
in_current_dir do
3337
File.open(path, "r") do |f|

0 commit comments

Comments
 (0)