Sha256: 92ad78129e3a887103d0d71455644f58b4c4586e14afe86fdc45b8269e015ac2

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe PartialsController do
  render_views

  describe 'supported partial types' do
    after :each do
      response.should be_success
    end

    it 'allows to use ERB partials' do
      get :erb_section
      response.body.strip.should == 'ERB partial content'
    end

    it 'allows to use HAML partials' do
      get :haml_section
      response.body.strip.should == 'HAML partial content'
    end
  end

  context 'no partial options given' do
    it 'renders the default partial' do
      get :no_options
      response.body.strip.should == 'default partial content'
    end
  end

  context 'providing a custom partial name' do
    before :each do
      get :custom_partial
    end

    it 'renders the given partial' do
      response.body.should include 'custom partial content'
    end

    it "doesn't render the default partial" do
      response.body.should_not include 'default partial content'
    end
  end

  context 'disabling partials for a section' do
    before :each do
      get :disabled
    end

    it "doesn't render the partial tag" do
      response.body.strip.should_not include '<div class="disabled">'
    end

    it "doesn't render the partial" do
      response.body.strip.should_not include 'disabled partial content'
    end
  end

  context 'production mode' do

    before :each do
      Rails.env = 'production'
    end

    after :each do
      Rails.env = 'test'
    end

    it 'renders partials normally' do
      get :production_mode
      response.body.strip.should include 'partial content'
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sections_rails-0.6.12 spec/controllers/partials_controller_spec.rb
sections_rails-0.6.11 spec/controllers/partials_controller_spec.rb