oughtve 110.e2f5bb28
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/README +115 -0
- data/Rakefile +44 -0
- data/bin/oughtve +62 -0
- data/doc/HOWTO.using +131 -0
- data/doc/LICENCE +44 -0
- data/doc/README.markdown +115 -0
- data/doc/TODO +13 -0
- data/lib/oughtve.rb +87 -0
- data/lib/oughtve/chapter.rb +93 -0
- data/lib/oughtve/database.rb +83 -0
- data/lib/oughtve/errors.rb +6 -0
- data/lib/oughtve/options.rb +193 -0
- data/lib/oughtve/tangent.rb +353 -0
- data/lib/oughtve/verse.rb +83 -0
- data/setup.rb +1360 -0
- data/spec/bootstrap_creates_db_spec.rb +38 -0
- data/spec/bootstrap_creates_default_tangent_spec.rb +40 -0
- data/spec/bootstrap_raises_if_db_exists_spec.rb +37 -0
- data/spec/chapter_spec.rb +36 -0
- data/spec/delete_spec.rb +59 -0
- data/spec/list_spec.rb +25 -0
- data/spec/scribe_spec.rb +137 -0
- data/spec/show_spec.rb +247 -0
- data/spec/spec.rb +87 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/strike_spec.rb +150 -0
- data/spec/tangent_locating_spec.rb +63 -0
- data/spec/tangent_spec.rb +211 -0
- metadata +146 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
require "fileutils"
|
3
|
+
require "tmpdir"
|
4
|
+
|
5
|
+
# We do not want spec_helper since we must check the bootstrap here.
|
6
|
+
$LOAD_PATH << "#{File.dirname __FILE__}/../lib"
|
7
|
+
require "oughtve"
|
8
|
+
|
9
|
+
|
10
|
+
describe Oughtve, "initial bootstrap using --bootstrap" do
|
11
|
+
|
12
|
+
before :all do
|
13
|
+
# Delete the dir created by the spec runner to simplify
|
14
|
+
FileUtils.rm_r ENV["HOME"], :secure => true
|
15
|
+
end
|
16
|
+
|
17
|
+
before :each do
|
18
|
+
$VERBOSE, @verbose = nil, $VERBOSE
|
19
|
+
FileUtils.mkdir_p ENV["HOME"]
|
20
|
+
end
|
21
|
+
|
22
|
+
after :each do
|
23
|
+
FileUtils.rm_r ENV["HOME"], :secure => true
|
24
|
+
$VERBOSE = @verbose
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# Behaviour
|
29
|
+
|
30
|
+
it "creates a Sqlite database ~/.oughtve/db" do
|
31
|
+
File.exist?(Oughtve::Database::Path).should == false
|
32
|
+
|
33
|
+
Oughtve.run %w[ --bootstrap ]
|
34
|
+
|
35
|
+
File.exist?(Oughtve::Database::Path).should == true
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "tmpdir"
|
3
|
+
|
4
|
+
# We do not want spec_helper since we must check the bootstrap here.
|
5
|
+
$LOAD_PATH << "#{File.dirname __FILE__}/../lib"
|
6
|
+
require "oughtve"
|
7
|
+
|
8
|
+
|
9
|
+
describe Oughtve, "initial bootstrap using --bootstrap" do
|
10
|
+
|
11
|
+
before :all do
|
12
|
+
# Delete the dir created by the spec runner to simplify
|
13
|
+
FileUtils.rm_r ENV["HOME"], :secure => true
|
14
|
+
end
|
15
|
+
|
16
|
+
before :each do
|
17
|
+
$VERBOSE, @verbose = nil, $VERBOSE
|
18
|
+
FileUtils.mkdir_p ENV["HOME"]
|
19
|
+
end
|
20
|
+
|
21
|
+
after :each do
|
22
|
+
FileUtils.rm_r ENV["HOME"], :secure => true
|
23
|
+
$VERBOSE = @verbose
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# Behaviour
|
28
|
+
|
29
|
+
it "creates the 'default' tangent at /" do
|
30
|
+
lambda { Oughtve::Tangent.all.size.should == 0 }.should raise_error
|
31
|
+
|
32
|
+
Oughtve.run %w[ --bootstrap ]
|
33
|
+
|
34
|
+
Oughtve::Tangent.all.size.should == 1
|
35
|
+
default = Oughtve::Tangent.first
|
36
|
+
default.dir.should == "/"
|
37
|
+
default.name.should == "default"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
require "fileutils"
|
3
|
+
require "tmpdir"
|
4
|
+
|
5
|
+
# We do not want spec_helper since we must check the bootstrap here.
|
6
|
+
$LOAD_PATH << "#{File.dirname __FILE__}/../lib"
|
7
|
+
require "oughtve"
|
8
|
+
|
9
|
+
|
10
|
+
describe Oughtve, "initial bootstrap using --bootstrap" do
|
11
|
+
|
12
|
+
before :all do
|
13
|
+
# Delete the dir created by the spec runner to simplify
|
14
|
+
FileUtils.rm_r ENV["HOME"], :secure => true
|
15
|
+
end
|
16
|
+
|
17
|
+
before :each do
|
18
|
+
$VERBOSE, @verbose = nil, $VERBOSE
|
19
|
+
FileUtils.mkdir_p ENV["HOME"]
|
20
|
+
end
|
21
|
+
|
22
|
+
after :each do
|
23
|
+
FileUtils.rm_r ENV["HOME"], :secure => true
|
24
|
+
$VERBOSE = @verbose
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# Behaviour
|
29
|
+
|
30
|
+
it "raises an error if a database file already exists" do
|
31
|
+
FileUtils.mkdir_p File.dirname(Oughtve::Database::Path)
|
32
|
+
FileUtils.touch Oughtve::Database::Path
|
33
|
+
|
34
|
+
lambda { Oughtve.run %w[ --bootstrap ] }.should raise_error(OughtveError)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.join File.dirname(__FILE__), "spec_helper"
|
2
|
+
|
3
|
+
describe Oughtve, "starting a new chapter" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
7
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
8
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
9
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
10
|
+
end
|
11
|
+
|
12
|
+
after :each do
|
13
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
14
|
+
end
|
15
|
+
|
16
|
+
it "moves previous chapter to chapters and replaces it as current_chapter" do
|
17
|
+
tangent = Oughtve::Tangent.first :name => "tangy"
|
18
|
+
|
19
|
+
previous = tangent.current_chapter
|
20
|
+
|
21
|
+
previous.should_not == nil
|
22
|
+
tangent.chapters.should == [previous]
|
23
|
+
|
24
|
+
Oughtve.run %w[ --chapter End of part 1 --tangent tangy ]
|
25
|
+
|
26
|
+
tangent.reload
|
27
|
+
current = tangent.current_chapter
|
28
|
+
|
29
|
+
current.should_not == nil
|
30
|
+
current.should_not == previous
|
31
|
+
|
32
|
+
tangent.chapters.include?(previous).should == true
|
33
|
+
tangent.chapters.include?(current).should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/delete_spec.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.join File.dirname(__FILE__), "spec_helper"
|
2
|
+
|
3
|
+
require "fileutils"
|
4
|
+
require "ostruct"
|
5
|
+
|
6
|
+
|
7
|
+
describe Oughtve, "deleting tangents" do
|
8
|
+
before :each do
|
9
|
+
Oughtve.run %w[ --new --tangent doomed ]
|
10
|
+
end
|
11
|
+
|
12
|
+
after :each do
|
13
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
14
|
+
end
|
15
|
+
|
16
|
+
it "requires tangent name" do
|
17
|
+
lambda { Oughtve.run %w[ --delete ] }.should raise_error
|
18
|
+
lambda { Oughtve.run %W[ --delete --directory #{Dir.pwd} ] }.should raise_error
|
19
|
+
end
|
20
|
+
|
21
|
+
it "does not allow deleting the default tangent" do
|
22
|
+
lambda { Oughtve.run %w[ --delete --tangent default ] }.should raise_error
|
23
|
+
end
|
24
|
+
|
25
|
+
it "raises if tangent name not found" do
|
26
|
+
lambda { Oughtve.run %w[ --delete --tangent Doomed ] }.should raise_error
|
27
|
+
lambda { Oughtve.run %w[ --delete --tangent uggabugga ] }.should raise_error
|
28
|
+
end
|
29
|
+
|
30
|
+
it "deletes the Tangent object" do
|
31
|
+
Oughtve::Tangent.all(:dir.not => "/").size.should == 1
|
32
|
+
Oughtve.run %w[ --delete --tangent doomed ]
|
33
|
+
Oughtve::Tangent.all(:dir.not => "/").size.should == 0
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe Oughtve, "deleting tangents with direct parameter to --delete" do
|
39
|
+
before :each do
|
40
|
+
Oughtve.run %w[ --new --tangent doomed ]
|
41
|
+
end
|
42
|
+
|
43
|
+
after :each do
|
44
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
45
|
+
end
|
46
|
+
|
47
|
+
it "deletes the tangent named as the parameter" do
|
48
|
+
Oughtve::Tangent.all(:dir.not => "/").size.should == 1
|
49
|
+
Oughtve.run %w[ --delete doomed ]
|
50
|
+
Oughtve::Tangent.all(:dir.not => "/").size.should == 0
|
51
|
+
end
|
52
|
+
|
53
|
+
it "gives some kind of a confirmation" do
|
54
|
+
output = Oughtve.run %w[ --delete doomed ]
|
55
|
+
|
56
|
+
output.should =~ /doomed/
|
57
|
+
output.should =~ /deleted/i
|
58
|
+
end
|
59
|
+
end
|
data/spec/list_spec.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.join File.dirname(__FILE__), "spec_helper"
|
2
|
+
|
3
|
+
describe Oughtve, "listing defined tangents" do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
7
|
+
end
|
8
|
+
|
9
|
+
it "shows name and base directory of each tangent in the system" do
|
10
|
+
outputs = Oughtve.run(%w[ --list ]).split "\n"
|
11
|
+
|
12
|
+
# First line is a banner
|
13
|
+
outputs.shift
|
14
|
+
outputs.shift
|
15
|
+
|
16
|
+
line = outputs.shift
|
17
|
+
line.should =~ /default/
|
18
|
+
line.should =~ /\//
|
19
|
+
|
20
|
+
line = outputs.shift
|
21
|
+
line.should =~ /tangy/
|
22
|
+
line.should =~ /\/tmp/
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/spec/scribe_spec.rb
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
require File.join File.dirname(__FILE__), "spec_helper"
|
2
|
+
|
3
|
+
require "stringio"
|
4
|
+
|
5
|
+
|
6
|
+
describe Oughtve, "scribing a new note with Tangent specified" do
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
Oughtve.run %w[ --new --tangent scriby --directory /var ]
|
10
|
+
Oughtve.run %w[ --new --tangent other --directory /tmp ]
|
11
|
+
end
|
12
|
+
|
13
|
+
after :each do
|
14
|
+
Oughtve::Verse.all.each {|t| t.destroy }
|
15
|
+
Oughtve::Chapter.all.each {|t| t.destroy }
|
16
|
+
Oughtve::Tangent.all(:dir.not => "/").each {|t| t.destroy }
|
17
|
+
end
|
18
|
+
|
19
|
+
it "creates a new Verse under the Tangent specified" do
|
20
|
+
Oughtve.run %w[ --scribe --tangent scriby --text Hi\ there ]
|
21
|
+
|
22
|
+
verses = Oughtve::Tangent.first(:name => "scriby").current_chapter.verses
|
23
|
+
verses.size.should == 1
|
24
|
+
verses.first.text.should == "Hi there"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "raises an error if the name cannot be found" do
|
28
|
+
lambda { Oughtve.run %w[ --scribe --tangent nonesuch --text Uh-oh! ] }.should raise_error
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
describe Oughtve, "scribing a new note with directory specified" do
|
34
|
+
|
35
|
+
before :each do
|
36
|
+
Oughtve.run %w[ --new --tangent scriby --directory /var ]
|
37
|
+
Oughtve.run %w[ --new --tangent other --directory /tmp ]
|
38
|
+
end
|
39
|
+
|
40
|
+
after :each do
|
41
|
+
Oughtve::Verse.all.each {|t| t.destroy }
|
42
|
+
Oughtve::Chapter.all.each {|t| t.destroy }
|
43
|
+
Oughtve::Tangent.all(:dir.not => "/").each {|t| t.destroy }
|
44
|
+
end
|
45
|
+
|
46
|
+
it "creates a new Verse under the Tangent for the directory" do
|
47
|
+
Oughtve.run %w[ --scribe --directory /var --text Ho\ there ]
|
48
|
+
|
49
|
+
verses = Oughtve::Tangent.first(:name => "scriby").current_chapter.verses
|
50
|
+
verses.size.should == 1
|
51
|
+
verses.first.text.should == "Ho there"
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe Oughtve, "scribing a new note without specifying a Tangent or directory" do
|
57
|
+
|
58
|
+
before :each do
|
59
|
+
Oughtve.run %w[ --new --tangent scriby ]
|
60
|
+
Oughtve.run %w[ --new --tangent other --directory /tmp ]
|
61
|
+
end
|
62
|
+
|
63
|
+
after :each do
|
64
|
+
Oughtve::Verse.all.each {|t| t.destroy }
|
65
|
+
Oughtve::Chapter.all.each {|t| t.destroy }
|
66
|
+
Oughtve::Tangent.all(:dir.not => "/").each {|t| t.destroy }
|
67
|
+
end
|
68
|
+
|
69
|
+
it "creates a new Verse under the Tangent for current directory" do
|
70
|
+
Oughtve.run %w[ --scribe --text Hu\ there ]
|
71
|
+
|
72
|
+
verses = Oughtve::Tangent.first(:name => "scriby").current_chapter.verses
|
73
|
+
verses.size.should == 1
|
74
|
+
verses.first.text.should == "Hu there"
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
describe Oughtve, "scribing a new note" do
|
80
|
+
|
81
|
+
before :each do
|
82
|
+
Oughtve.run %w[ --new --tangent scriby ]
|
83
|
+
Oughtve.run %w[ --new --tangent other --directory /tmp ]
|
84
|
+
end
|
85
|
+
|
86
|
+
after :each do
|
87
|
+
Oughtve::Verse.all.each {|t| t.destroy }
|
88
|
+
Oughtve::Chapter.all.each {|t| t.destroy }
|
89
|
+
Oughtve::Tangent.all(:dir.not => "/").each {|t| t.destroy }
|
90
|
+
|
91
|
+
$stdin = STDIN
|
92
|
+
end
|
93
|
+
|
94
|
+
it "stores the time the note was created" do
|
95
|
+
before = Time.now.to_f
|
96
|
+
Oughtve.run %w[ --scribe --text He\ there ]
|
97
|
+
after = Time.now.to_f
|
98
|
+
|
99
|
+
verses = Oughtve::Tangent.first(:name => "scriby").current_chapter.verses
|
100
|
+
verses.size.should == 1
|
101
|
+
verses.first.text.should == "He there"
|
102
|
+
|
103
|
+
(before..after).should include(verses.first.time.to_f)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "is not stricken" do
|
107
|
+
Oughtve.run %w[ --scribe --text Moo\ there ]
|
108
|
+
|
109
|
+
tangent = Oughtve::Tangent.first :name => "scriby"
|
110
|
+
(!!tangent.current_chapter.verses.first.struck).should_not == true
|
111
|
+
end
|
112
|
+
|
113
|
+
it "assumes any straggling nonoption parameters are a part of the text" do
|
114
|
+
Oughtve.run %w[ --scribe --text Aha there ]
|
115
|
+
|
116
|
+
verses = Oughtve::Tangent.first(:name => "scriby").current_chapter.verses
|
117
|
+
verses.size.should == 1
|
118
|
+
verses.first.text.should == "Aha there"
|
119
|
+
end
|
120
|
+
|
121
|
+
it "will read standard input if no text is given" do
|
122
|
+
$stdin = StringIO.new "Moo, this is standard\ninput!\n\nReally!\n"
|
123
|
+
|
124
|
+
Oughtve.run %w[ --scribe ]
|
125
|
+
|
126
|
+
verses = Oughtve::Tangent.first(:name => "scriby").current_chapter.verses
|
127
|
+
verses.size.should == 1
|
128
|
+
verses.first.text.should == "Moo, this is standard\ninput!\n\nReally!"
|
129
|
+
end
|
130
|
+
|
131
|
+
it "raises an error if no message is given even in standard input" do
|
132
|
+
$stdin = StringIO.new ""
|
133
|
+
|
134
|
+
lambda { Oughtve.run %w[ --scribe --tangent scriby ] }.should raise_error
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
data/spec/show_spec.rb
ADDED
@@ -0,0 +1,247 @@
|
|
1
|
+
require File.join File.dirname(__FILE__), "spec_helper"
|
2
|
+
|
3
|
+
describe Oughtve, "viewing notes given a tangent name" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
7
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
8
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
9
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
10
|
+
end
|
11
|
+
|
12
|
+
after :each do
|
13
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
14
|
+
end
|
15
|
+
|
16
|
+
it "raises if named tangent cannot be found" do
|
17
|
+
Oughtve::Tangent.all.size.should == 2
|
18
|
+
|
19
|
+
lambda { Oughtve.run %w[ --show --tangent nonesuch ] }.should raise_error
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe Oughtve, "viewing notes without output options" do
|
24
|
+
|
25
|
+
before :each do
|
26
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
27
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
28
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
29
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
30
|
+
end
|
31
|
+
|
32
|
+
after :each do
|
33
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
34
|
+
end
|
35
|
+
|
36
|
+
it "produces a string containing text for all open notes for tangent" do
|
37
|
+
outputs = Oughtve.run(%w[ --show --tangent tangy ]).split "\n"
|
38
|
+
outputs.reject! {|line| line.nil? or line.empty? or line.strip =~ /^(-|=)+$/ }
|
39
|
+
|
40
|
+
outputs.shift.should =~ /tangy/
|
41
|
+
outputs.shift.should =~ /Open/
|
42
|
+
outputs.shift.should =~ /Hi james!/
|
43
|
+
outputs.shift.should =~ /Hi Mike!/
|
44
|
+
outputs.shift.should =~ /Hi bob!/
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe Oughtve, "viewing notes with --verbose" do
|
50
|
+
|
51
|
+
before :each do
|
52
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
53
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
54
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
55
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
56
|
+
end
|
57
|
+
|
58
|
+
after :each do
|
59
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
60
|
+
end
|
61
|
+
|
62
|
+
it "includes time when note was scribed" do
|
63
|
+
outputs = Oughtve.run(%w[ --show --tangent tangy --verbose ]).split "\n"
|
64
|
+
outputs.reject! {|line| line.nil? or line.empty? or line.strip =~ /^(-|=)+$/ }
|
65
|
+
verses = Oughtve::Tangent.first(:name => "tangy").current_chapter.verses.reverse
|
66
|
+
|
67
|
+
outputs.shift.should =~ /tangy/
|
68
|
+
outputs.shift.should =~ /Open/
|
69
|
+
|
70
|
+
output = outputs.shift
|
71
|
+
output.should =~ /Hi james!/
|
72
|
+
output.should =~ /##{verses[0].id}/
|
73
|
+
Time.parse(output.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)[0]).to_i.should == verses[0].time.to_i
|
74
|
+
|
75
|
+
output = outputs.shift
|
76
|
+
output.should =~ /Hi Mike!/
|
77
|
+
output.should =~ /##{verses[1].id}/
|
78
|
+
Time.parse(output.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)[0]).to_i.should == verses[1].time.to_i
|
79
|
+
|
80
|
+
output = outputs.shift
|
81
|
+
output.should =~ /Hi bob!/
|
82
|
+
output.should =~ /##{verses[2].id}/
|
83
|
+
Time.parse(output.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)[0]).to_i.should == verses[2].time.to_i
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe Oughtve, "viewing notes" do
|
88
|
+
|
89
|
+
before :each do
|
90
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
91
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
92
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
93
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
94
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ j ]
|
95
|
+
end
|
96
|
+
|
97
|
+
after :each do
|
98
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
99
|
+
end
|
100
|
+
|
101
|
+
it "does not show stricken notes" do
|
102
|
+
outputs = Oughtve.run(%w[ --show --tangent tangy ]).split "\n"
|
103
|
+
outputs.reject! {|line| line.nil? or line.empty? or line.strip =~ /^(-|=)+$/ }
|
104
|
+
|
105
|
+
outputs.shift.should =~ /tangy/
|
106
|
+
outputs.shift.should =~ /Open/
|
107
|
+
outputs.shift.should =~ /Hi Mike!/
|
108
|
+
outputs.shift.should =~ /Hi bob!/
|
109
|
+
|
110
|
+
outputs.should be_empty
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe Oughtve, "viewing both stricken and open notes with all" do
|
115
|
+
before :each do
|
116
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
117
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
118
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
119
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
120
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ M ]
|
121
|
+
end
|
122
|
+
|
123
|
+
after :each do
|
124
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
125
|
+
end
|
126
|
+
|
127
|
+
it "shows stricken notes" do
|
128
|
+
outputs = Oughtve.run(%w[ --show all --tangent tangy ]).split "\n"
|
129
|
+
outputs.reject! {|line| line.nil? or line.empty? or line.strip =~ /^(-|=)+$/ }
|
130
|
+
|
131
|
+
outputs.shift.should =~ /tangy/
|
132
|
+
outputs.shift.should =~ /Open/
|
133
|
+
|
134
|
+
outputs.shift.should =~ /Hi james!/
|
135
|
+
outputs.shift.should =~ /Hi bob!/
|
136
|
+
|
137
|
+
outputs.shift.should =~ /Closed/
|
138
|
+
outputs.shift.should =~ /Hi Mike!/
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe Oughtve, "viewing every note for a tangent form current and previous chapters with everything" do
|
143
|
+
before :each do
|
144
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
145
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
146
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
147
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
148
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ M ]
|
149
|
+
Oughtve.run %w[ --chapter End of part 1 --tangent tangy ]
|
150
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mo! ]
|
151
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Bo! ]
|
152
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ B ]
|
153
|
+
Oughtve.run %w[ --chapter End of part 2 --tangent tangy ]
|
154
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi go! ]
|
155
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi lo! ]
|
156
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ l ]
|
157
|
+
end
|
158
|
+
|
159
|
+
after :each do
|
160
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
161
|
+
end
|
162
|
+
|
163
|
+
it "shows all notes from this and previous chapters" do
|
164
|
+
outputs = Oughtve.run(%w[ --show old --tangent tangy ]).split "\n"
|
165
|
+
outputs.reject! {|line| line.nil? or line.empty? or line.strip =~ /^(-|=)+$/ }
|
166
|
+
|
167
|
+
outputs.shift.should =~ /tangy/
|
168
|
+
|
169
|
+
outputs.shift.should =~ /Open/
|
170
|
+
outputs.shift.should =~ /Hi go!/
|
171
|
+
|
172
|
+
outputs.shift.should =~ /Closed/
|
173
|
+
outputs.shift.should =~ /Hi lo!/
|
174
|
+
|
175
|
+
outputs.shift.should =~ /End of part 2/
|
176
|
+
|
177
|
+
outputs.shift.should =~ /Open/
|
178
|
+
outputs.shift.should =~ /Hi Mo!/
|
179
|
+
|
180
|
+
outputs.shift.should =~ /Closed/
|
181
|
+
outputs.shift.should =~ /Hi Bo!/
|
182
|
+
|
183
|
+
outputs.shift.should =~ /End of part 1/
|
184
|
+
|
185
|
+
outputs.shift.should =~ /Open/
|
186
|
+
outputs.shift.should =~ /Hi james!/
|
187
|
+
outputs.shift.should =~ /Hi bob!/
|
188
|
+
|
189
|
+
outputs.shift.should =~ /Closed/
|
190
|
+
outputs.shift.should =~ /Hi Mike!/
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
describe Oughtve, "dumping a Tangent to YAML" do
|
195
|
+
before :each do
|
196
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
197
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
198
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
199
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
200
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ M ]
|
201
|
+
Oughtve.run %w[ --chapter End of part 1 --tangent tangy ]
|
202
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mo! ]
|
203
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Bo! ]
|
204
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ B ]
|
205
|
+
Oughtve.run %w[ --chapter End of part 2 --tangent tangy ]
|
206
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi go! ]
|
207
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi lo! ]
|
208
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ l ]
|
209
|
+
end
|
210
|
+
|
211
|
+
after :each do
|
212
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
213
|
+
end
|
214
|
+
|
215
|
+
it "contains all the data.. *sigh*" do
|
216
|
+
pending "Need to match all the data"
|
217
|
+
fail
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe Oughtve, "dumping a Tangent to JSON" do
|
222
|
+
before :each do
|
223
|
+
Oughtve.run %w[ --new --tangent tangy --directory /tmp ]
|
224
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi bob! ]
|
225
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mike! ]
|
226
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi james! ]
|
227
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ M ]
|
228
|
+
Oughtve.run %w[ --chapter End of part 1 --tangent tangy ]
|
229
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Mo! ]
|
230
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi Bo! ]
|
231
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ B ]
|
232
|
+
Oughtve.run %w[ --chapter End of part 2 --tangent tangy ]
|
233
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi go! ]
|
234
|
+
Oughtve.run %w[ --scribe --tangent tangy Hi lo! ]
|
235
|
+
Oughtve.run %w[ --strike --tangent tangy --match Hi\ l ]
|
236
|
+
end
|
237
|
+
|
238
|
+
after :each do
|
239
|
+
Oughtve::Tangent.all(:name.not => "default").each {|t| t.destroy }
|
240
|
+
end
|
241
|
+
|
242
|
+
it "contains all the data.. *sigh*" do
|
243
|
+
pending "Need to match all the data"
|
244
|
+
fail
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|