tracco 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Gemfile.lock +1 -1
- data/lib/tracco/tracked_card.rb +8 -0
- data/lib/tracco/version.rb +1 -1
- data/spec/tracked_card_spec.rb +61 -1
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
0.0.11
|
2
|
+
- Adding a TrackedCard.all_tracked_cards method to fetch all cards with a valid tracking. Moreover, sorting_options can be passed to sort using a method e.g. TrackedCard.all_tracked_cards(:method => :name, :order => :desc)
|
3
|
+
|
1
4
|
0.0.10
|
2
5
|
- Including Mongoid::MultiParameterAttributes in Effort and Estimate to enable date params to be collected correctly by Rails app (e.g. using the Rails' date_select form helper)
|
3
6
|
|
data/Gemfile.lock
CHANGED
data/lib/tracco/tracked_card.rb
CHANGED
@@ -33,6 +33,14 @@ class TrackedCard
|
|
33
33
|
return tracked_card if updated_successfully
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.all_tracked_cards(sorting_options = {})
|
37
|
+
cards = all.reject(&:no_tracking?)
|
38
|
+
|
39
|
+
cards = cards.sort_by(&sorting_options[:method].to_sym) if sorting_options[:method]
|
40
|
+
|
41
|
+
sorting_options[:order] == :desc ? cards.reverse : cards
|
42
|
+
end
|
43
|
+
|
36
44
|
def status
|
37
45
|
if done?
|
38
46
|
:done
|
data/lib/tracco/version.rb
CHANGED
data/spec/tracked_card_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe TrackedCard do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe ".find_by_trello_id" do
|
34
|
-
it "
|
34
|
+
it "finds a card given its Trello id" do
|
35
35
|
card = TrackedCard.create(name: "any card", short_id: 1234, trello_id: "1")
|
36
36
|
another_card = TrackedCard.create(name: "another card", short_id: 3456, trello_id: "2")
|
37
37
|
|
@@ -40,6 +40,66 @@ describe TrackedCard do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
describe ".all_tracked_cards" do
|
44
|
+
it "finds all tracked cards with a valid tracking" do
|
45
|
+
card = TrackedCard.create(name: "any card", short_id: 1234, trello_id: "1")
|
46
|
+
card.estimates << Estimate.new(amount: 5, date: Date.today)
|
47
|
+
card.efforts << Effort.new(amount: 3, date: Date.today, members: [piero])
|
48
|
+
|
49
|
+
card_without_tracking = TrackedCard.create(name: "another card", short_id: 3456, trello_id: "2")
|
50
|
+
|
51
|
+
|
52
|
+
TrackedCard.all_tracked_cards.should == [card]
|
53
|
+
end
|
54
|
+
|
55
|
+
it "optionally sorts the cards using a given sorting method" do
|
56
|
+
# TODO introduce a factory (fabricator?)
|
57
|
+
card = TrackedCard.create(name: "AAA", short_id: 1234, trello_id: "1")
|
58
|
+
card.estimates << Estimate.new(amount: 5, date: Date.today)
|
59
|
+
card.efforts << Effort.new(amount: 3, date: Date.today, members: [piero])
|
60
|
+
|
61
|
+
another_card = TrackedCard.create(name: "ZZZ", short_id: 1235, trello_id: "2")
|
62
|
+
another_card.estimates << Estimate.new(amount: 5, date: Date.today)
|
63
|
+
another_card.efforts << Effort.new(amount: 3, date: Date.today, members: [piero])
|
64
|
+
|
65
|
+
card_without_tracking = TrackedCard.create(name: "another card", short_id: 3456, trello_id: "2")
|
66
|
+
|
67
|
+
TrackedCard.all_tracked_cards(:method => :name).should == [card, another_card]
|
68
|
+
end
|
69
|
+
|
70
|
+
it "applies an optional sorting order" do
|
71
|
+
# TODO introduce a factory (fabricator?)
|
72
|
+
card = TrackedCard.create(name: "AAA", short_id: 1234, trello_id: "1")
|
73
|
+
card.estimates << Estimate.new(amount: 5, date: Date.today)
|
74
|
+
card.efforts << Effort.new(amount: 3, date: Date.today, members: [piero])
|
75
|
+
|
76
|
+
another_card = TrackedCard.create(name: "ZZZ", short_id: 1235, trello_id: "2")
|
77
|
+
another_card.estimates << Estimate.new(amount: 5, date: Date.today)
|
78
|
+
another_card.efforts << Effort.new(amount: 3, date: Date.today, members: [piero])
|
79
|
+
|
80
|
+
card_without_tracking = TrackedCard.create(name: "another card", short_id: 3456, trello_id: "2")
|
81
|
+
|
82
|
+
TrackedCard.all_tracked_cards(:method => :name, :order => :desc).should == [another_card, card]
|
83
|
+
end
|
84
|
+
|
85
|
+
it "uses the ascending order as default sorting order option" do
|
86
|
+
# TODO introduce a factory (fabricator?)
|
87
|
+
card = TrackedCard.create(name: "AAA", short_id: 44, trello_id: "100")
|
88
|
+
card.estimates << Estimate.new(amount: 5, date: Date.today)
|
89
|
+
card.efforts << Effort.new(amount: 3, date: Date.today, members: [piero])
|
90
|
+
|
91
|
+
another_card = TrackedCard.create(name: "ZZZ", short_id: 12, trello_id: "200")
|
92
|
+
another_card.estimates << Estimate.new(amount: 5, date: Date.today)
|
93
|
+
another_card.efforts << Effort.new(amount: 3, date: Date.today, members: [piero])
|
94
|
+
|
95
|
+
card_without_tracking = TrackedCard.create(name: "another card", short_id: 3456, trello_id: "2")
|
96
|
+
|
97
|
+
TrackedCard.all_tracked_cards(:method => :short_id).should == [another_card, card]
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
end
|
102
|
+
|
43
103
|
describe ".update_or_create_with" do
|
44
104
|
let(:trello_card) { Trello::Card.new("id" => "ABC123", "name" => "a name", "idShort" => 1, "desc" => "any description") }
|
45
105
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
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: 2013-02-
|
12
|
+
date: 2013-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-trello
|
@@ -298,7 +298,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
298
298
|
version: '0'
|
299
299
|
segments:
|
300
300
|
- 0
|
301
|
-
hash:
|
301
|
+
hash: 961343114344696159
|
302
302
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
303
303
|
none: false
|
304
304
|
requirements:
|