things-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.rdoc +114 -0
- data/Rakefile +44 -0
- data/VERSION +1 -0
- data/lib/appscript/reference.rb +9 -0
- data/lib/things/app.rb +30 -0
- data/lib/things/area.rb +12 -0
- data/lib/things/collections/todo.rb +42 -0
- data/lib/things/list.rb +18 -0
- data/lib/things/project.rb +12 -0
- data/lib/things/reference/base.rb +14 -0
- data/lib/things/reference/inheritance.rb +29 -0
- data/lib/things/reference/record.rb +121 -0
- data/lib/things/status.rb +8 -0
- data/lib/things/tag.rb +12 -0
- data/lib/things/todo.rb +18 -0
- data/lib/things.rb +28 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/things/app_spec.rb +43 -0
- data/spec/things/area_spec.rb +153 -0
- data/spec/things/collections/todo_spec.rb +54 -0
- data/spec/things/project_spec.rb +153 -0
- data/spec/things/tag_spec.rb +153 -0
- data/spec/things/todo_spec.rb +160 -0
- data/spec/things_spec.rb +15 -0
- data/things.gemspec +68 -0
- metadata +110 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Things::Area" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Things::App.activate
|
7
|
+
@area = Things::Area.new(:name => 'TEST - Foo')
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
# close all windows when done
|
12
|
+
Things::App.instance.windows.get.each do |window|
|
13
|
+
Things::App.instance!.close(window)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#self.new" do
|
18
|
+
|
19
|
+
it "should create a new Things::Area instance with properties" do
|
20
|
+
@area.name.should == "TEST - Foo"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should not be sent to Things yet" do
|
24
|
+
@area.id_.should == nil
|
25
|
+
Things::App.instance.areas.get.collect { |area| area.name.get }.should_not include("TEST - Foo")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#new?" do
|
31
|
+
|
32
|
+
it "should return whether the instance is new or not" do
|
33
|
+
@area.new?.should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#save" do
|
39
|
+
|
40
|
+
before do
|
41
|
+
@area.save
|
42
|
+
end
|
43
|
+
|
44
|
+
after do
|
45
|
+
@area.delete
|
46
|
+
Things::App.instance.empty_trash
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "on a new area" do
|
50
|
+
|
51
|
+
it "should create the area" do
|
52
|
+
@area.id_.should_not be_nil
|
53
|
+
@area.new?.should == false
|
54
|
+
|
55
|
+
Things::App.instance.areas.get.collect { |area| area.name.get }.should include("TEST - Foo")
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "on an existing area" do
|
61
|
+
it "should update the area" do
|
62
|
+
@area.name = 'TEST - Boo'
|
63
|
+
@area.save
|
64
|
+
@found = Things::Area.find_by_id(@area.id_)
|
65
|
+
@found.name.should == 'TEST - Boo'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#create' do
|
72
|
+
|
73
|
+
before do
|
74
|
+
@area.delete
|
75
|
+
Things::App.instance.empty_trash
|
76
|
+
end
|
77
|
+
|
78
|
+
after do
|
79
|
+
@area.delete
|
80
|
+
Things::App.instance.empty_trash
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should create a new area based on supplied properties" do
|
84
|
+
@area = Things::Area.create(:name => 'TEST - Goo')
|
85
|
+
@area.new?.should == false
|
86
|
+
@area.id_.should_not be_nil
|
87
|
+
@area.name.should == 'TEST - Goo'
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#delete' do
|
94
|
+
|
95
|
+
before do
|
96
|
+
@area.save
|
97
|
+
Things::App.instance.areas.name.get.should include(@area.name)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should remove a area" do
|
101
|
+
@area.delete
|
102
|
+
Things::App.instance.empty_trash
|
103
|
+
Things::App.instance.areas.name.get.should_not include(@area.name)
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'finding' do
|
109
|
+
|
110
|
+
before do
|
111
|
+
@area.save
|
112
|
+
end
|
113
|
+
|
114
|
+
after do
|
115
|
+
@found.class.should == Things::Area
|
116
|
+
@found.id_.should == @area.id_
|
117
|
+
@found.name.should == @area.name
|
118
|
+
|
119
|
+
@area.delete
|
120
|
+
Things::App.instance.empty_trash
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#find_by_name' do
|
124
|
+
|
125
|
+
it "should find a area based on its name" do
|
126
|
+
@found = Things::Area.find_by_name('TEST - Foo')
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
describe '#find_by_id' do
|
132
|
+
|
133
|
+
it "should find a area based on its id" do
|
134
|
+
@found = Things::Area.find_by_id(@area.id_)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#find' do
|
140
|
+
it "should find a area based on its name" do
|
141
|
+
@found = Things::Area.find('TEST - Foo')
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should find a area based on its id" do
|
145
|
+
@found = Things::Area.find(@area.id_)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe "Things::Collections::Todo" do
|
4
|
+
|
5
|
+
describe "#self.all" do
|
6
|
+
before do
|
7
|
+
@todo_a = Things::Todo.create(:name => 'TEST - AAA')
|
8
|
+
@todo_b = Things::Todo.create(:name => 'TEST - BBB')
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
@todo_a.delete
|
13
|
+
@todo_b.delete
|
14
|
+
Things::App.instance.empty_trash
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return a collection of all todos as Things::Todo objects" do
|
18
|
+
Things::Collections::Todo.all.collect(&:id_).should include(@todo_a.id_)
|
19
|
+
Things::Collections::Todo.all.collect(&:id_).should include(@todo_b.id_)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#self.active" do
|
26
|
+
|
27
|
+
before do
|
28
|
+
@todo_a = Things::Todo.create(:name => 'TEST - AAA')
|
29
|
+
@todo_b = Things::Todo.create(:name => 'TEST - BBB')
|
30
|
+
Things::Collections::Todo.active.collect(&:id_).should include(@todo_a.id_)
|
31
|
+
Things::Collections::Todo.active.collect(&:id_).should include(@todo_b.id_)
|
32
|
+
end
|
33
|
+
|
34
|
+
after do
|
35
|
+
@todo_a.delete
|
36
|
+
@todo_b.delete
|
37
|
+
Things::App.instance.empty_trash
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should not include completed todos" do
|
41
|
+
@todo_b.completion_date = Time.now
|
42
|
+
@todo_b.save
|
43
|
+
Things::Collections::Todo.active.collect(&:id_).should include(@todo_a.id_)
|
44
|
+
Things::Collections::Todo.active.collect(&:id_).should_not include(@todo_b.id_)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should not include deleted todos" do
|
48
|
+
@todo_a.delete
|
49
|
+
Things::Collections::Todo.active.collect(&:id_).should_not include(@todo_a.id_)
|
50
|
+
Things::Collections::Todo.active.collect(&:id_).should include(@todo_b.id_)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Things::Project" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Things::App.activate
|
7
|
+
@project = Things::Project.new(:name => 'TEST - Foo')
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
# close all windows when done
|
12
|
+
Things::App.instance.windows.get.each do |window|
|
13
|
+
Things::App.instance!.close(window)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#self.new" do
|
18
|
+
|
19
|
+
it "should create a new Things::Project instance with properties" do
|
20
|
+
@project.name.should == "TEST - Foo"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should not be sent to Things yet" do
|
24
|
+
@project.id_.should == nil
|
25
|
+
Things::App.instance.projects.get.collect { |project| project.name.get }.should_not include("TEST - Foo")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#new?" do
|
31
|
+
|
32
|
+
it "should return whether the instance is new or not" do
|
33
|
+
@project.new?.should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#save" do
|
39
|
+
|
40
|
+
before do
|
41
|
+
@project.save
|
42
|
+
end
|
43
|
+
|
44
|
+
after do
|
45
|
+
@project.delete
|
46
|
+
Things::App.instance.empty_trash
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "on a new project" do
|
50
|
+
|
51
|
+
it "should create the project" do
|
52
|
+
@project.id_.should_not be_nil
|
53
|
+
@project.new?.should == false
|
54
|
+
|
55
|
+
Things::App.instance.projects.get.collect { |project| project.name.get }.should include("TEST - Foo")
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "on an existing project" do
|
61
|
+
it "should update the project" do
|
62
|
+
@project.name = 'TEST - Boo'
|
63
|
+
@project.save
|
64
|
+
@found = Things::Project.find_by_id(@project.id_)
|
65
|
+
@found.name.should == 'TEST - Boo'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#create' do
|
72
|
+
|
73
|
+
before do
|
74
|
+
@project.delete
|
75
|
+
Things::App.instance.empty_trash
|
76
|
+
end
|
77
|
+
|
78
|
+
after do
|
79
|
+
@project.delete
|
80
|
+
Things::App.instance.empty_trash
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should create a new project based on supplied properties" do
|
84
|
+
@project = Things::Project.create(:name => 'TEST - Goo')
|
85
|
+
@project.new?.should == false
|
86
|
+
@project.id_.should_not be_nil
|
87
|
+
@project.name.should == 'TEST - Goo'
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#delete' do
|
94
|
+
|
95
|
+
before do
|
96
|
+
@project.save
|
97
|
+
Things::App.instance.projects.name.get.should include(@project.name)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should remove a project" do
|
101
|
+
@project.delete
|
102
|
+
Things::App.instance.empty_trash
|
103
|
+
Things::App.instance.projects.name.get.should_not include(@project.name)
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'finding' do
|
109
|
+
|
110
|
+
before do
|
111
|
+
@project.save
|
112
|
+
end
|
113
|
+
|
114
|
+
after do
|
115
|
+
@found.class.should == Things::Project
|
116
|
+
@found.id_.should == @project.id_
|
117
|
+
@found.name.should == @project.name
|
118
|
+
|
119
|
+
@project.delete
|
120
|
+
Things::App.instance.empty_trash
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#find_by_name' do
|
124
|
+
|
125
|
+
it "should find a project based on its name" do
|
126
|
+
@found = Things::Project.find_by_name('TEST - Foo')
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
describe '#find_by_id' do
|
132
|
+
|
133
|
+
it "should find a project based on its id" do
|
134
|
+
@found = Things::Project.find_by_id(@project.id_)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#find' do
|
140
|
+
it "should find a project based on its name" do
|
141
|
+
@found = Things::Project.find('TEST - Foo')
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should find a project based on its id" do
|
145
|
+
@found = Things::Project.find(@project.id_)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Things::Tag" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Things::App.activate
|
7
|
+
@tag = Things::Tag.new(:name => 'TEST - Foo')
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
# close all windows when done
|
12
|
+
Things::App.instance.windows.get.each do |window|
|
13
|
+
Things::App.instance!.close(window)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#self.new" do
|
18
|
+
|
19
|
+
it "should create a new Things::Tag instance with properties" do
|
20
|
+
@tag.name.should == "TEST - Foo"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should not be sent to Things yet" do
|
24
|
+
@tag.id_.should == nil
|
25
|
+
Things::App.instance.tags.get.collect { |tag| tag.name.get }.should_not include("TEST - Foo")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#new?" do
|
31
|
+
|
32
|
+
it "should return whether the instance is new or not" do
|
33
|
+
@tag.new?.should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#save" do
|
39
|
+
|
40
|
+
before do
|
41
|
+
@tag.save
|
42
|
+
end
|
43
|
+
|
44
|
+
after do
|
45
|
+
@tag.delete
|
46
|
+
Things::App.instance.empty_trash
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "on a new tag" do
|
50
|
+
|
51
|
+
it "should create the tag" do
|
52
|
+
@tag.id_.should_not be_nil
|
53
|
+
@tag.new?.should == false
|
54
|
+
|
55
|
+
Things::App.instance.tags.get.collect { |tag| tag.name.get }.should include("TEST - Foo")
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "on an existing tag" do
|
61
|
+
it "should update the tag" do
|
62
|
+
@tag.name = 'TEST - Boo'
|
63
|
+
@tag.save
|
64
|
+
@found = Things::Tag.find_by_id(@tag.id_)
|
65
|
+
@found.name.should == 'TEST - Boo'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#create' do
|
72
|
+
|
73
|
+
before do
|
74
|
+
@tag.delete
|
75
|
+
Things::App.instance.empty_trash
|
76
|
+
end
|
77
|
+
|
78
|
+
after do
|
79
|
+
@tag.delete
|
80
|
+
Things::App.instance.empty_trash
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should create a new tag based on supplied properties" do
|
84
|
+
@tag = Things::Tag.create(:name => 'TEST - Goo')
|
85
|
+
@tag.new?.should == false
|
86
|
+
@tag.id_.should_not be_nil
|
87
|
+
@tag.name.should == 'TEST - Goo'
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
describe '#delete' do
|
94
|
+
|
95
|
+
before do
|
96
|
+
@tag.save
|
97
|
+
Things::App.instance.tags.name.get.should include(@tag.name)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should remove a tag" do
|
101
|
+
@tag.delete
|
102
|
+
Things::App.instance.empty_trash
|
103
|
+
Things::App.instance.tags.name.get.should_not include(@tag.name)
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'finding' do
|
109
|
+
|
110
|
+
before do
|
111
|
+
@tag.save
|
112
|
+
end
|
113
|
+
|
114
|
+
after do
|
115
|
+
@found.class.should == Things::Tag
|
116
|
+
@found.id_.should == @tag.id_
|
117
|
+
@found.name.should == @tag.name
|
118
|
+
|
119
|
+
@tag.delete
|
120
|
+
Things::App.instance.empty_trash
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#find_by_name' do
|
124
|
+
|
125
|
+
it "should find a tag based on its name" do
|
126
|
+
@found = Things::Tag.find_by_name('TEST - Foo')
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
describe '#find_by_id' do
|
132
|
+
|
133
|
+
it "should find a tag based on its id" do
|
134
|
+
@found = Things::Tag.find_by_id(@tag.id_)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#find' do
|
140
|
+
it "should find a tag based on its name" do
|
141
|
+
@found = Things::Tag.find('TEST - Foo')
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should find a tag based on its id" do
|
145
|
+
@found = Things::Tag.find(@tag.id_)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe "Things::Todo" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Things::App.activate
|
7
|
+
@todo = Things::Todo.new(:name => 'TEST - Foo', :notes => 'TEST - Fooer')
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
# close all windows when done
|
12
|
+
Things::App.instance.windows.get.each do |window|
|
13
|
+
Things::App.instance!.close(window)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#self.new" do
|
18
|
+
|
19
|
+
it "should create a new Things::Todo instance with properties" do
|
20
|
+
@todo.name.should == "TEST - Foo"
|
21
|
+
@todo.notes.should == "TEST - Fooer"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should not be sent to Things yet" do
|
25
|
+
@todo.id_.should == nil
|
26
|
+
active = (Things::App.instance.todos.get - Things::List.trash.todos.get)
|
27
|
+
active.collect { |todo| todo.name.get }.should_not include("TEST - Foo")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#new?" do
|
33
|
+
|
34
|
+
it "should return whether the instance is new or not" do
|
35
|
+
@todo.new?.should == true
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#save" do
|
41
|
+
|
42
|
+
before do
|
43
|
+
@todo.save
|
44
|
+
end
|
45
|
+
|
46
|
+
after do
|
47
|
+
@todo.delete
|
48
|
+
Things::App.instance.empty_trash
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "on a new todo" do
|
52
|
+
|
53
|
+
it "should create the todo" do
|
54
|
+
@todo.id_.should_not be_nil
|
55
|
+
@todo.new?.should == false
|
56
|
+
active = (Things::App.instance.todos.get - Things::List.trash.todos.get)
|
57
|
+
active.collect { |todo| todo.name.get }.should include("TEST - Foo")
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "on an existing todo" do
|
63
|
+
it "should update the todo" do
|
64
|
+
@todo.name = 'TEST - Boo'
|
65
|
+
@todo.save
|
66
|
+
@found = Things::Todo.find_by_id(@todo.id_)
|
67
|
+
@found.name.should == 'TEST - Boo'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#create' do
|
74
|
+
|
75
|
+
before do
|
76
|
+
@todo.delete
|
77
|
+
Things::App.instance.empty_trash
|
78
|
+
end
|
79
|
+
|
80
|
+
after do
|
81
|
+
@todo.delete
|
82
|
+
Things::App.instance.empty_trash
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should create a new todo based on supplied properties" do
|
86
|
+
@todo = Things::Todo.create(:name => 'TEST - Goo')
|
87
|
+
@todo.new?.should == false
|
88
|
+
@todo.id_.should_not be_nil
|
89
|
+
@todo.name.should == 'TEST - Goo'
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
describe '#delete' do
|
96
|
+
|
97
|
+
before do
|
98
|
+
@todo.save
|
99
|
+
Things::App.lists.inbox.todos.name.get.should include(@todo.name)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should remove a todo" do
|
103
|
+
@todo.delete
|
104
|
+
Things::App.lists.inbox.todos.name.get.should_not include(@todo.name)
|
105
|
+
Things::App.lists.trash.todos.name.get.should include(@todo.name)
|
106
|
+
end
|
107
|
+
|
108
|
+
after do
|
109
|
+
Things::App.instance.empty_trash
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
describe 'finding' do
|
115
|
+
|
116
|
+
before do
|
117
|
+
@todo.save
|
118
|
+
end
|
119
|
+
|
120
|
+
after do
|
121
|
+
@found.class.should == Things::Todo
|
122
|
+
@found.id_.should == @todo.id_
|
123
|
+
@found.name.should == @todo.name
|
124
|
+
@found.notes.should == @todo.notes
|
125
|
+
|
126
|
+
@todo.delete
|
127
|
+
Things::App.instance.empty_trash
|
128
|
+
end
|
129
|
+
|
130
|
+
describe '#find_by_name' do
|
131
|
+
|
132
|
+
it "should find a todo based on its name" do
|
133
|
+
@found = Things::Todo.find_by_name('TEST - Foo')
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
describe '#find_by_id' do
|
139
|
+
|
140
|
+
it "should find a todo based on its id" do
|
141
|
+
@found = Things::Todo.find_by_id(@todo.id_)
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
describe '#find' do
|
147
|
+
it "should find a todo based on its name" do
|
148
|
+
@found = Things::Todo.find('TEST - Foo')
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should find a todo based on its id" do
|
152
|
+
@found = Things::Todo.find(@todo.id_)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
end
|
data/spec/things_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Things" do
|
4
|
+
|
5
|
+
it "should load appropriate classes and modules" do
|
6
|
+
lambda do
|
7
|
+
Things::App
|
8
|
+
Things::Todo
|
9
|
+
Things::List
|
10
|
+
Things::Status
|
11
|
+
Things::Collections::Todo
|
12
|
+
end.should_not raise_error(NameError)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|