diff --git a/lib/install/web.rb b/lib/install/web.rb index 1796f474..9b093788 100644 --- a/lib/install/web.rb +++ b/lib/install/web.rb @@ -28,7 +28,7 @@ def apply_template! if ARGV.include?("--suspenders-main") gem "suspenders", github: "thoughtbot/suspenders", branch: "main" else - gem "suspenders" + gem "suspenders", "~> 3" end end diff --git a/test/generators/suspenders/install/web_generator_test.rb b/test/generators/suspenders/install/web_generator_test.rb index b2740732..43c11c78 100644 --- a/test/generators/suspenders/install/web_generator_test.rb +++ b/test/generators/suspenders/install/web_generator_test.rb @@ -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", "~> 3"/ + end + test "raises if API only application" do within_api_only_app do assert_raises Suspenders::Generators::APIAppUnsupported::Error do