campaign_cash 2.6.2 → 2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module CampaignCash
2
- VERSION = "2.6.2"
2
+ VERSION = "2.7"
3
3
  end
@@ -1,93 +1,93 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class TestCampaignCash::TestCandidate < Test::Unit::TestCase
4
- include CampaignCash
5
-
6
- context "Candidate.create" do
7
- setup do
8
- reply = Base.invoke('2010/candidates/H4NY07011', {})
9
- @result = reply['results'].first
10
- @candidate = Candidate.create(@result)
11
- end
12
-
13
- should "return an object of the Candidate type" do
14
- assert_kind_of(Candidate, @candidate)
15
- end
16
-
17
- %w(name id party fec_uri).each do |attr|
18
- should "assign the value of the @#{attr} attribute from the '#{attr}' key in the hash" do
19
- assert_equal(@result[attr], @candidate.send(attr))
20
- end
21
- end
22
-
23
- should "assign the committee_id to a stripped version of the attribute from the 'committee' key in the hash" do
4
+ include CampaignCash
5
+
6
+ context "Candidate.create" do
7
+ setup do
8
+ reply = Base.invoke('2010/candidates/H4NY07011', {})
9
+ @result = reply['results'].first
10
+ @candidate = Candidate.create(@result)
11
+ end
12
+
13
+ should "return an object of the Candidate type" do
14
+ assert_kind_of(Candidate, @candidate)
15
+ end
16
+
17
+ %w(name id party fec_uri).each do |attr|
18
+ should "assign the value of the @#{attr} attribute from the '#{attr}' key in the hash" do
19
+ assert_equal(@result[attr], @candidate.send(attr))
20
+ end
21
+ end
22
+
23
+ should "assign the committee_id to a stripped version of the attribute from the 'committee' key in the hash" do
24
24
  assert_equal(Base.parse_committee(@result['committee']), @candidate.committee_id)
25
25
  end
26
26
 
27
27
  end
28
-
29
- context "Candidate search" do
30
- setup do
31
- reply = Base.invoke('2010/candidates/search', {:query => "Udall"})
32
- @results = reply['results']
33
- @candidates = @results.map{|c| Candidate.create_from_search_results(c)}
34
- end
35
-
36
- should "return two candidate objects" do
37
- assert_equal @candidates.size, 2
38
- assert_kind_of(Candidate, @candidates.first)
39
- assert_kind_of(Candidate, @candidates.last)
40
- end
41
-
42
- should "assign the committee_id to a stripped version of the attribute from the 'committee' key in the hash" do
28
+
29
+ context "Candidate search" do
30
+ setup do
31
+ reply = Base.invoke('2014/candidates/search', {:query => "Udall"})
32
+ @results = reply['results']
33
+ @candidates = @results.map{|c| Candidate.create_from_search_results(c)}
34
+ end
35
+
36
+ should "return two candidate objects" do
37
+ assert_equal @candidates.size, 2
38
+ assert_kind_of(Candidate, @candidates.first)
39
+ assert_kind_of(Candidate, @candidates.last)
40
+ end
41
+
42
+ should "assign the committee_id to a stripped version of the attribute from the 'committee' key in the hash" do
43
43
  assert_equal(Base.parse_committee(@results.first['committee']), @candidates.first.committee_id)
44
44
  end
45
-
46
- end
47
-
48
- context "New Candidates" do
49
- setup do
50
- reply = Base.invoke('2012/candidates/new', {})
51
- results = reply['results']
52
- @candidates = results.map{|c| Candidate.create(c)}
53
- end
54
-
55
- should "return 20 new candidates" do
56
- assert_equal @candidates.size, 20
57
- assert_kind_of(Candidate, @candidates.first)
58
- assert_kind_of(Candidate, @candidates.last)
59
- end
60
- end
61
-
62
- context "candidate leaders" do
63
- setup do
64
- reply = Base.invoke('2012/candidates/leaders/end-cash', {})
65
- results = reply['results']
66
- @candidates = results.map{|c| Candidate.create(c)}
67
- end
68
-
69
- should "return 20 candidates each with a greater end_cash value than the next" do
70
- assert (@candidates[0].end_cash >= @candidates[1].end_cash)
71
- assert (@candidates[1].end_cash >= @candidates[2].end_cash)
72
- assert (@candidates[2].end_cash >= @candidates[3].end_cash)
73
- end
74
- end
75
-
76
- context "state candidates" do
77
- should "return 32 total candidates from Rhode Island" do
78
- assert_equal Candidate.state('RI', nil, nil, 2010).size, 32
45
+
46
+ end
47
+
48
+ context "New Candidates" do
49
+ setup do
50
+ reply = Base.invoke('2012/candidates/new', {})
51
+ results = reply['results']
52
+ @candidates = results.map{|c| Candidate.create(c)}
53
+ end
54
+
55
+ should "return 20 new candidates" do
56
+ assert_equal @candidates.size, 20
57
+ assert_kind_of(Candidate, @candidates.first)
58
+ assert_kind_of(Candidate, @candidates.last)
79
59
  end
