Sha256: 761a1a50b149bc990c7024da5a681685e96b03c6459b404b8786a1db8011abc8

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

feature "Resources index" do

  background do
    sign_in
  end

  scenario "Visit the index view of resource" do
    visit_blogs_page
    page_should_have_valid_table
  end

  scenario "Multiple pages for items with more than 30 items" do
    given_31_blog_items
    visit_blogs_page
    page.should have_css("tbody tr", :count => 30)
    click_link "Next"
    page.should have_css("tbody tr", :count => 1)
  end

  scenario "Editable paginate count" do
    given_10_per_page
    given_31_blog_items
    visit_blogs_page
    page.should have_css("tbody tr", :count => 10)
  end

  def visit_blogs_page
    click_link "Blog"
  end

  def page_should_have_valid_table
    within "#overview" do
      page.should have_content "Blogs"
      page.should have_content "Name"
      page.should have_content "Body"
      page.should have_no_content "created_at"
    end
  end

  def given_31_blog_items
    31.times { create :blog }
  end

  def given_10_per_page
    Brightcontent::BlogsController.class_eval { per_page 10 }
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brightcontent-core-2.0.33 spec/features/resources_index_spec.rb
brightcontent-core-2.0.31 spec/features/resources_index_spec.rb