flyboy 0.0.1 → 0.0.2
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/app/controllers/flyboy/task_comments_controller.rb +2 -2
- data/app/models/flyboy/ability.rb +11 -3
- data/app/models/flyboy/task.rb +1 -1
- data/lib/flyboy/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +347 -0
- data/spec/dummy/log/test.log +6528 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/models/flyboy/ability_spec.rb +87 -4
- data/spec/models/flyboy/task_spec.rb +2 -2
- metadata +6 -4
@@ -0,0 +1 @@
|
|
1
|
+
8834
|
@@ -6,14 +6,47 @@ describe Flyboy::Ability do
|
|
6
6
|
}
|
7
7
|
|
8
8
|
describe Flyboy::Goal do
|
9
|
+
it "can create goals" do
|
10
|
+
expect(ability.can?(:create, Flyboy::Goal.new)).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "can read goals" do
|
14
|
+
expect(ability.can?(:read, Flyboy::Goal.new)).to be true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "can update open goals" do
|
18
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "open")
|
19
|
+
expect(ability.can?(:update, goal)).to be true
|
20
|
+
end
|
21
|
+
|
22
|
+
it "can't update closed goals" do
|
23
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "closed")
|
24
|
+
expect(ability.can?(:update, goal)).to be false
|
25
|
+
end
|
26
|
+
|
27
|
+
it "can delete open goals" do
|
28
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "open")
|
29
|
+
expect(ability.can?(:delete, goal)).to be true
|
30
|
+
end
|
31
|
+
|
32
|
+
it "can't delete closed goals" do
|
33
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "closed")
|
34
|
+
expect(ability.can?(:delete, goal)).to be false
|
35
|
+
end
|
36
|
+
|
37
|
+
it "can close open goal" do
|
38
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "open")
|
39
|
+
expect(ability.can?(:close, goal)).to be true
|
40
|
+
end
|
41
|
+
|
9
42
|
it "can't close already closed goal" do
|
10
43
|
goal = FactoryGirl.create(:flyboy_goal, status: "closed")
|
11
44
|
expect(ability.can?(:close, goal)).to be false
|
12
45
|
end
|
13
46
|
|
14
|
-
it "can
|
15
|
-
goal = FactoryGirl.create(:flyboy_goal, status: "
|
16
|
-
expect(ability.can?(:open, goal)).to be
|
47
|
+
it "can open closed goal" do
|
48
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "closed")
|
49
|
+
expect(ability.can?(:open, goal)).to be true
|
17
50
|
end
|
18
51
|
|
19
52
|
it "can't close goals with undone tasks" do
|
@@ -21,20 +54,70 @@ describe Flyboy::Ability do
|
|
21
54
|
goal = task.goal
|
22
55
|
expect(ability.can?(:close, goal)).to be false
|
23
56
|
end
|
57
|
+
|
58
|
+
it "can't open already open goal" do
|
59
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "open")
|
60
|
+
expect(ability.can?(:open, goal)).to be false
|
61
|
+
end
|
24
62
|
end
|
25
63
|
|
26
64
|
describe Flyboy::Task do
|
65
|
+
it "can create task in an open goal" do
|
66
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "open")
|
67
|
+
task = goal.tasks.new
|
68
|
+
expect(ability.can?(:create, task)).to be true
|
69
|
+
end
|
70
|
+
|
27
71
|
it "can't create task in a closed goal" do
|
28
72
|
goal = FactoryGirl.create(:flyboy_goal, status: "closed")
|
29
73
|
task = goal.tasks.new
|
30
74
|
expect(ability.can?(:create, task)).to be false
|
31
75
|
end
|
32
76
|
|
77
|
+
it "can read task" do
|
78
|
+
task = FactoryGirl.create(:flyboy_task)
|
79
|
+
expect(ability.can?(:read, task)).to be true
|
80
|
+
end
|
81
|
+
|
82
|
+
it "can update task in an open goal" do
|
83
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "open")
|
84
|
+
task = FactoryGirl.create(:flyboy_task, goal: goal)
|
85
|
+
expect(ability.can?(:update, task)).to be true
|
86
|
+
end
|
87
|
+
|
88
|
+
it "can't update task in an closed goal" do
|
89
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "closed")
|
90
|
+
task = FactoryGirl.create(:flyboy_task, goal: goal)
|
91
|
+
expect(ability.can?(:update, task)).to be false
|
92
|
+
end
|
93
|
+
|
94
|
+
it "can delete task in an open goal" do
|
95
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "open")
|
96
|
+
task = FactoryGirl.create(:flyboy_task, goal: goal)
|
97
|
+
expect(ability.can?(:delete, task)).to be true
|
98
|
+
end
|
99
|
+
|
100
|
+
it "can't delete task in an closed goal" do
|
101
|
+
goal = FactoryGirl.create(:flyboy_goal, status: "closed")
|
102
|
+
task = FactoryGirl.create(:flyboy_task, goal: goal)
|
103
|
+
expect(ability.can?(:delete, task)).to be false
|
104
|
+
end
|
105
|
+
|
106
|
+
it "can complete a undone task" do
|
107
|
+
task = FactoryGirl.create(:flyboy_task, done: false)
|
108
|
+
expect(ability.can?(:complete, task)).to be true
|
109
|
+
end
|
110
|
+
|
33
111
|
it "can't complete a done task" do
|
34
112
|
task = FactoryGirl.create(:flyboy_task, done: true)
|
35
113
|
expect(ability.can?(:complete, task)).to be false
|
36
114
|
end
|
37
115
|
|
116
|
+
it "can snooze a done task" do
|
117
|
+
task = FactoryGirl.create(:flyboy_task, done: false)
|
118
|
+
expect(ability.can?(:snooze, task)).to be true
|
119
|
+
end
|
120
|
+
|
38
121
|
it "can't snooze a done task" do
|
39
122
|
task = FactoryGirl.create(:flyboy_task, done: true)
|
40
123
|
expect(ability.can?(:snooze, task)).to be false
|
@@ -44,6 +127,6 @@ describe Flyboy::Ability do
|
|
44
127
|
task = FactoryGirl.create(:flyboy_task, reminder: Date.today, term: Date.tomorrow)
|
45
128
|
expect(ability.can?(:snooze, task)).to be false
|
46
129
|
end
|
47
|
-
|
48
130
|
end
|
131
|
+
|
49
132
|
end
|
@@ -49,7 +49,7 @@ describe Flyboy::Task do
|
|
49
49
|
it "should snooze the reminder and term with default value" do
|
50
50
|
@task.snooze
|
51
51
|
@task.reminder.should eq Date.today + 2
|
52
|
-
@task.term.should eq Date.today +
|
52
|
+
@task.term.should eq Date.today + 35
|
53
53
|
end
|
54
54
|
|
55
55
|
context 'reminder too far is the past' do
|
@@ -71,7 +71,7 @@ describe Flyboy::Task do
|
|
71
71
|
it "should snooze the reminder and term with default value from current date" do
|
72
72
|
@task.snooze
|
73
73
|
@task.reminder.should eq @today + 7
|
74
|
-
@task.term.should eq @today +
|
74
|
+
@task.term.should eq @today + 30
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flyboy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -509,6 +509,7 @@ files:
|
|
509
509
|
- spec/dummy/tmp/cache/assets/test/sprockets/f3d6b09d91357b801c3937fc4f785460
|
510
510
|
- spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
511
511
|
- spec/dummy/tmp/cache/assets/test/sprockets/f9538cdf7ea59e952582e047cece33ba
|
512
|
+
- spec/dummy/tmp/pids/server.pid
|
512
513
|
- spec/factories/flyboy_goals.rb
|
513
514
|
- spec/factories/flyboy_tasks.rb
|
514
515
|
- spec/factories/task_comments.rb
|
@@ -537,7 +538,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
537
538
|
version: '0'
|
538
539
|
segments:
|
539
540
|
- 0
|
540
|
-
hash:
|
541
|
+
hash: -840865376447202069
|
541
542
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
542
543
|
none: false
|
543
544
|
requirements:
|
@@ -546,7 +547,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
546
547
|
version: '0'
|
547
548
|
segments:
|
548
549
|
- 0
|
549
|
-
hash:
|
550
|
+
hash: -840865376447202069
|
550
551
|
requirements: []
|
551
552
|
rubyforge_project:
|
552
553
|
rubygems_version: 1.8.23.2
|
@@ -884,6 +885,7 @@ test_files:
|
|
884
885
|
- spec/dummy/tmp/cache/assets/test/sprockets/f3d6b09d91357b801c3937fc4f785460
|
885
886
|
- spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
886
887
|
- spec/dummy/tmp/cache/assets/test/sprockets/f9538cdf7ea59e952582e047cece33ba
|
888
|
+
- spec/dummy/tmp/pids/server.pid
|
887
889
|
- spec/factories/flyboy_goals.rb
|
888
890
|
- spec/factories/flyboy_tasks.rb
|
889
891
|
- spec/factories/task_comments.rb
|