Pratt 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.exrc +61 -0
- data/.gitignore +4 -0
- data/History.txt +6 -0
- data/Manifest.txt +46 -0
- data/Pratt.gemspec +351 -0
- data/README.txt +66 -0
- data/Rakefile +85 -0
- data/TODO +54 -0
- data/VERSION +1 -0
- data/bin/pratt.rb +13 -0
- data/config.rb +34 -0
- data/lib/pratt.rb +527 -0
- data/lib/pratt/array.rb +11 -0
- data/lib/pratt/string.rb +18 -0
- data/models/app.rb +40 -0
- data/models/customer.rb +24 -0
- data/models/payment.rb +22 -0
- data/models/pratt.rb +19 -0
- data/models/project.rb +82 -0
- data/models/whence.rb +70 -0
- data/pkgs/tile-0.8.2.tar.gz +0 -0
- data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
- data/pkgs/tile-0.8.2/ChangeLog +4651 -0
- data/pkgs/tile-0.8.2/Makefile +250 -0
- data/pkgs/tile-0.8.2/Makefile.in +250 -0
- data/pkgs/tile-0.8.2/README.txt +86 -0
- data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
- data/pkgs/tile-0.8.2/altTheme.o +0 -0
- data/pkgs/tile-0.8.2/blink.o +0 -0
- data/pkgs/tile-0.8.2/button.o +0 -0
- data/pkgs/tile-0.8.2/cache.o +0 -0
- data/pkgs/tile-0.8.2/clamTheme.o +0 -0
- data/pkgs/tile-0.8.2/classicTheme.o +0 -0
- data/pkgs/tile-0.8.2/config.log +1330 -0
- data/pkgs/tile-0.8.2/config.status +795 -0
- data/pkgs/tile-0.8.2/configure +15248 -0
- data/pkgs/tile-0.8.2/configure.in +89 -0
- data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
- data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
- data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
- data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
- data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
- data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
- data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
- data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
- data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/Makefile +36 -0
- data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
- data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
- data/pkgs/tile-0.8.2/doc/button.n +75 -0
- data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
- data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
- data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
- data/pkgs/tile-0.8.2/doc/entry.n +438 -0
- data/pkgs/tile-0.8.2/doc/frame.n +43 -0
- data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
- data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
- data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
- data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
- data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
- data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
- data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
- data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
- data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
- data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
- data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
- data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
- data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
- data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
- data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
- data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
- data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
- data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
- data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
- data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
- data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
- data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
- data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
- data/pkgs/tile-0.8.2/doc/image.n +81 -0
- data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
- data/pkgs/tile-0.8.2/doc/label.n +75 -0
- data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
- data/pkgs/tile-0.8.2/doc/man.macros +239 -0
- data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
- data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
- data/pkgs/tile-0.8.2/doc/paned.n +95 -0
- data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
- data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
- data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
- data/pkgs/tile-0.8.2/doc/separator.n +30 -0
- data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
- data/pkgs/tile-0.8.2/doc/style.n +119 -0
- data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
- data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
- data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
- data/pkgs/tile-0.8.2/doc/widget.n +227 -0
- data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
- data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
- data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
- data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
- data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
- data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
- data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
- data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
- data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
- data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
- data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
- data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
- data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
- data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
- data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
- data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
- data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
- data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
- data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
- data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
- data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
- data/pkgs/tile-0.8.2/entry.o +0 -0
- data/pkgs/tile-0.8.2/frame.o +0 -0
- data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
- data/pkgs/tile-0.8.2/generic/TODO +493 -0
- data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
- data/pkgs/tile-0.8.2/generic/blink.c +168 -0
- data/pkgs/tile-0.8.2/generic/button.c +858 -0
- data/pkgs/tile-0.8.2/generic/cache.c +354 -0
- data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
- data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
- data/pkgs/tile-0.8.2/generic/configure +10334 -0
- data/pkgs/tile-0.8.2/generic/configure.in +100 -0
- data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
- data/pkgs/tile-0.8.2/generic/frame.c +648 -0
- data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
- data/pkgs/tile-0.8.2/generic/image.c +416 -0
- data/pkgs/tile-0.8.2/generic/label.c +663 -0
- data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
- data/pkgs/tile-0.8.2/generic/manager.c +554 -0
- data/pkgs/tile-0.8.2/generic/manager.h +91 -0
- data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
- data/pkgs/tile-0.8.2/generic/paned.c +958 -0
- data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
- data/pkgs/tile-0.8.2/generic/progress.c +549 -0
- data/pkgs/tile-0.8.2/generic/scale.c +526 -0
- data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
- data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
- data/pkgs/tile-0.8.2/generic/separator.c +132 -0
- data/pkgs/tile-0.8.2/generic/square.c +306 -0
- data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
- data/pkgs/tile-0.8.2/generic/tile.c +296 -0
- data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
- data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
- data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
- data/pkgs/tile-0.8.2/generic/trace.c +145 -0
- data/pkgs/tile-0.8.2/generic/track.c +174 -0
- data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
- data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
- data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
- data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
- data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
- data/pkgs/tile-0.8.2/generic/widget.c +785 -0
- data/pkgs/tile-0.8.2/generic/widget.h +263 -0
- data/pkgs/tile-0.8.2/image.o +0 -0
- data/pkgs/tile-0.8.2/label.o +0 -0
- data/pkgs/tile-0.8.2/layout.o +0 -0
- data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
- data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
- data/pkgs/tile-0.8.2/library/button.tcl +85 -0
- data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
- data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
- data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
- data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
- data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
- data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
- data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
- data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
- data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
- data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
- data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
- data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
- data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
- data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
- data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
- data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
- data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
- data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
- data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
- data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
- data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
- data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
- data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
- data/pkgs/tile-0.8.2/libttkstub.a +0 -0
- data/pkgs/tile-0.8.2/license.terms +24 -0
- data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
- data/pkgs/tile-0.8.2/manager.o +0 -0
- data/pkgs/tile-0.8.2/notebook.o +0 -0
- data/pkgs/tile-0.8.2/paned.o +0 -0
- data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
- data/pkgs/tile-0.8.2/progress.o +0 -0
- data/pkgs/tile-0.8.2/scale.o +0 -0
- data/pkgs/tile-0.8.2/scroll.o +0 -0
- data/pkgs/tile-0.8.2/scrollbar.o +0 -0
- data/pkgs/tile-0.8.2/separator.o +0 -0
- data/pkgs/tile-0.8.2/tagset.o +0 -0
- data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
- data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
- data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
- data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
- data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
- data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
- data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
- data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
- data/pkgs/tile-0.8.2/tests/entry.test +285 -0
- data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
- data/pkgs/tile-0.8.2/tests/image.test +94 -0
- data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
- data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
- data/pkgs/tile-0.8.2/tests/layout.test +33 -0
- data/pkgs/tile-0.8.2/tests/misc.test +35 -0
- data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
- data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
- data/pkgs/tile-0.8.2/tests/paned.test +298 -0
- data/pkgs/tile-0.8.2/tests/progress.test +92 -0
- data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
- data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
- data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
- data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
- data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
- data/pkgs/tile-0.8.2/tests/tile.test +674 -0
- data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
- data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
- data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
- data/pkgs/tile-0.8.2/tests/validate.test +278 -0
- data/pkgs/tile-0.8.2/tile.o +0 -0
- data/pkgs/tile-0.8.2/tkElements.o +0 -0
- data/pkgs/tile-0.8.2/tkTheme.o +0 -0
- data/pkgs/tile-0.8.2/tkstate.o +0 -0
- data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
- data/pkgs/tile-0.8.2/trace.o +0 -0
- data/pkgs/tile-0.8.2/track.o +0 -0
- data/pkgs/tile-0.8.2/treeview.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
- data/pkgs/tile-0.8.2/widget.o +0 -0
- data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
- data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
- data/pkgs/tile-0.8.2/win/monitor.c +164 -0
- data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
- data/pkgs/tile-0.8.2/win/rules.vc +512 -0
- data/pkgs/tile-0.8.2/win/tile.rc +40 -0
- data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
- data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
- data/spec/app_spec.rb +48 -0
- data/spec/customer_spec.rb +31 -0
- data/spec/fixtures/graph.expectation +18 -0
- data/spec/payment_spec.rb +19 -0
- data/spec/pratt_spec.rb +148 -0
- data/spec/project_spec.rb +163 -0
- data/spec/rcov.opts +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/whence_spec.rb +54 -0
- data/tasks/pratt.rb +84 -0
- data/templates/model.eruby +12 -0
- data/templates/spec.eruby +8 -0
- data/views/env.rb +22 -0
- data/views/graph.eruby +20 -0
- data/views/invoice.eruby +148 -0
- data/views/main.rb +92 -0
- data/views/pid.eruby +3 -0
- data/views/pop.rb +94 -0
- data/views/pop2.rb +75 -0
- data/views/raw.eruby +11 -0
- metadata +390 -0
data/spec/app_spec.rb
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe App do
|
|
4
|
+
context "instances" do
|
|
5
|
+
it "should only have one" do
|
|
6
|
+
App.last.should_not be_nil
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should have log" do
|
|
10
|
+
@app = App.last
|
|
11
|
+
@app.expects(:log).with('pop').returns(@app)
|
|
12
|
+
@app.log 'pop'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should say it has something logged" do
|
|
16
|
+
@app = App.new
|
|
17
|
+
@app.gui?('main').should be_false
|
|
18
|
+
@app.gui?('pop').should be_false
|
|
19
|
+
|
|
20
|
+
@app.gui = 'main'
|
|
21
|
+
@app.gui?('main').should be_true
|
|
22
|
+
|
|
23
|
+
@app.gui = 'pop'
|
|
24
|
+
@app.gui?('main').should be_false
|
|
25
|
+
|
|
26
|
+
@app.gui = 'pop'
|
|
27
|
+
@app.gui?('pop').should be_true
|
|
28
|
+
|
|
29
|
+
@app.gui = 'pop'
|
|
30
|
+
@app.gui?('bob').should be_false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should remove the gui when expected" do
|
|
34
|
+
@app = App.create :gui => 'pop'
|
|
35
|
+
|
|
36
|
+
@app.gui?('pop').should be_true
|
|
37
|
+
@app.unlock
|
|
38
|
+
@app.gui?('pop').should be_false
|
|
39
|
+
|
|
40
|
+
@app.gui = 'main'
|
|
41
|
+
@app.save
|
|
42
|
+
@app.gui?('pop').should be_false
|
|
43
|
+
@app.gui?('main').should be_true
|
|
44
|
+
|
|
45
|
+
@app.destroy
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'pratt'
|
|
3
|
+
|
|
4
|
+
describe Customer do
|
|
5
|
+
it_should_behave_like "being a billable item"
|
|
6
|
+
|
|
7
|
+
describe "instance" do
|
|
8
|
+
before :each do
|
|
9
|
+
@customer = Customer.create :name => "frogstarr78", :address => '312 NW 7th', :zip => '97862'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
after :each do
|
|
13
|
+
Customer.find_by_name('frogstarr78').destroy
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "responds to :projects" do
|
|
17
|
+
Customer.new.should respond_to(:projects)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "responds to :payment" do
|
|
21
|
+
Customer.new.should respond_to(:payment)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "calculates amount correctly" do
|
|
25
|
+
payment = mock('payment')
|
|
26
|
+
payment.expects(:rate).once.returns(31500)
|
|
27
|
+
@customer.expects(:payment).once.returns(payment)
|
|
28
|
+
@customer.amount.should == 315.0
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Project detail
|
|
2
|
+
by week from
|
|
3
|
+
Mon 00:00:00 Sep 28 2009 to Sun 23:59:59 Oct 04 2009
|
|
4
|
+
dys hrs min
|
|
5
|
+
------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
Lunch/Break| 00 day 01 hour 21 min
|
|
8
|
+
Task1| 00 day 01 hour 04 min
|
|
9
|
+
Task2| 00 day 00 hour 58 min
|
|
10
|
+
Another Task| 00 day 00 hour 05 min
|
|
11
|
+
Task3| 01 day 17 hour 32 min
|
|
12
|
+
|
|
13
|
+
------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
Total 43.69 hrs
|
|
16
|
+
**** ******** 0.00%
|
|
17
|
+
Lunch/Break 3.11%
|
|
18
|
+
Other 100.00%
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'pratt'
|
|
3
|
+
|
|
4
|
+
describe Payment do
|
|
5
|
+
describe "instances" do
|
|
6
|
+
before :each do
|
|
7
|
+
@payment = Payment.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "responds to :pretty_print" do
|
|
11
|
+
@payment.should respond_to(:pretty_print)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "pretty_print is the expected format " do
|
|
15
|
+
@payment.rate = '100'
|
|
16
|
+
@payment.pretty_print.should == '$1.00'
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/spec/pratt_spec.rb
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'pratt'
|
|
3
|
+
|
|
4
|
+
describe Pratt do
|
|
5
|
+
before :each do
|
|
6
|
+
@pratt = Pratt.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# it "should act like an array" do
|
|
10
|
+
# @pratt.should respond_to(:<<)
|
|
11
|
+
# lambda {
|
|
12
|
+
# @pratt << :this
|
|
13
|
+
# }.should change(@pratt.todo, :size).by(1)
|
|
14
|
+
# @pratt.todo.should == [:this]
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
# it "correctly report i_should?" do
|
|
18
|
+
# @pratt.send(:i_should?, :this).should be_false
|
|
19
|
+
# @pratt << :this
|
|
20
|
+
# @pratt.send(:i_should?, :this).should be_true
|
|
21
|
+
# end
|
|
22
|
+
#
|
|
23
|
+
# it "should start a new project when calling begin" do
|
|
24
|
+
# @pratt.project = mock('Refactor')
|
|
25
|
+
# @pratt.when_to = Time.now
|
|
26
|
+
# @pratt.project.expects(:start!).with(@pratt.when_to)
|
|
27
|
+
#
|
|
28
|
+
# @pratt.begin
|
|
29
|
+
# end
|
|
30
|
+
#
|
|
31
|
+
# it "should allow project to be set by object" do
|
|
32
|
+
# primary = Project.new :name => 'project', :weight => 1
|
|
33
|
+
# Project.expects(:find_or_create_by_name).never
|
|
34
|
+
# @pratt.project = primary
|
|
35
|
+
# @pratt.project.should == primary
|
|
36
|
+
# end
|
|
37
|
+
#
|
|
38
|
+
# it "should allow project to be set by a string" do
|
|
39
|
+
# Project.expects(:find_or_create_by_name).with( { :name => 'Refactor' } )
|
|
40
|
+
# @pratt.project = 'Refactor'
|
|
41
|
+
# end
|
|
42
|
+
#
|
|
43
|
+
# describe "color" do
|
|
44
|
+
#
|
|
45
|
+
# it "should color when expected" do
|
|
46
|
+
# @pratt.color = true
|
|
47
|
+
# @pratt.send( :red, 'this' ).should == 'this'.red
|
|
48
|
+
# end
|
|
49
|
+
#
|
|
50
|
+
# it "should not color when not expected" do
|
|
51
|
+
# @pratt.color = false
|
|
52
|
+
# @pratt.send( :red, 'this' ).should == 'this'
|
|
53
|
+
# end
|
|
54
|
+
# end
|
|
55
|
+
#
|
|
56
|
+
# describe "\b#root" do
|
|
57
|
+
# before :each do
|
|
58
|
+
# Dir.stubs(:pwd).returns("/home/scott/git/pratt")
|
|
59
|
+
# @expected_root = "/home/scott/git/pratt"
|
|
60
|
+
# end
|
|
61
|
+
#
|
|
62
|
+
# it "is correct without arguments" do
|
|
63
|
+
# Pratt.root.should == [Pathname.new(@expected_root)]
|
|
64
|
+
# end
|
|
65
|
+
#
|
|
66
|
+
# it "is correct with a block but no argument" do
|
|
67
|
+
# received = []
|
|
68
|
+
# Pratt.root {|model| received << model }
|
|
69
|
+
# received.should == [Pathname.new(@expected_root)]
|
|
70
|
+
# end
|
|
71
|
+
#
|
|
72
|
+
# it "is correct with an argument but no block" do
|
|
73
|
+
# Pratt.root('models').should == [Pathname.new(File.join(@expected_root, "models"))]
|
|
74
|
+
# end
|
|
75
|
+
#
|
|
76
|
+
# it "is correct with an argument and block" do
|
|
77
|
+
# received = []
|
|
78
|
+
# Pratt.root('models', '*.rb') {|model| received << model }
|
|
79
|
+
# received.to_set.should == %w(app.rb customer.rb log.rb project.rb payment.rb pratt.rb whence.rb).collect {|model| Pathname.new File.join(@expected_root, "models", model) }.to_set
|
|
80
|
+
# end
|
|
81
|
+
# end
|
|
82
|
+
#
|
|
83
|
+
# describe "graph" do
|
|
84
|
+
# before :each do
|
|
85
|
+
# @when_to = Chronic.parse('last week').beginning_of_week
|
|
86
|
+
# @pratt.scale = 'week'
|
|
87
|
+
# @pratt.when_to = @when_to
|
|
88
|
+
# end
|
|
89
|
+
#
|
|
90
|
+
# after :each do
|
|
91
|
+
# Whence.delete_all
|
|
92
|
+
# end
|
|
93
|
+
#
|
|
94
|
+
#
|
|
95
|
+
# def task name, time_spent
|
|
96
|
+
# task1 = Project.find_or_create_by_name :name => name
|
|
97
|
+
# task1.start! @when_to
|
|
98
|
+
# task1.stop! @when_to+time_spent
|
|
99
|
+
# end
|
|
100
|
+
#
|
|
101
|
+
# def populate_with_data
|
|
102
|
+
# Project.find_or_create_by_name :name => '**** ********', :weight => 1
|
|
103
|
+
# task 'Lunch/Break', 1.hour+21.minutes
|
|
104
|
+
# task 'Task1', 1.hour+4.minutes
|
|
105
|
+
# task 'Task2', 58.minutes
|
|
106
|
+
# task 'Another Task', 5.minutes
|
|
107
|
+
# task 'Task3', 1.day+17.hours+32.minutes
|
|
108
|
+
# end
|
|
109
|
+
#
|
|
110
|
+
# def get_expected_display
|
|
111
|
+
# Pratt.root('spec', 'fixtures', 'graph.expectation') {|file| File.open(file).read }
|
|
112
|
+
# end
|
|
113
|
+
#
|
|
114
|
+
# it "report no data" do
|
|
115
|
+
# Project.expects(:all).returns([])
|
|
116
|
+
# @pratt.expects(:process_template!).never
|
|
117
|
+
# @pratt.graph.should == "No data to report"
|
|
118
|
+
# end
|
|
119
|
+
#
|
|
120
|
+
# it "should look right with data" do
|
|
121
|
+
# populate_with_data
|
|
122
|
+
# @pratt.expects(:process_template!)
|
|
123
|
+
#
|
|
124
|
+
# @pratt.graph.should == get_expected_display
|
|
125
|
+
# end
|
|
126
|
+
# end
|
|
127
|
+
|
|
128
|
+
describe "parse" do
|
|
129
|
+
it "handles cli arg -n setting appropriate environment config"
|
|
130
|
+
# do
|
|
131
|
+
## Pratt.expects(:connect).with('staging')
|
|
132
|
+
## lambda {
|
|
133
|
+
# Pratt.parse %w(--env staging)
|
|
134
|
+
## }.should change(ENV['PRATT_ENV']).from('test').to('staging')
|
|
135
|
+
# ENV['PRATT_ENV'].should == 'staging'
|
|
136
|
+
# end
|
|
137
|
+
|
|
138
|
+
# it "inits an irb console when given console argument" do
|
|
139
|
+
# Pratt.any_instance.stubs(:i_should?).returns false
|
|
140
|
+
# # ^ to bypass actually calling exec
|
|
141
|
+
# # :i_should? and Pratt#run should be
|
|
142
|
+
# # tested independently and we don't
|
|
143
|
+
# # need to test exec
|
|
144
|
+
# Pratt.any_instance.expects(:<<).with(:console)
|
|
145
|
+
# Pratt.parse %w(console)
|
|
146
|
+
# end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
# enable laziness
|
|
4
|
+
class Mocha::Mock
|
|
5
|
+
def name
|
|
6
|
+
@name.instance_variable_get("@name")
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe Project do
|
|
11
|
+
it_should_behave_like "being a billable item"
|
|
12
|
+
|
|
13
|
+
context "scopes" do
|
|
14
|
+
it "named primary" do
|
|
15
|
+
Project.expects(:first).with(:conditions => { :weight => 1 }).returns(mock('Refactor'))
|
|
16
|
+
Project.primary.name.should == 'Refactor'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "named off" do
|
|
20
|
+
Project.expects(:first).with(:conditions => { :name => 'Lunch/Break' }).returns(mock('Lunch/Break'))
|
|
21
|
+
Project.off.name.should == 'Lunch/Break'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "named rest" do
|
|
25
|
+
prim = mock('Refactor')
|
|
26
|
+
off = mock('Lunch/Break')
|
|
27
|
+
other = mock('Other')
|
|
28
|
+
|
|
29
|
+
Project.expects(:primary).returns prim
|
|
30
|
+
Project.expects(:off).returns off
|
|
31
|
+
Project.expects(:all).returns([prim, off, other])
|
|
32
|
+
Project.rest.should == [other]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "named named" do
|
|
36
|
+
Project.expects(:first).with(:conditions => { :name => 'Refactor' }).returns(mock('Refactor'))
|
|
37
|
+
Project.named('Refactor').name.should == 'Refactor'
|
|
38
|
+
|
|
39
|
+
Project.expects(:named).with(nil).returns nil
|
|
40
|
+
Project.named(nil).should be_nil
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
context "instances" do
|
|
45
|
+
before :each do
|
|
46
|
+
@project = Project.primary
|
|
47
|
+
@log_count = @project.whences.size
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
after :each do
|
|
51
|
+
@project.whences.destroy_all
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "should correctly log entries using start! and stop!" do
|
|
55
|
+
lambda {
|
|
56
|
+
@project.start!
|
|
57
|
+
}.should change(@project.whences, :count).by(1)
|
|
58
|
+
@project.whences.last.end_at.should be_nil
|
|
59
|
+
|
|
60
|
+
sleep 1
|
|
61
|
+
lambda {
|
|
62
|
+
@project.stop!
|
|
63
|
+
}.should_not change(@project.whences, :count)
|
|
64
|
+
@project.should be_valid
|
|
65
|
+
@project.whences.reload
|
|
66
|
+
@project.whences.last.end_at.should > @project.whences.last.start_at
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "should log correct time if given (not the default)" do
|
|
70
|
+
lambda {
|
|
71
|
+
@project.start!
|
|
72
|
+
}.should change(@project.whences, :count).by(1)
|
|
73
|
+
@project.whences.last.end_at.should be_nil
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should do nothing if attempting to stop a project that hasn't been started" do
|
|
77
|
+
lambda {
|
|
78
|
+
@project.stop!
|
|
79
|
+
}.should_not change(@project.whences, :count)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "should stop! then start! when calling restart!" do
|
|
83
|
+
@project.start!
|
|
84
|
+
first_started_id = @project.whences.last.id
|
|
85
|
+
|
|
86
|
+
lambda {
|
|
87
|
+
@project.restart!
|
|
88
|
+
}.should change(@project.whences, :count).by(1)
|
|
89
|
+
@project.whences.last.end_at.should be_nil
|
|
90
|
+
@project.whences.last.id.should_not == first_started_id
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "has a customer association" do
|
|
94
|
+
@project.should respond_to(:customer)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
context "amount calculation" do
|
|
98
|
+
before :each do
|
|
99
|
+
Payment.create :rate => '315', :billable => @project
|
|
100
|
+
|
|
101
|
+
@now = Time.parse("2009-10-04 17:53:58")
|
|
102
|
+
Time.stubs(:now).returns(@now.beginning_of_week)
|
|
103
|
+
|
|
104
|
+
whence = Time.now-1.day
|
|
105
|
+
@project.start! whence
|
|
106
|
+
@project.stop! whence+3.hours
|
|
107
|
+
|
|
108
|
+
whence = Time.now
|
|
109
|
+
@project.start! whence
|
|
110
|
+
@project.stop! whence+3.hours
|
|
111
|
+
|
|
112
|
+
@project.reload
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it "is correct with no arguments" do
|
|
116
|
+
@project.amount.should == 6*3.15
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it "is correct with a scale" do
|
|
120
|
+
@project.amount(:month).should == 6*3.15
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it "is correct with a scale and time" do
|
|
124
|
+
@project.amount(:week, @now).should == 3*3.15
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
context "time_spent" do
|
|
130
|
+
before :each do
|
|
131
|
+
@project = Project.new
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it "correctly calculates with no data" do
|
|
135
|
+
Whence.expects(:find).with(:all, :conditions => ["end_at IS NOT NULL"]).returns []
|
|
136
|
+
@project.time_spent.should == 0.0
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it "correctly calculates with time argument" do
|
|
140
|
+
now = Time.now.beginning_of_day
|
|
141
|
+
Whence.expects(:find).returns [mock('whence1', :start_at => now, :end_at => now+=1.hour), mock('whence2', :start_at => now+=2.hours, :end_at => now+=2.hour+30.minutes)]
|
|
142
|
+
@project.time_spent.should == 3.5
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it "correctly calculates with string time argument" do
|
|
146
|
+
whence = mock('whence', :start_at => Chronic.parse('last monday 12:00 pm'), :end_at => Chronic.parse('last monday 12:00:05 pm'))
|
|
147
|
+
Whence.expects(:find).returns [whence]
|
|
148
|
+
@project.time_spent.should == 5.0/3600
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it "correctly calculates with a scale" do
|
|
152
|
+
whence = mock('whence', :start_at => Time.parse('2009-10-04 23:53:32'), :end_at => Time.parse('2009-10-05 00:10:32'))
|
|
153
|
+
Whence.expects(:find).returns [whence]
|
|
154
|
+
@project.time_spent('month').should == 17.0/60
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it "correctly calculates with a scale and specific time" do
|
|
158
|
+
whence = mock('whence', :start_at => Time.parse('2009-10-05 23:54:32'), :end_at => Time.parse('2009-10-06 00:12:32'))
|
|
159
|
+
Whence.expects(:find).returns [whence]
|
|
160
|
+
@project.time_spent('day', Chronic.parse('yesterday')).should == 18.0/60
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
data/spec/rcov.opts
ADDED
|
File without changes
|
data/spec/spec.opts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
color=true color: true color colour c --colour --color -c
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
|
2
|
+
# from the project root directory.
|
|
3
|
+
require 'spec'
|
|
4
|
+
require 'config'
|
|
5
|
+
require 'ruby-debug'
|
|
6
|
+
|
|
7
|
+
Spec::Runner.configure do |config|
|
|
8
|
+
# config.mock_with :rspec
|
|
9
|
+
config.mock_with :mocha
|
|
10
|
+
|
|
11
|
+
Pratt.connect! 'test'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
shared_examples_for "Time spent on a project" do
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
shared_examples_for "being a billable item" do
|
|
18
|
+
it "responds to amount" do
|
|
19
|
+
subject.class.new.should respond_to(:amount)
|
|
20
|
+
end
|
|
21
|
+
end
|