-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate Gemfile entry with version constraint #1244
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,14 @@ class WebGeneratorTest < Rails::Generators::TestCase | |
setup :prepare_destination | ||
teardown :restore_destination | ||
|
||
test "generates Gemfile entry with version constraint" do | ||
with_database "postgresql" do | ||
run_generator | ||
end | ||
|
||
assert_file "Gemfile", /gem "suspenders", "> 20240101"/ | ||
end | ||
Comment on lines
+15
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Were you able to get this to pass locally? I'm having some local dependency issues, so I can't verify this locally. That being said, the file we're modifying in this commit is This test is responsible for testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, we don't have any coverage for |
||
|
||
test "raises if API only application" do | ||
within_api_only_app do | ||
assert_raises Suspenders::Generators::APIAppUnsupported::Error do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I tried (and failed) to see if I could do this dynamically by including
Suspenders::Version
in this file, and then doing something like this:The problem is that when this file is invoked, it's outside the context of Suspenders, so if Suspenders is not installed on the system, it will error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this is a Ruby file executed in its own environment without access to Bundler or other dependencies. I chose
20240101
because its a lower limit on the possible values (versions starting with the2024
-prefix), not necessarily because it's a valid version that has a release.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could do something similar to the Rails reproduction scripts, but for now, this works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an aside, I thought leaving off the version meant we'd download the latest version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While that might increase the runtime of
rails new
, that might be worthwhile, since it's (ideally) only executed once per project.Ideally, that would be true. In practice,
rails new
would consistently installv0.2.4
.