Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor to yank a version directly rather than through its gem

  • Loading branch information...
commit 7a558288db3a317a6961c2f636aa787da876cf6e 1 parent 62fd59c
@laserlemon laserlemon authored
View
2  app/controllers/api/v1/rubygems_controller.rb
@@ -30,7 +30,7 @@ def create
def yank
if @version.indexed?
- @rubygem.yank!(@version)
+ @version.yank!
render :text => "Successfully yanked gem: #{@version.to_title}"
else
render :text => "The version #{params[:version]} has already been yanked.", :status => :unprocessable_entity
View
4 app/models/rubygem.rb
@@ -223,10 +223,6 @@ def reorder_versions
end
end
- def yank!(version)
- version.yank!
- end
-
def disown
ownerships.each(&:delete)
end
View
2  test/functional/rubygems_controller_test.rb
@@ -315,7 +315,7 @@ class RubygemsControllerTest < ActionController::TestCase
setup do
version = create(:version, :created_at => 1.minute.ago)
@rubygem = version.rubygem
- @rubygem.yank!(version)
+ version.yank!
end
context 'when signed out' do
setup { get :show, :id => @rubygem.to_param }
View
4 test/unit/rubygem_test.rb
@@ -369,7 +369,7 @@ class RubygemTest < ActiveSupport::TestCase
context "when yanking the last version of a gem with an owner" do
setup do
- @rubygem_with_version.yank!(@rubygem_with_version.versions.first)
+ @rubygem_with_version.versions.first.yank!
end
should "still be owned" do
@@ -383,7 +383,7 @@ class RubygemTest < ActiveSupport::TestCase
context "when yanking one of many versions of a gem" do
setup do
- @rubygem_with_versions.yank!(@rubygem_with_versions.versions.first)
+ @rubygem_with_versions.versions.first.yank!
end
should "remain owned" do
assert !@rubygem_with_versions.reload.unowned?
Please sign in to comment.
Something went wrong with that request. Please try again.