test/repl.rb in runeblog-0.0.61 vs test/repl.rb in runeblog-0.0.62
- old
+ new
@@ -6,11 +6,10 @@
class TestREPL < Minitest::Test
include RuneBlog::REPL
def setup
- Dir.chdir("/Users/Hal/Dropbox/files/blog") # temp code!!
@blog = open_blog
end
def test_001_cmd_help
out = cmd_help(nil)
@@ -35,25 +34,25 @@
end
def test_004_change_view
out = cmd_change_view(nil) # no param
assert out.is_a?(String), "Expected a string; got: #{out.inspect}"
- assert out =~ /computing/m, "Expecting 'computing' as default; got: #{out.inspect}"
+ assert out =~ /view1/m, "Expecting 'view1' as default; got: #{out.inspect}"
end
def test_005_lsd
out = cmd_list_drafts(nil)
assert out.is_a?(String), "Expected a string returned"
lines = out.split("\n").length
- assert lines >= 15, "Expecting more lines; got: #{out.inspect}"
+ assert lines >= 2, "Expecting more lines; got: #{out.inspect}"
end
def test_006_lsp
out = cmd_list_posts(nil)
assert out.is_a?(String), "Expected a string returned; got: #{out.inspect}"
lines = out.split("\n").length
- assert lines >= 20, "Expecting more lines; got: #{out.inspect}"
+ assert lines >= 2, "Expecting more lines; got: #{out.inspect}"
end
def test_007_parser
parse_tests = {
# Loading/trailing blanks as well
@@ -97,7 +96,21 @@
parse_tests.each_pair do |cmd, expected|
result = RuneBlog::REPL.choose_method(cmd)
assert result == expected, "Expected #{expected.inspect} but got #{result.inspect}"
end
end
+
+ def test_008_current_view
+ assert @blog.view == "view1", "Current view seems wrong (#{@blog.view}, not view1)"
+ end
+
+ def test_009_change_view
+ assert @blog.change_view("view2")
+ assert @blog.view == "view2", "Current view seems wrong (#{@blog.view}, not view2)"
+ end
+
+ def test_010_accessors
+ assert @blog.views.sort == ["view1", "view2"]
+ end
+
end