Sha256: 7c911f57c667e0df2147ab82b2939c9cc6ac4b586a89ac2f71f84568fc34b495

Contents?: true

Size: 1.71 KB

Versions: 16

Compression:

Stored size: 1.71 KB

Contents

describe 'Integration: Press Assets', ->
  before ->
    authenticateSession()
    stubAjax 'GET', '/api/press_assets', 200, FIXTURES.press_assets()

  after ->
    $.mockjaxClear()
    Dashboard.reset()

  it 'has press_assets link on sidebar', ->
    expect(1)
    visit '/'
    andThen ->
      equal(find(".sidebar-menu a:contains('Press Assets')").length, 1)

  it 'has page title in the content header', ->
    expect(1)

    visit '/press_assets'
    andThen ->
      equal find('.content-header h1').text(), 'Press Assets'

  it 'list the press_assets', ->
    expect(1)

    visit '/press_assets'
    andThen ->
      equal find('table tbody tr').length, 2

  describe 'pagination', ->
    before ->
      sinon.spy(jQuery, 'ajax')

    after ->
      jQuery.ajax.restore()

    context 'When clicked on the page number', ->
      it 'fetch new data filtering by page', ->
        expect(2)

        visit '/press_assets'
        andThen ->
          equal find('ul.pagination li').length, 11

        andThen ->
          click('ul.pagination li:eq(3) a')
          ok(jQuery.ajax.calledWithMatch({ url: '/api/press_assets', data: { page: 3 } }))

    context 'When clicked on previous page', ->
      it 'fetch new data filtering by page', ->
        expect(1)

        visit '/press_assets'
        andThen ->
          click('ul.pagination li:first a')
          ok(jQuery.ajax.calledWithMatch({ url: '/api/press_assets', data: { page: 2 } }))

    context 'When clicked on next page', ->
      it 'fetch new data filtering by page', ->
        expect(1)

        visit '/press_assets'
        andThen ->
          click('ul.pagination li:last a')
          ok(jQuery.ajax.calledWithMatch({ url: '/api/press_assets', data: { page: 4 } }))

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dune-dashboard-1.1.5 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.1.4 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.1.3 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.1.2 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.1.1 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.1.0 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.9 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.8 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.7 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.6 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.5 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.4 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.3 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.2 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.1 spec/javascripts/integration/press_assets_spec.coffee
dune-dashboard-1.0.0 spec/javascripts/integration/press_assets_spec.coffee