test/albino_test.rb in albino-1.1.1 vs test/albino_test.rb in albino-1.2.0
- old
+ new
@@ -8,20 +8,23 @@
def setup
@syntaxer = Albino.new(File.new(__FILE__), :ruby)
end
def test_defaults_to_text
- syntaxer = Albino.new(File.new(__FILE__))
- syntaxer.expects(:execute).with('pygmentize -f html -l text').returns(true)
- syntaxer.colorize
+ syntaxer = Albino.new('abc')
+ regex = /span/
+ assert_no_match regex, syntaxer.colorize
end
def test_accepts_options
- @syntaxer.expects(:execute).with('pygmentize -f html -l ruby').returns(true)
- @syntaxer.colorize
+ assert_match /span/, @syntaxer.colorize
end
+ def test_accepts_non_alpha_options
+ assert_equal '', @syntaxer.colorize(:f => 'html+c#-dump')
+ end
+
def test_works_with_strings
syntaxer = Albino.new("class New\nend", :ruby)
assert_match %r(highlight), syntaxer.colorize
end
@@ -46,8 +49,10 @@
def test_class_method_colorize
assert_equal @syntaxer.colorize, Albino.colorize(File.new(__FILE__), :ruby)
end
def test_escaped_shell_args
- assert_equal " -f html -l \\'abc\\;\\'", @syntaxer.convert_options(:l => "'abc;'")
+ assert_raises Albino::ShellArgumentError do
+ @syntaxer.convert_options(:l => "'abc;'")
+ end
end
end
\ No newline at end of file