Sha256: 0e0cf4f53759eba75f1df34324899a82479ceea3ef40902546b3c26d72abeb1a

Contents?: true

Size: 1.38 KB

Versions: 5

Compression:

Stored size: 1.38 KB

Contents

require 'test/unit'
require File.dirname(__FILE__) + '/../lib/staticmatic'

class HelpersTest < Test::Unit::TestCase
  include Haml::Helpers
  
  # Provide method in place of local variable for the helpers - don'tcha just love ruby?
  def base_dir
    File.dirname(__FILE__) + '/sandbox/test_site'
  end
  
  def test_should_generate_stylesheet_links
    assert_match "href=\"stylesheets\/application.css\"", stylesheets
  end
  
  def test_should_autolink_page
    expected_output = %q{<a href="test.html">Test</a>}
    assert_match expected_output, link("Test")
  end
  
  def test_should_generate_tag_with_block
    expected_output = %q{<a href="test.html" title="My Test Link">Test</a>}
    assert_match expected_output, tag(:a, :href => "test.html", :title => 'My Test Link') { "Test" }
  end
  
  def test_should_generate_tag
    expected_output = %q{<br/>}
    assert_match expected_output, tag(:br)
  end
  
  def test_should_urlify_string
    assert_equal "stephens_haml_and_sass_project", urlify("Stephen's Haml & Sass Project")
  end
  
  def test_should_generate_input
    expected_output = %q{<input type="text" value="blah" name="test"/>}
    assert_match expected_output, text_field("test", "blah")
  end
  
  def test_should_generate_js_links
    expected_output = %q{<script src="javascripts/test.js" language="javascript"></script>}
    assert_match expected_output, javascripts('test')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
staticmatic-0.1.1 test/helpers_test.rb
staticmatic-0.1.0 test/helpers_test.rb
staticmatic-0.2.1 test/helpers_test.rb
staticmatic-0.2.0 test/helpers_test.rb
staticmatic-0.3.0 test/helpers_test.rb