Sha256: b32a4394bb8fbb8ea459c0c9607bdca4c5c7b43d870611ad329d283b1f8f684d

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

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

class HelpersTest < Test::Unit::TestCase
  include StaticMatic::Helpers
  
  def setup
    @staticmatic = StaticMatic::Base.new(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{src="/javascripts/test.js"}
    assert_match expected_output, javascripts('test')
  end
  
  # Soon...
  def test_should_include_partial_template
    expected_output = "My Menu"
    assert_match expected_output, partial("menu")
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
staticmatic-0.8.8 test/helpers_test.rb
staticmatic-0.8.9 test/helpers_test.rb