drnic / newjs

newjs - create new JavaScript libraries

This URL has Read+Write access

newjs / test / test_plain_theme_generator.rb
100644 38 lines (30 sloc) 0.983 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
 
class TestPlainThemeGenerator < Test::Unit::TestCase
  include RubiGen::GeneratorTestHelper
 
  def setup
    bare_setup
  end
  
  def teardown
    bare_teardown
  end
  
  def test_generator_without_options
    run_generator('plain_theme', [], sources)
    %w[template.html.erb stylesheets/screen.css javascripts/rounded_corners_lite.inc.js].each do |file|
      assert_generated_file("website/#{file}")
    end
  end
  
  def test_generator_with_author_and_email
    run_generator('plain_theme', [], sources, {:author => "AUTHOR", :email => "EMAIL"})
    %w[template.html.erb stylesheets/screen.css javascripts/rounded_corners_lite.inc.js].each do |file|
      assert_generated_file("website/#{file}")
    end
  end
  
  private
  def sources
    [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
    ]
  end
  
  def generator_path
    "newjs_theme_generators"
  end
end