80
-
81
- should "return 29 House candidates from Rhode Island" do
82
- assert_equal Candidate.state('RI', "house", nil, 2010).size, 29
83
- end
84
-
85
- should "return least 3 Senate candidates from Rhode Island" do
86
- assert_equal Candidate.state('RI', "senate", nil, 2010).size, 3
87
- end
88
-
89
- should "return 17 House candidates from District 1 of Rhode Island" do
90
- assert_equal Candidate.state('RI', "house", 1, 2010).size, 17
91
- end
92
- end
60
+ end
61
+
62
+ context "candidate leaders" do
63
+ setup do
64
+ reply = Base.invoke('2012/candidates/leaders/end-cash', {})
65
+ results = reply['results']
66
+ @candidates = results.map{|c| Candidate.create(c)}
67
+ end
68
+
69
+ should "return 20 candidates each with a greater end_cash value than the next" do
70
+ assert (@candidates[0].end_cash >= @candidates[1].end_cash)
71
+ assert (@candidates[1].end_cash >= @candidates[2].end_cash)
72
+ assert (@candidates[2].end_cash >= @candidates[3].end_cash)
73
+ end
74
+ end
75
+
76
+ context "state candidates" do
77
+ should "return 32 total candidates from Rhode Island" do
78
+ assert_equal Candidate.state('RI', nil, nil, 2010).size, 24
79
+ end
80
+
81
+ should "return 29 House candidates from Rhode Island" do
82
+ assert_equal Candidate.state('RI', "house", nil, 2010).size, 24
83
+ end
84
+
85
+ should "return least 3 Senate candidates from Rhode Island" do
86
+ assert_equal Candidate.state('RI', "senate", nil, 2012).size, 3
87
+ end
88
+
89
+ should "return 17 House candidates from District 1 of Rhode Island" do
90
+ assert_equal Candidate.state('RI', "house", 1, 2010).size, 14
91
+ end
92
+ end
93
93
  end
@@ -78,8 +78,8 @@ class TestCampaignCash::TestCommittee < Test::Unit::TestCase
78
78
  @committee = Committee.find('C00084475', 2012)
79
79
  end
80
80
 
81
- should "return 16 other cycles" do
82
- assert_equal @committee.other_cycles.size, 16
81
+ should "return 17 other cycles" do
82
+ assert_equal @committee.other_cycles.size, 17
83
83
  end
84
84
  end
85
85
 
@@ -4,18 +4,31 @@ class TestCampaignCash::TestElectioneeringCommunication < Test::Unit::TestCase
4
4
  include CampaignCash
5
5
 
6
6
  context "get electioneering communications" do
7
- objs_collection = []
8
- objs_collection << ElectioneeringCommunication.latest
9
- objs_collection << ElectioneeringCommunication.committee("C30001655")
10
- objs_collection << ElectioneeringCommunication.date("02/06/2012")
11
-
12
- objs_collection.each do |objs|
13
- should "return a list of objects of the ElectioneeringCommunication type or an empty list" do
14
- if objs.size > 0
15
- assert_kind_of(ElectioneeringCommunication, objs.first)
16
- else
17
- assert_equal([], objs)
18
- end
7
+ latest = ElectioneeringCommunication.latest
8
+ committee = ElectioneeringCommunication.committee("C30001655")
9
+ date = ElectioneeringCommunication.date("02/06/2012")
10
+
11
+ should "return a list of latest objects of the ElectioneeringCommunication type or an empty list" do
12
+ if latest.size > 0
13
+ assert_kind_of(ElectioneeringCommunication, latest.first)
14
+ else
15
+ assert_equal([], latest)
16
+ end
17
+ end
18
+
19
+ should "return a list of objects of the ElectioneeringCommunication type or an empty list for a cmte" do
20
+ if committee.size > 0
21
+ assert_kind_of(ElectioneeringCommunication, committee.first)
22
+ else
23
+ assert_equal([], committee)
24
+ end
25
+ end
26
+
27
+ should "return a list of latest objects of the ElectioneeringCommunication type or an empty list by date" do
28
+ if date.size > 0
29
+ assert_kind_of(ElectioneeringCommunication, date.first)
30
+ else
31
+ assert_equal([], date)
19
32
  end
20
33
  end
21
34
  end
