Sha256: a251c7602ba5770d4f878809ca8afe573ccd252850a2491218a2b049698066bd

Contents?: true

Size: 1.06 KB

Versions: 6

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_files_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

6 entries across 6 versions & 1 rubygems

Version Path
sufia-4.0.1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-4.0.0 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-4.0.0.rc2 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-4.0.0.rc1 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-4.0.0.beta4 spec/lib/sufia/upload_complete_behavior_spec.rb
sufia-4.0.0.beta3 spec/lib/sufia/upload_complete_behavior_spec.rb