Currently, the `sqlite3` in `Gemfile` generated by `rails new` is not
compatible with Rails.
To solve this issue, modified it to use compatible `sqlite3` using
template.
Ref: https://github.com/rails/rails/issues/35161
Closes#231
When generating factories for namespaced models
(like `Admin::User`), we can follow the pattern used by the model and
model test generators of generating the file inside a directory matching
the namespace. With this commit we generate
`test/factories/admin/user.rb` instead of
`test/factories/admin_user.rb`.
PR #135 introduced the ability to generate factories in one file, but it
also removed the ability to use custom templates for generating
factories. This PR adds back the ability to use custom templates when
generating factories in separate files. I doubt this was a heavily used
feature, but it has come up a few times and it I think supporting it
simplifies the generator.
Closes#147Closes#148Closes#193
PR #193 basically reverted #135, which is undesirable. thoughtbot
projects generally prefer putting all the factories in one file.
Co-authored-by: Nick Sanford <me@nicksanford.io>
Fixes#305
When generating factories in the same file (for example
spec/factories.rb), before this PR we didn't put newlines between the
factories. So if you generated a user factory, then a robot factory, you
would end up with something like this:
```rb
FactoryBot.define do
factory :robot do
name { "MyString" }
end
factory :user do
name { "MyString" }
end
end
```
With this PR, generating those factories will now look like:
```rb
FactoryBot.define do
factory :robot do
name { "MyString" }
end
factory :user do
name { "MyString" }
end
end
```
Note that the final newline is not ideal, but it will only be added when
generating the first factory, whereas the missing newline after
factories was happening every time we generated a new factory. So
with this PR we will only need to fix a whitespace style error once,
rather than N-1 times. We can could open another issue to fix the extra
newline at the end, but I think it may be more complicated than it
sounds.
Co-authored-by: Nick Sanford <me@nicksanford.io>
* Remove gemfiles from version control to match same testing style as
Clearance and Suspenders.
* MiniTest does not need to be manually included as it is automatically
included by Rails by default.
* Add spring for Rails 4.1.
* Disable Spring to get specs to pass on Rails 4.1.
* Add therubyrhino for JRuby.
* Remove old references to Rails 3.
* Fix JRuby test where output is "1 runs", not "1 tests".
* Remove Rails 3.0 reference to "turn".
JRuby does not support setting/unsetting environment variables.
Thus, we will launch an entirely new process without the parents env when
we run `bundle install` inside the generated rails apps, forcing them to
use their own Gemfile, instead of the BUNDLE_GEMFILE setting from the main
gem codebase.
Previously, the railties required by the project gemspec was in conflict with
the rails versions being pulled in by Appraisal.
There were situations where a newer rails app was generated by `rails new...`
even though the Appraisal gemfiles/ value should have been setting it correctly.
We need to be able to use the versions of things specified in the appraisal gemfiles/
specify the version of rails for the initial generation of the applications,
but subsequently allow those applications to point to the `Gemfile` within
the newly generated rails apps, rather than wherever BUNDLE_GEMFILE was previously
set by Appraisal.
The factory name for the model Namespaced::User wil be :namespaced_user.
The :class option is specified as a string to prevent class reloading issues.
Addresses GH-44