-
-
Notifications
You must be signed in to change notification settings - Fork 932
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don’t allow publishing new versions of an archived gem
- Loading branch information
1 parent
28e0b41
commit b41ec50
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ class PusherTest < ActiveSupport::TestCase | |
@cutter.stubs(:authorize).returns true | ||
@cutter.stubs(:verify_mfa_requirement).returns true | ||
@cutter.stubs(:verify_gem_scope).returns true | ||
@cutter.stubs(:verify_not_archived).returns true | ||
@cutter.stubs(:validate).returns true | ||
@cutter.stubs(:save) | ||
|
||
|
@@ -104,6 +105,7 @@ class PusherTest < ActiveSupport::TestCase | |
@cutter.stubs(:authorize).returns true | ||
@cutter.stubs(:verify_gem_scope).returns true | ||
@cutter.stubs(:verify_mfa_requirement).returns false | ||
@cutter.stubs(:verify_not_archived).returns true | ||
@cutter.stubs(:validate).never | ||
@cutter.stubs(:save).never | ||
|
||
|
@@ -116,6 +118,7 @@ class PusherTest < ActiveSupport::TestCase | |
@cutter.stubs(:authorize).returns true | ||
@cutter.stubs(:verify_gem_scope).returns true | ||
@cutter.stubs(:verify_mfa_requirement).returns true | ||
@cutter.stubs(:verify_not_archived).returns true | ||
@cutter.stubs(:validate).returns false | ||
@cutter.stubs(:save).never | ||
|
||
|
@@ -844,4 +847,21 @@ def two_cert_chain(signing_key:, root_not_before: Time.current, cert_not_before: | |
RubygemFs.mock! | ||
end | ||
end | ||
|
||
context "the gem has been archived" do | ||
setup do | ||
@rubygem = create(:rubygem, :archived, name: "test") | ||
|
||
Gem::Specification.any_instance.stubs(:authors).returns(["[email protected]"]) | ||
|
||
@gem = gem_file("test-1.0.0.gem") | ||
@cutter = Pusher.new(@api_key, @gem) | ||
end | ||
|
||
should "not not process the gem" do | ||
refute @cutter.process | ||
assert_equal "This gem has been archived, and is in a read-only state.", @cutter.message | ||
assert_equal 401, @cutter.code | ||
end | ||
end | ||
end |