Sha256: c0eeaa2188b23b3ae36c5ff73cd80ff2fb8cd8a2abeb83fc48fe1a80c159a000

Contents?: true

Size: 1.62 KB

Versions: 36

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe "Sunrise Manager Edit 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 "update" do
      before(:each) do
        visit edit_path(:model_name => "posts", :id => @post.id, :parent_id => @page.id, :parent_type => @page.class.name)
        
        #save_and_open_page
        
        fill_in "post[title]", :with => "Title updated"
        fill_in "post[content]", :with => "Tra la la"
        uncheck('post[is_visible]')
        
        click_button "submit-button-hidden"
      end
      
      it "should update an object with correct attributes" do
        @post.reload
        
        @post.title.should == "Title updated"
        @post.content.should == "Tra la la"
        @post.structure.should == @page
        @post.is_visible.should == false
      end
      
      it "should redirect with association params" do
        page.current_path.should == "/manage/posts"
        page.current_url.should == "http://www.example.com/manage/posts?parent_id=#{@page.id}&parent_type=#{@page.class.name}"
      end
    end
  end
  
  describe "anonymous user" do
    before(:each) do
      visit edit_path(:model_name => "posts", :id => @post.id, :parent_id => @page.id, :parent_type => @page.class.name)
    end
    
    it "should redirect to login page" do
      should have_content('Sign in')
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
sunrise-cms-1.0.6 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.5 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.4 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.3 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.2 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.1 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.0 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.0.rc3 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.0.rc2 spec/requests/manager/many/update_spec.rb
sunrise-cms-1.0.0.rc1 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.7.0.rc2 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.7.0.rc1 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.11 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.10 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.9 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.8 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.7 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.6 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.5 spec/requests/manager/many/update_spec.rb
sunrise-cms-0.6.4 spec/requests/manager/many/update_spec.rb