Sha256: 50b5d5b7831ffcc10e8dd6ac3e22993bdd5915b5bb969f21680d9d57eb2a06b3

Contents?: true

Size: 1.72 KB

Versions: 31

Compression:

Stored size: 1.72 KB

Contents

require File.dirname(__FILE__) + '/helper'
require File.dirname(__FILE__) + '/fixtures/render_app/app'

class TestRenderHelpers < Test::Unit::TestCase
  def app
    RenderDemo.tap { |app| app.set :environment, :test }
  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
    should "have no counter index for single item" do
      assert_have_no_selector "p", :content => "My counter is 1", :count => 1
    end
    should "include extra locals information" do
      assert_have_selector 'p', :content => "Extra is bar"
    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
    should "include counter which contains item index" do
      assert_have_selector "p", :content => "My counter is 1"
      assert_have_selector "p", :content => "My counter is 2"
    end
    should "include extra locals information" do
      assert_have_selector 'p', :content => "Extra is bar"
    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
    should "have no counter index for single item" do
      assert_have_no_selector "p", :content => "My counter is 1", :count => 1
    end
    should "include extra locals information" do
      assert_have_selector 'p', :content => "Extra is bar"
    end
  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
padrino-helpers-0.9.7 test/test_render_helpers.rb
padrino-helpers-0.9.6 test/test_render_helpers.rb
padrino-helpers-0.9.5 test/test_render_helpers.rb
padrino-helpers-0.9.4 test/test_render_helpers.rb
padrino-helpers-0.9.3 test/test_render_helpers.rb
padrino-helpers-0.9.2 test/test_render_helpers.rb
padrino-helpers-0.9.1 test/test_render_helpers.rb
padrino-helpers-0.9.0 test/test_render_helpers.rb
padrino-helpers-0.8.5 test/test_render_helpers.rb
padrino-helpers-0.8.4 test/test_render_helpers.rb
padrino-helpers-0.8.3 test/test_render_helpers.rb
padrino-helpers-0.8.2 test/test_render_helpers.rb
padrino-helpers-0.8.1 test/test_render_helpers.rb
padrino-helpers-0.8.0 test/test_render_helpers.rb
padrino-helpers-0.7.9 test/test_render_helpers.rb
padrino-helpers-0.7.8 test/test_render_helpers.rb
padrino-helpers-0.7.7 test/test_render_helpers.rb
padrino-helpers-0.7.6 test/test_render_helpers.rb
padrino-helpers-0.7.5 test/test_render_helpers.rb
padrino-helpers-0.7.4 test/test_render_helpers.rb