Permalink
Browse files

Refactor to yank a version directly rather than through its gem

  • Loading branch information...
1 parent 62fd59c commit 7a558288db3a317a6961c2f636aa787da876cf6e @laserlemon laserlemon committed Oct 10, 2012
@@ -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
@@ -223,10 +223,6 @@ def reorder_versions
end
end
- def yank!(version)
- version.yank!
- end
-
def disown
ownerships.each(&:delete)
end
@@ -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 }
@@ -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?

0 comments on commit 7a55828

Please sign in to comment.