Skip to content

Commit

Permalink
some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bfontaine committed Feb 2, 2014
1 parent 7fb6cb4 commit a30836c
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,47 @@ def test_pouf_version
assert(Pouf.version =~ /^\d+\.\d+\.\d+/)
end

# == Pouf#play_cmd == #

def test_pouf_play_cmd_env_no_spaces
s = 'some_random_command'
ENV['POUF_CMD'] = s
assert_equal([s], Pouf.play_cmd)
end

def test_pouf_play_cmd_env_with_spaces
s = 'some random command'
ENV['POUF_CMD'] = s
assert_equal(%w[some random command], Pouf.play_cmd)
end

# == Pouf#filename2alias == #

def test_pouf_filename2alias_empty
assert_nil(Pouf.filename2alias(''))
end

def test_pouf_filename2alias_no_path
n = 'foobar'
assert_equal(n, Pouf.filename2alias("#{n}.ext"))
end

def test_pouf_filename2alias_with_dirs
n = 'foobar'
assert_equal(n, Pouf.filename2alias("foo/bar/#{n}.ext"))
end

def test_pouf_filename2alias_absolute_path
n = 'foobar'
assert_equal(n, Pouf.filename2alias("/foo/bar/#{n}.ext"))
end

def test_pouf_filename2alias_relative_path
n = 'foobar'
assert_equal(n, Pouf.filename2alias("../bar/#{n}.ext"))
assert_equal(n, Pouf.filename2alias("./bar/#{n}.ext"))
end

end


Expand Down

0 comments on commit a30836c

Please sign in to comment.