Sha256: 97e223d46410597cc9957d54f004ffebd3927da161ac8ed9baa52a548f086fd4

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

require 'helper'

class ConsoleTest < CheckCheckIt::TestCase
  def setup
    super
  end

  def test_lists_orgs_and_lists
    Examples.create_grocery_list(home)
    check "list"
    assert_match(/^# Checklists\n/, output)
    assert_match(/^personal\n/,     output)
    assert_match(/^  groceries\n/,  output)
  end

  def test_configurable_list_dir
    dir = File.join('/foo', 'personal')
    FileUtils.mkdir_p(dir)

    check "list --home /foo"
    assert_match(/^personal\n/,     output)
  end


  def test_default_no_notes
    console.in_stream = MiniTest::Mock.new
    console.out_stream = MiniTest::Mock.new

    9.times do
      console.out_stream.expect :puts, true, [String]
    end
    3.times do
      console.out_stream.expect :print, true, ["Check: "]
    end
    console.in_stream.expect :gets, "n"
    console.in_stream.expect :gets, "y"
    console.in_stream.expect :gets, "n"
    result = check "start groceries"
  end

  def test_includes_notes
    console.in_stream  = MiniTest::Mock.new
    console.out_stream = MiniTest::Mock.new

    9.times do
      console.out_stream.expect :puts, true, [String]
    end
    3.times do
      console.out_stream.expect :print, true, ["Check: "]
      console.out_stream.expect :print, true, ["Notes: "]
    end
    console.in_stream.expect :gets, "n"
    console.in_stream.expect :gets, "Shit's fucked"
    console.in_stream.expect :gets, "y"
    console.in_stream.expect :gets, ""
    console.in_stream.expect :gets, "n"
    console.in_stream.expect :gets, "Really, bad"
    check "start groceries --notes"
    console.in_stream.verify
    console.out_stream.verify
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
checkcheckit-0.0.3 test/console_test.rb
checkcheckit-0.0.2 test/console_test.rb