Skip to content

Commit b1b82fe

Browse files
justin808claude
andcommitted
Update tests for beta/RC version handling
Updated the test expectations to match the new behavior where pre-release versions (beta, RC, alpha) are installed with exact version specifiers instead of installing the latest stable version. Changes: - Updated test name from 'without version' to 'with version' for pre-releases - Updated expectation to include version: [email protected] - Added test for beta versions: [email protected] - Added test for alpha versions: [email protected] - Added test for invalid version formats with warning message check All 39 examples now pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 81e717e commit b1b82fe

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

spec/react_on_rails/generators/js_dependency_manager_spec.rb

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,39 @@ def errors
208208
expect(mock_manager).to have_received(:add).with(["[email protected]"], exact: true)
209209
end
210210

211-
it "adds react-on-rails without version for pre-releases" do
211+
it "adds react-on-rails with version for RC pre-releases" do
212212
stub_const("ReactOnRails::VERSION", "16.0.0-rc.1")
213213
instance.send(:add_react_on_rails_package)
214+
expect(mock_manager).to have_received(:add).with(["[email protected]"], exact: true)
215+
end
216+
217+
it "adds react-on-rails with version for beta pre-releases" do
218+
stub_const("ReactOnRails::VERSION", "16.2.0-beta.10")
219+
instance.send(:add_react_on_rails_package)
220+
expect(mock_manager).to have_received(:add).with(["[email protected]"], exact: true)
221+
end
222+
223+
it "adds react-on-rails with version for alpha releases" do
224+
stub_const("ReactOnRails::VERSION", "16.0.0-alpha.5")
225+
instance.send(:add_react_on_rails_package)
226+
expect(mock_manager).to have_received(:add).with(["[email protected]"], exact: true)
227+
end
228+
229+
it "adds react-on-rails without version for invalid version formats" do
230+
stub_const("ReactOnRails::VERSION", "invalid-version")
231+
instance.send(:add_react_on_rails_package)
214232
expect(mock_manager).to have_received(:add).with(["react-on-rails"], exact: true)
215233
end
216234

235+
it "warns about invalid version format when version doesn't match semver" do
236+
stub_const("ReactOnRails::VERSION", "invalid-version")
237+
238+
# Capture stdout to verify the warning message
239+
expect do
240+
instance.send(:add_react_on_rails_package)
241+
end.to output(/WARNING: Unrecognized version format invalid-version/).to_stdout
242+
end
243+
217244
it "adds warning when add_package fails" do
218245
allow(mock_manager).to receive(:add).and_return(false)
219246
instance.package_json = nil

0 commit comments

Comments
 (0)