Sha256: 7b7f707e709076d9a785e82fbb221db7aab0a82d19141c60d0e581fd267dd7e3

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

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

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

  def self.destroy_complete_path(_id)
    "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
      expect(UploadThing.upload_complete_path(test_id)).to eq(Sufia::Engine.routes.url_helpers.batch_edit_path(test_id))
    end
    it "respond with the dashboard path" do
      expect(UploadThing.destroy_complete_path({})).to eq(Sufia::Engine.routes.url_helpers.dashboard_files_path)
    end
  end
  context "overriden path" do
    it "respond with the batch edit path" do
      expect(UploadThingRedefine.upload_complete_path(test_id)).to eq("example.com")
    end
    it "respond with the batch edit path" do
      expect(UploadThingRedefine.destroy_complete_path(test_id)).to eq("destroy.com")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sufia-6.7.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-6.6.1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-6.6.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-6.5.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-6.4.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-6.3.0 spec/lib/sufia/upload_complete_behavior_spec.rb