Sha256: 5e9584d5e7503302d4004f1f2f5a2e1bdd5b7e39841d11b101ea49a957b4d3a2

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 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_generate_stylesheet_links_with_relative_path
    assert_match "href=\"stylesheets\/application.css\"", stylesheets(:relative => true)
  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

3 entries across 3 versions & 1 rubygems

Version Path
staticmatic-0.8.5 test/helpers_test.rb
staticmatic-0.8.6 test/helpers_test.rb
staticmatic-0.8.4 test/helpers_test.rb