Sha256: b3004a0840ec3a3ec1acb4a8dbbb0427a161a1a89e0af60a632de35d2a5276f8

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

require "spec_helper"
class UploadThing
  extend Sufia::FilesController::UploadCompleteBehavior
end

class UploadThingRedefine
  extend Sufia::FilesController::UploadCompleteBehavior
  def self.upload_complete_path(id)
    return "example.com"
  end

  def self.destroy_complete_path(id)
    return "destroy.com"
  end

end

describe Sufia::FilesController::UploadCompleteBehavior do
  let (:test_id) {"123abc"}
  context "Not overridden" do
    it "respond with the batch edit path" do
      UploadThing.upload_complete_path(test_id).should == Sufia::Engine.routes.url_helpers.batch_edit_path(test_id)
    end
    it "respond with the dashboard path" do
      UploadThing.destroy_complete_path({}).should ==   Sufia::Engine.routes.url_helpers.dashboard_index_path
    end
  end
  context "overriden path" do
    it "respond with the batch edit path" do
      UploadThingRedefine.upload_complete_path(test_id).should == "example.com"
    end
    it "respond with the batch edit path" do
      UploadThingRedefine.destroy_complete_path(test_id).should == "destroy.com"
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sufia-4.0.0.beta2 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-4.0.0.beta1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.7.2 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.7.1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.7.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.6.1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.6.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.5.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.4.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.4.0.rc4 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.4.0.rc3 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.3.1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.4.0.rc2 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.4.0.rc1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.3.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.2.1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-3.1.3 spec/lib/sufia/upload_complete_behavior_spec.rb