Sha256: cc8c98ba17959ad80e72096d87098b835078439f8f2b4c5bef22dec815d1cb01

Contents?: true

Size: 1.71 KB

Versions: 20

Compression:

Stored size: 1.71 KB

Contents

require 'helper'
require 'fixtures/markup_app/app'

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

  context 'for #capture_html method' do
    should "work for erb templates" do
      visit '/erb/capture_concat'
      assert_have_selector 'p span', :content => "Captured Line 1"
      assert_have_selector 'p span', :content => "Captured Line 2"
    end

    should "work for haml templates" do
      visit '/haml/capture_concat'
      assert_have_selector 'p span', :content => "Captured Line 1"
      assert_have_selector 'p span', :content => "Captured Line 2"
    end
  end

  context 'for #concat_content method' do
    should "work for erb templates" do
      visit '/erb/capture_concat'
      assert_have_selector 'p', :content => "Concat Line 3", :count => 1
    end

    should "work for haml templates" do
      visit '/haml/capture_concat'
      assert_have_selector 'p', :content => "Concat Line 3", :count => 1
    end
  end

  context 'for #block_is_template?' do
    should "work for erb templates" do
      visit '/erb/capture_concat'
      assert_have_selector 'p', :content => "The erb block passed in is a template", :class => 'is_template'
      # TODO Get ERB template detection working (fix block_is_erb? method)
      # assert_have_no_selector 'p', :content => "The ruby block passed in is a template", :class => 'is_template'
    end

    should "work for haml templates" do
      visit '/haml/capture_concat'
      assert_have_selector 'p', :content => "The haml block passed in is a template", :class => 'is_template'
      assert_have_no_selector 'p', :content => "The ruby block passed in is a template", :class => 'is_template'
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
sinatra_more-0.3.7 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.3.6 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.3.5 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.3.4 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.3.3 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.3.2 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.3.1 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.3.0 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.9 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.8 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.7 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.5 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.4 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.3 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.2 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.1 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.2.0 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.1.10 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.1.9 test/markup_plugin/test_output_helpers.rb
sinatra_more-0.1.8 test/markup_plugin/test_output_helpers.rb