@@ -36,7 +36,7 @@ class TestCampaignCash::TestIndependentExpenditure < Test::Unit::TestCase
36
36
  context "independent expenditures about a given candidate" do
37
37
  setup do
38
38
  @independent_expenditures = IndependentExpenditure.candidate("P60003654", 2012)
39
- @candidate = Candidate.find('P60003654')
39
+ @candidate = Candidate.find('P60003654', 2012)
40
40
  end
41
41
 
42
42
  should "return an array of IEs about presidential candidate Newt Gingrich" do
@@ -7,16 +7,21 @@ class TestCampaignCash::TestIndividualContribution < Test::Unit::TestCase
7
7
  objs_collection = []
8
8
  objs_collection << IndividualContribution.committee("C00496497")
9
9
  objs_collection << IndividualContribution.filing("724196")
10
- objs_collection << IndividualContribution.candidate("P80003353")
11
10
 
12
- objs_collection.each do |objs|
13
- should "return a list of objects of the IndividualContribution type or an empty list" do
14
- if objs.size > 0
15
- assert_kind_of(IndividualContribution, objs.first)
16
- else
17
- assert_equal([], objs)
18
- end
19
- end
11
+ should "return a list of objects of the IndividualContribution type from a committee or an empty list" do
12
+ if objs_collection.first.size > 0
13
+ assert_kind_of(IndividualContribution, objs_collection.first)
14
+ else
15
+ assert_equal([], objs_collection.first)
16
+ end
17
+ end
18
+
19
+ should "return a list of objects of the IndividualContribution type from a filing or an empty list for a cmte" do
20
+ if objs_collection[1].size > 0
21
+ assert_kind_of(IndividualContribution, objs_collection[1])
22
+ else
23
+ assert_equal([], objs_collection[1])
24
+ end
20
25
  end
21
26
  end
22
27
  end
@@ -4,21 +4,23 @@ class TestCampaignCash::TestLateContribution < Test::Unit::TestCase
4
4
  include CampaignCash
5
5
 
6
6
  context "get late contributions" do
7
- objs_collection = []
8
- objs_collection << LateContribution.committee("C00505255")
9
- objs_collection << LateContribution.latest
10
- objs_collection << LateContribution.candidate("H2NC09092")
7
+ cmte = LateContribution.committee("C00505255")
8
+ cand = LateContribution.candidate("H2NC09092")
11
9
 
12
- objs_collection.each do |objs|
13
- should "return a list of objects of the IndividualContribution type or an empty list" do
14
- if objs.size > 0
15
- objs.each do |obj|
16
- assert_kind_of(LateContribution, obj)
17
- end
18
- else
19
- assert_equal([], objs)
20
- end
21
- end
10
+ should "return a list of objects of the LateContribution type from a committee or an empty list" do
11
+ if cmte.size > 0
12
+ assert_kind_of(LateContribution, cmte.first)
13
+ else
14
+ assert_equal([], cmte)
15
+ end
16
+ end
17
+
18
+ should "return a list of objects of the LateContribution type from a candidate or an empty list for a cmte" do
19
+ if cand.size > 0
20
+ assert_kind_of(LateContribution, cand.first)
21
+ else
22
+ assert_equal([], cand)
23
+ end
22
24
  end
23
25
  end
24
26
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: campaign_cash
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
5
- prerelease:
4
+ version: '2.7'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Derek Willis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-22 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - '='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 0.8.7
33
+ version: '10.0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - '='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 0.8.7
40
+ version: '10.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 1.0.0
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.0.0
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: shoulda
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: A client for The New York Times Campaign Finance API
@@ -116,27 +107,26 @@ files:
116
107
  - test/test_helper.rb
117
108
  homepage: http://rubygems.org/gems/campaign_cash
118
109
  licenses: []
110
+ metadata: {}
119
111
  post_install_message:
120
112
  rdoc_options: []
121
113
  require_paths:
122
114
  - lib
123
115
  required_ruby_version: !ruby/object:Gem::Requirement
124
- none: false
125
116
  requirements:
126
- - - ! '>='
117
+ - - '>='
127
118
  - !ruby/object:Gem::Version
128
119
  version: '0'
129
120
  required_rubygems_version: !ruby/object:Gem::Requirement
130
- none: false
131
121
  requirements:
132
- - - ! '>='
122
+ - - '>='
133
123
  - !ruby/object:Gem::Version
134
124
  version: 1.3.6
135
125
  requirements: []
136
126
  rubyforge_project: campaign_cash
137
- rubygems_version: 1.8.25
127
+ rubygems_version: 2.2.0
138
128
  signing_key:
139
- specification_version: 3
129
+ specification_version: 4
140
130
  summary: Following the money.
141
131
  test_files:
142
132
  - test/campaign_cash/test_candidate.rb