Sha256: 86a4fc2c641a9f37e44a7a6894dc8e203da884118a80e8c769ae6f743cf91a22

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

describe "Sunrise Manager Index many" do
  subject { page }
  before(:all) do 
    @admin = FactoryGirl.create(:admin_user)
    
    @root = FactoryGirl.create(:structure_main)
    @page = FactoryGirl.create(:structure_page, :parent => @root)
    
    @post = FactoryGirl.create(:post, :structure => @page)
  end

  context "admin" do
    before(:each) { login_as @admin }

    describe "GET /manage/posts" do
      before(:each) do 
        visit index_path(:model_name => "posts", :parent_id => @page.id, :parent_type => @page.class.name)
      end
      
      it "should render records" do
        should have_selector("#post_#{@post.id}")
      end
    end
    
    describe "search" do
      before(:each) do
        @post2 = FactoryGirl.create(:post, :title => "Good day", :structure => @page)
        
        visit index_path(:model_name => "posts", :parent_id => @page.id, :parent_type => @page.class.name)

        fill_in "search[title]", :with => "Good day"

        click_button "submit-button-search"
      end
      
      it "should find post" do
        should have_selector("#post_#{@post2.id}")
        should_not have_selector("#post_#{@post.id}")
      end
    end
    
    describe "GET /manage/posts" do
      before(:each) do 
        visit index_path(:model_name => "posts", :parent_id => @root.id, :parent_type => @root.class.name)
      end
      
      it "should not render records" do
        should_not have_selector("#post_#{@post.id}")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sunrise-cms-1.0.6 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.5 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.4 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.3 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.2 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.1 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.0 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.0.rc3 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.0.rc2 spec/requests/manager/many/index_spec.rb
sunrise-cms-1.0.0.rc1 spec/requests/manager/many/index_spec.rb