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.6.0 spec/javascripts/single_use_links_spec.coffee
hyrax-3.0.0.pre.rc1 spec/javascripts/single_use_links_spec.coffee
hyrax-3.0.0.pre.beta3 spec/javascripts/single_use_links_spec.coffee
hyrax-2.5.1 spec/javascripts/single_use_links_spec.coffee
hyrax-2.5.0 spec/javascripts/single_use_links_spec.coffee
hyrax-3.0.0.pre.beta2 spec/javascripts/single_use_links_spec.coffee
hyrax-2.4.1 spec/javascripts/single_use_links_spec.coffee
hyrax-3.0.0.pre.beta1 spec/javascripts/single_use_links_spec.coffee
hyrax-2.4.0 spec/javascripts/single_use_links_spec.coffee
hyrax-2.3.3 spec/javascripts/single_use_links_spec.coffee
hyrax-2.3.2 spec/javascripts/single_use_links_spec.coffee
hyrax-2.3.1 spec/javascripts/single_use_links_spec.coffee
hyrax-1.1.1 spec/javascripts/single_use_links_spec.coffee
hyrax-2.3.0 spec/javascripts/single_use_links_spec.coffee
hyrax-2.0.3 spec/javascripts/single_use_links_spec.coffee
hyrax-2.2.4 spec/javascripts/single_use_links_spec.coffee
hyrax-2.2.3 spec/javascripts/single_use_links_spec.coffee
hyrax-2.2.2 spec/javascripts/single_use_links_spec.coffee
hyrax-2.2.1 spec/javascripts/single_use_links_spec.coffee
hyrax-2.2.0 spec/javascripts/single_use_links_spec.coffee