Skip to content

Commit

Permalink
add: fixtures for rspec (#127)
Browse files Browse the repository at this point in the history
fix: suggested changes - only the template location is remaining to be determined

fix: change fixture directory

fix: white space
  • Loading branch information
benkoshy authored Jul 21, 2022
1 parent 3ee648b commit a4a8348
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/generators/rodauth/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def create_mailer
def create_fixtures
test_unit_options = ::Rails.application.config.generators.options[:test_unit]
if test_unit_options[:fixture] && test_unit_options[:fixture_replacement].nil?
template "app/test/fixtures/accounts.yml"
if ::Rails.application.config.generators.options[:rails][:test_framework] == :rspec
template "test/fixtures/accounts.yml", "spec/fixtures/accounts.yml"
else
template "test/fixtures/accounts.yml", "test/fixtures/accounts.yml"
end
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/generators/install_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ class InstallGeneratorTest < Rails::Generators::TestCase
end
end

test "fixture" do
test "fixtures" do
run_generator

assert_file "app/test/fixtures/accounts.yml", /<%= BCrypt::Password/
assert_file "test/fixtures/accounts.yml", /<%= BCrypt::Password/ # No tests for the rspec branch
end
end

0 comments on commit a4a8348

Please sign in to comment.