Sha256: f58fbf57b8446470bda355b9e28e207e4a8fd4af55f3057c2739a801bdd0f5d3

Contents?: true

Size: 1.86 KB

Versions: 29

Compression:

Stored size: 1.86 KB

Contents

require File.expand_path('../test_helper', File.dirname(__FILE__))

class RenderCmsTest < ActionDispatch::IntegrationTest
  
  def setup
    Rails.application.routes.draw do
      get '/render-implicit'  => 'render_test#implicit'
      get '/render-explicit'  => 'render_test#explicit'
      get '/render-text'      => 'render_test#render_text'
      get '/render-update'    => 'render_test#render_update'
    end
    super
  end
  
  def teardown
    load(File.expand_path('config/routes.rb', Rails.root))
  end
  
  class ::RenderTestController < ApplicationController
    def implicit
      render
    end
    def explicit
      render :cms_page => '/render-explicit-page'
    end
    def render_text
      render :text => 'rendered text'
    end
    def render_update
      render :update do |page|
        page.alert('rendered text')
      end
    end
  end
  
  def test_get_with_no_template
    assert_exception_raised ActionView::MissingTemplate do
      get '/render-implicit'
    end
  end
  
  def test_get_with_implicit_cms_template
    page = cms_pages(:child)
    page.slug = 'render-implicit'
    page.save!
    get '/render-implicit'
    assert_response :success
  end
  
  def test_get_with_explicit_cms_template
    page = cms_pages(:child)
    page.slug = 'render-explicit-page'
    page.save!
    get '/render-explicit'
    assert_response :success
  end
  
  def test_get_with_explicit_cms_template_failure
    page = cms_pages(:child)
    page.slug = 'render-explicit-404'
    page.save!
    assert_exception_raised ComfortableMexicanSofa::MissingPage do
      get '/render-explicit'
    end
  end
  
  def test_get_render_text
    get '/render-text'
    assert_response :success
  end
  
  def test_get_render_update
    return 'Not supported >= 3.1' if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1
    get '/render-update'
    assert_response :success
  end
  
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.4.16 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.15 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.14 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.13 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.12 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.11 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.10 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.9 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.8 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.7 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.6 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.5 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.4 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.3 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.2 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.1 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.4.0 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.3.8 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.3.7 test/integration/render_cms_test.rb
comfortable_mexican_sofa-1.3.6 test/integration/render_cms_test.rb