Sha256: b21606454b9174479cdc7276028200c88da9622aca9f08456f0f49b95a2db2a1

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

require 'helper'
require 'fixtures/render_app/app'

class TestRenderPlugin < Test::Unit::TestCase
  def app
    RenderDemo.tap { |app| app.set :environment, :test }
  end

  context 'for #haml_template method' do
    setup { visit '/render_haml' }
    should('render template properly') do
      assert_have_selector "h1", :content => "This is a haml template!"
    end
  end

  context 'for #erb_template method' do
    setup { visit '/render_erb' }
    should('render template properly') do
      assert_have_selector "h1", :content => "This is a erb template!"
    end
  end
  
  context 'for #render_template method with explicit engine' do
    setup { visit '/render_template/haml' }
    should('render template properly') do
      assert_have_selector "h1", :content => "This is a haml template sent from render_template!"
    end
  end
  
  context 'for #render_template method without explicit engine' do
    setup { visit '/render_template' }
    should('render template properly') do
      assert_have_selector "h1", :content => "This is a haml template which was detected!"
    end
  end
  
  context 'for #partial method and object' do
    setup { visit '/partial/object' }
    should "render partial html with object" do
      assert_have_selector "h1", :content => "User name is John"
    end
  end
  
  context 'for #partial method and collection' do
    setup { visit '/partial/collection' }
    should "render partial html with collection" do
      assert_have_selector "h1", :content => "User name is John"
      assert_have_selector "h1", :content => "User name is Billy"
    end
  end
  
  context 'for #partial method and locals' do
    setup { visit '/partial/locals' }
    should "render partial html with locals" do
      assert_have_selector "h1", :content => "User name is John"
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra_more-0.1.0 test/test_render_plugin.rb