summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorZack Hobson2013-12-26 21:39:52 -0800
committerZack Hobson2013-12-26 21:39:52 -0800
commit26ea694048faaad292152b246f24d25eab0cf2ac (patch)
treef58e96f6268a6709afdd1198e4c98bf5b10c8398 /test
parent087da79f8c4135acc19a71822295c328c0d57a5a (diff)
downloadhcl-26ea694048faaad292152b246f24d25eab0cf2ac.tar.bz2
timesheet_resource: resource scopes
Diffstat (limited to 'test')
-rw-r--r--test/app_test.rb3
-rw-r--r--test/command_test.rb3
-rw-r--r--test/day_entry_test.rb6
-rw-r--r--test/ext/capture_output.rb8
4 files changed, 13 insertions, 7 deletions
diff --git a/test/app_test.rb b/test/app_test.rb
index 1fc1073..e6dbc3d 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -2,6 +2,7 @@ require 'test_helper'
class AppTest < HCl::TestCase
def setup
+ super
# touch config to avoid triggering manual config
FileUtils.mkdir_p HCl::App::HCL_DIR
FileUtils.touch File.join(HCl::App::HCL_DIR, "config.yml")
@@ -13,7 +14,7 @@ class AppTest < HCl::TestCase
end
def test_command_show
- HCl::DayEntry.expects(:all).returns [HCl::DayEntry.new(
+ HCl::DayEntry.expects(:daily).returns [HCl::DayEntry.new(
hours:'2.06', notes:'hi world', project:'App'
)]
HCl::App.command 'show'
diff --git a/test/command_test.rb b/test/command_test.rb
index dd6f440..cd21736 100644
--- a/test/command_test.rb
+++ b/test/command_test.rb
@@ -4,6 +4,7 @@ class CommandTest < HCl::TestCase
include HCl::Utility
def setup
+ super
@settings = {}
end
@@ -34,7 +35,7 @@ class CommandTest < HCl::TestCase
end
def test_show
- HCl::DayEntry.expects(:all).returns([HCl::DayEntry.new({
+ HCl::DayEntry.expects(:daily).returns([HCl::DayEntry.new({
hours:'2.06',
notes: 'hi world',
project: 'App'
diff --git a/test/day_entry_test.rb b/test/day_entry_test.rb
index baa4f3b..0e391fa 100644
--- a/test/day_entry_test.rb
+++ b/test/day_entry_test.rb
@@ -3,17 +3,17 @@ require 'test_helper'
class DayEntryTest < HCl::TestCase
def test_all_today_empty
register_uri(:get, '/daily', {projects:[],day_entries:[]})
- assert HCl::DayEntry.all.empty?
+ assert HCl::DayEntry.today.empty?
end
def test_all_today
register_uri(:get, '/daily', {projects:[], day_entries:[{id:1,note:'hi'}]})
- assert_equal 'hi', HCl::DayEntry.all.first.note
+ assert_equal 'hi', HCl::DayEntry.today.first.note
end
def test_all_with_date
register_uri(:get, '/daily/013/2013', {projects:[], day_entries:[{id:1,note:'hi'}]})
- assert_equal 'hi', HCl::DayEntry.all(Date.civil(2013,1,13)).first.note
+ assert_equal 'hi', HCl::DayEntry.daily(Date.civil(2013,1,13)).first.note
end
def test_toggle
diff --git a/test/ext/capture_output.rb b/test/ext/capture_output.rb
index a469e21..bbf5424 100644
--- a/test/ext/capture_output.rb
+++ b/test/ext/capture_output.rb
@@ -1,11 +1,15 @@
module CaptureOutput
def before_setup
super
- $stderr = @stderr = StringIO.new
- $stdout = @stdout = StringIO.new
+ @stderr = StringIO.new
+ @stdout = StringIO.new
+ return if ENV['VERBOSE']
+ $stderr = @stderr
+ $stdout = @stdout
end
def after_teardown
super
+ return if ENV['VERBOSE']
$stderr = STDERR
$stdout = STDOUT
end