summaryrefslogtreecommitdiff
path: root/test/cli_test.rb
blob: 6c43e2ce60fb53f02985cb0207b5fc218b684d47 (plain)
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
require 'test_helper'
silent{ load 'bin/dashing' }

module Thor::Actions
  def source_paths
    [File.join(File.expand_path(File.dirname(__FILE__)), '../templates')]
  end
end

class CliTest < Dashing::Test

  def test_project_directory_created
    temp do |dir|
      cli = Dashing::CLI.new
      silent{ cli.new 'Dashboard' }
      assert Dir.exist?(File.join(dir,'dashboard')), 'Dashing directory was not created.'
    end
  end

  def test_hyphenate
    assert_equal 'power', Dashing::CLI.hyphenate('Power')
    assert_equal 'power', Dashing::CLI.hyphenate('POWER')
    assert_equal 'power-rangers', Dashing::CLI.hyphenate('PowerRangers')
    assert_equal 'power-ranger', Dashing::CLI.hyphenate('Power_ranger')
    assert_equal 'super-power-rangers', Dashing::CLI.hyphenate('SuperPowerRangers')
  end

end