Sha256: 98a9802e453c3b51574f86fb77091570e93eaf03ed1f240a0576ab2eec1f5b30

Contents?: true

Size: 1.8 KB

Versions: 22

Compression:

Stored size: 1.8 KB

Contents

require 'spec_helper'

describe Kuhsaft::Cms::PagesController do
  render_views

  describe 'should render successfully' do
    before :all do
      # create page with ID=1 if none exists
      Factory.create :page
    end
    
    it '#index' do
      get :index, :locale => :en
      response.should be_success
    end
    
    it '#show' do
      get :show, :id => 1, :locale => :en
      response.should be_success
    end
    
    it '#new' do
      get :new, :locale => :en
      response.should be_success
    end
    
    it '#edit' do
      get :edit, :id => 1, :locale => :en
      response.should be_success
    end
    
    it '#create' do
      # TODO: this is ridiculous. We need to have integration tests(?) for this.
      params = { :kuhsaft_page => { :localized_pages_attributes => { 0 => { :title => 'hi', :locale => :en }}}, :locale => :en }
      post :create, params
      response.should be_redirect
    end
    
    it '#update' do
      # TODO: this is EXTREMELY ridiculous. We need to have integration tests(?) for this.
      page = Kuhsaft::Page.first
      localized_page = page.translation
      params = { 
              :id => page.id, 
              :kuhsaft_page => {
                :localized_pages_attributes => { 
                  0 => {
                    :slug => "hi",
                    :title => "Hi",
                    :id => localized_page.id,
                    :description => '',
                    :locale => 'en',
                    :page_parts_attributes => {
                      0 => {
                        :text => 'some text',
                        :type => 'Kuhsaft::PagePart::Markdown'
                      }
                    }
                  }
                }}, :locale => :en }
      post :update, params
      response.should be_redirect
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kuhsaft-0.2.legacy4 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.4.legacy3 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.2.legacy3 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.2.legacy2 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.2.legacy spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.4.legacy2 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.4.legacy spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.6 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.5 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.4 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.4.rc2 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.4.rc1 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.3 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.2 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.2.5 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.2.4 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.2.3 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.1 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.3.0 spec/controllers/cms_pages_controller_spec.rb
kuhsaft-0.2.2 spec/controllers/cms_pages_controller_spec.rb