Sha256: dc40657cd14825949ab47af188e845c59d6d23aeae90e34a5081f34844912bb1

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

require File.expand_path('../../../../helper', __FILE__)

describe 'Recent Entries widget' do
  behaves_like :capybara
  enable_javascript

  status_id = Sections::Model::SectionEntryStatus[:name => 'published'].id
  user_id   = Users::Model::User[:email => 'spec@domain.tld'].id
  entries   = []
  section   = Sections::Model::Section.create(
    :name                    => 'Spec section',
    :comment_allow           => false,
    :comment_require_account => false,
    :comment_moderate        => false,
    :comment_format          => 'markdown'
  )

  10.times do |t|
    entries << Sections::Model::SectionEntry.create(
      :title                   => "Spec entry #{t}",
      :user_id                 => user_id,
      :section_entry_status_id => status_id,
      :section_id              => section.id
    )
  end

  it 'Show a widget containing the 10 most recent entries' do
    visit(Dashboard::Controller::Dashboard.r(:index).to_s)

    check('toggle_widget_recent_entries')

    page.has_content?(lang('section_entries.widgets.titles.recent_entries')) \
      .should == true

    page.has_selector?('#widget_recent_entries').should      == true
    page.has_content?('Spec entry 1').should                 == true
    page.all('#widget_recent_entries tbody tr').count.should == 10
  end

  entries.reverse.each { |e| e.destroy }
  section.destroy

  disable_javascript
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zen-0.4.3 spec/zen/package/sections/widget.rb
zen-0.4.2 spec/zen/package/sections/widget.rb
zen-0.4.1 spec/zen/package/sections/widget.rb
zen-0.4 spec/zen/package/sections/widget.rb