Sha256: 0fb4f442cb76d643537031566ecefcaffd5ce64e73f6708b50dfb107cd1fe238

Contents?: true

Size: 1.64 KB

Versions: 71

Compression:

Stored size: 1.64 KB

Contents

describe "Single Use Links manager", ->
  sul_manager = null
  beforeEach () ->
    loadFixtures('sul_table.html')
    sul_manager = $.fn.singleUseLinks()
    jasmine.Ajax.install()
  afterEach () ->
    jasmine.Ajax.uninstall()  

  describe "#reload_table", ->
    request = null

    it "replaces the table's content with html data", ->
      jasmine.Ajax.stubRequest('/single_use_link/generated/fs-id').andReturn({
        "status": 200, 
        "contentType": 'text/plain',
        "responseText": 'updated table contents'
      });

      sul_manager.reload_table()
      request = jasmine.Ajax.requests.mostRecent()
      expect(request.responseText).toEqual("updated table contents")

  describe "#create_link", ->
    request = null

    it "requests a new link", ->
      jasmine.Ajax.stubRequest('/single_use_link/generate/fs-id').andReturn({
        "status": 200, 
        "contentType": 'text/plain',
        "responseText": 'created a link'
      });

      sul_manager.create_link($('.generate-single-use-link'))
      request = jasmine.Ajax.requests.mostRecent()
      expect(request.responseText).toEqual("created a link")

  describe "#delete_link", ->
    request = null

    it "removes the link from the table", ->
      jasmine.Ajax.stubRequest('/single_use_link/fs-id/delete/key').andReturn({
        "status": 200, 
        "contentType": 'text/plain',
        "responseText": 'deleted a link'
      });

      sul_manager.delete_link($('.delete-single-use-link'))
      request = jasmine.Ajax.requests.mostRecent()
      expect(request.responseText).toEqual("deleted a link")
      expect($("table.single-use-links tbody").html).not.toContain("<tr>")

Version data entries

71 entries across 71 versions & 3 rubygems

Version Path
hyrax-2.1.0 spec/javascripts/single_use_links_spec.coffee
hyrax-2.1.0.rc4 spec/javascripts/single_use_links_spec.coffee
hyrax-2.1.0.rc3 spec/javascripts/single_use_links_spec.coffee
hyrax-2.1.0.rc2 spec/javascripts/single_use_links_spec.coffee
hyrax-2.1.0.rc1 spec/javascripts/single_use_links_spec.coffee
hyrax-1.1.0 spec/javascripts/single_use_links_spec.coffee
hyrax-2.1.0.beta2 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.2 spec/javascripts/single_use_links_spec.coffee
hyrax-2.1.0.beta1 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.1 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0.rc3 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0.rc2 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0.rc1 spec/javascripts/single_use_links_spec.coffee
hyrax-1.0.5 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0.beta5 spec/javascripts/single_use_links_spec.coffee
curation_concerns-1.7.8 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0.beta4 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0.beta3 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.0.beta2 spec/javascripts/single_use_links_spec.coffee