full_circle 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/full_circle.gemspec +6 -8
- data/lib/full_circle.rb +1 -0
- data/lib/full_circle/api.rb +1 -1
- data/lib/full_circle/parsed_response.rb +1 -1
- data/lib/full_circle/response.rb +1 -1
- data/lib/full_circle/response_builder.rb +2 -2
- data/lib/full_circle/upcoming_event_builder.rb +1 -1
- data/lib/full_circle/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/empty_event_area_response.yml +2 -2
- data/spec/fixtures/vcr_cassettes/empty_get_coupons_response.yml +1 -1
- data/spec/fixtures/vcr_cassettes/empty_get_events_response.yml +1 -1
- data/spec/fixtures/vcr_cassettes/empty_get_upcoming_events_response.yml +2 -2
- data/spec/fixtures/vcr_cassettes/multiple_event_areas_response.yml +2 -2
- data/spec/fixtures/vcr_cassettes/multiple_get_coupons_response.yml +1 -1
- data/spec/fixtures/vcr_cassettes/multiple_get_upcoming_events_response.yml +2 -2
- data/spec/fixtures/vcr_cassettes/multple_get_events_response.yml +1 -1
- data/spec/fixtures/vcr_cassettes/single_event_areas_response.yml +2 -2
- data/spec/fixtures/vcr_cassettes/single_get_coupons_response.yml +1 -1
- data/spec/fixtures/vcr_cassettes/single_get_events_response.yml +1 -1
- data/spec/fixtures/vcr_cassettes/single_get_upcoming_events_response.yml +1 -1
- data/spec/full_circle/api_spec.rb +28 -34
- data/spec/full_circle/connection_spec.rb +25 -11
- data/spec/full_circle/object_builder_spec.rb +5 -5
- data/spec/full_circle/parsed_response_spec.rb +45 -33
- data/spec/full_circle/response_builder_spec.rb +8 -8
- data/spec/full_circle/response_spec.rb +61 -14
- data/spec/spec_helper.rb +1 -1
- data/spec/support/shared/cacher_examples.rb +9 -0
- data/spec/support/shared/{event_spec.rb → event_examples.rb} +4 -2
- data/spec/support/shared/{object_builder_spec.rb → object_builder_examples.rb} +0 -0
- metadata +33 -60
- data/Guardfile +0 -24
- data/spec/support/shared/cacher_spec.rb +0 -9
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NGIyMzMwNDFkOGQxZDk3YjljNjMxYmQ1ZDkzMTcwMDFkYmQ5N2JhNzFhZWJl
|
10
|
-
MGNlMzliYmRlNzA3OWNjNDYxYjBiMjRjYzgwZTdkMmM1MDk1ZjA4NjA0ZTFi
|
11
|
-
NTIyODM1NTI4ZDRjZjQ2NjhhNDVjNTdhYjc4ZGU5NjZiYjg4Mzk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Zjk0YTY1YWY4ODA5NzA3Yjc1ODJkMTQ2ZDhiMDIxZmRjNGY2MmEzMjI1NTY4
|
14
|
-
OWRiNTFlOWEyZmNjZjE2MTZjZTI4YTZmZmExMzNlNzhmZGM2N2VmMTY1NDAz
|
15
|
-
NWFiODg1NDE0ZTY2OGJiY2NmMGI2Njc5MmVlYWM5OTY2YTc0ZmY=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 921cd25b80f85aafb4855127c71c39e4ac619f80
|
4
|
+
data.tar.gz: 6e21e8a35e78320ff841a338d631a312c15aafc5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 880020a8f93b69e06007d171a2b72b9befa6a999936c63250cd4e9f839e8e9eb72435c535aa6b48b7ffd5fbc22fd3d326ec80f31f69e719985f164793a592d6d
|
7
|
+
data.tar.gz: add1359cd220d2bb26458fb716672a73d3dcb2ff21e8bd091b32fe3b30ca212d471dad35b91bc72e71565df946cdf5d2e3c7701a86ac2ddbbca96915b9f0d24e
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p643
|
data/full_circle.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["aaron@animascodelabs.com"]
|
11
11
|
gem.description = %q{Library for interfacing with the 360Directories API}
|
12
12
|
gem.summary = %q{Library for interfacing with the 360Directories API}
|
13
|
-
gem.homepage = "https://github.com/
|
14
|
-
gem.required_ruby_version = ">=
|
13
|
+
gem.homepage = "https://github.com/animascodelabs/full_circle"
|
14
|
+
gem.required_ruby_version = ">= 2.0.0"
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($/)
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -19,11 +19,9 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
21
|
gem.add_dependency "multi_xml"
|
22
|
-
gem.add_dependency "activesupport", "
|
23
|
-
gem.add_development_dependency "rspec"
|
24
|
-
gem.add_development_dependency "vcr"
|
25
|
-
gem.add_development_dependency "webmock"
|
22
|
+
gem.add_dependency "activesupport", ">= 3.2"
|
23
|
+
gem.add_development_dependency "rspec", '~> 3.2'
|
24
|
+
gem.add_development_dependency "vcr", '~> 2.9'
|
25
|
+
gem.add_development_dependency "webmock"
|
26
26
|
gem.add_development_dependency "rake"
|
27
|
-
gem.add_development_dependency "guard-rspec"
|
28
|
-
gem.add_development_dependency "rb-inotify", "~> 0.9"
|
29
27
|
end
|
data/lib/full_circle.rb
CHANGED
data/lib/full_circle/api.rb
CHANGED
data/lib/full_circle/response.rb
CHANGED
@@ -6,7 +6,7 @@ module FullCircle
|
|
6
6
|
# Creates a new response builder
|
7
7
|
# api_results - collection of objects to be built into the response
|
8
8
|
# args
|
9
|
-
# metadata: hash of metadata
|
9
|
+
# metadata: hash of metadata
|
10
10
|
# object_builder: The object builder to use for building api objects
|
11
11
|
def initialize(api_results, args={})
|
12
12
|
@api_results = api_results
|
@@ -21,6 +21,6 @@ module FullCircle
|
|
21
21
|
|
22
22
|
Response.new(objects,metadata)
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
end
|
26
26
|
end
|
data/lib/full_circle/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://api.1019thewave.com/1.0/city.getEventAreas
|
5
|
+
uri: http://api.1019thewave.com/1.0/city.getEventAreas
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -42,6 +42,6 @@ http_interactions:
|
|
42
42
|
<city-getEventAreasResponse page="1" resultsPerPage="20" totalPages="0" totalResults="0"><eventAreas></eventAreas></city-getEventAreasResponse>
|
43
43
|
|
44
44
|
'
|
45
|
-
http_version:
|
45
|
+
http_version:
|
46
46
|
recorded_at: Tue, 26 Mar 2013 19:29:44 GMT
|
47
47
|
recorded_with: VCR 2.4.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://api.boatersbluepages.com/1.0/city.getUpcomingEvents
|
5
|
+
uri: http://api.boatersbluepages.com/1.0/city.getUpcomingEvents
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -43,6 +43,6 @@ http_interactions:
|
|
43
43
|
totalResults="0"><events></events></city-getUpcomingEventsResponse>
|
44
44
|
|
45
45
|
'
|
46
|
-
http_version:
|
46
|
+
http_version:
|
47
47
|
recorded_at: Tue, 26 Mar 2013 22:31:50 GMT
|
48
48
|
recorded_with: VCR 2.4.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://api.360durango.com/1.0/city.getEventAreas
|
5
|
+
uri: http://api.360durango.com/1.0/city.getEventAreas
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -46,6 +46,6 @@ http_interactions:
|
|
46
46
|
id="591" name="Historic Downtown"></eventArea><eventArea id="735" name="Vallecito"></eventArea></eventAreas></city-getEventAreasResponse>
|
47
47
|
|
48
48
|
'
|
49
|
-
http_version:
|
49
|
+
http_version:
|
50
50
|
recorded_at: Tue, 26 Mar 2013 19:19:20 GMT
|
51
51
|
recorded_with: VCR 2.4.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://api.360durango.com/1.0/city.getUpcomingEvents
|
5
|
+
uri: http://api.360durango.com/1.0/city.getUpcomingEvents
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -272,6 +272,6 @@ http_interactions:
|
|
272
272
|
addr1=\"1911 Main Ave., Suite 100\" city=\"Durango\" state=\"CO\" zipCode=\"81301\"
|
273
273
|
phone=\"970.247.1240\" fax=\"970.247.1771\"></address><logoImage url=\"http://tours.360durango.com/152054/logo.gif\"
|
274
274
|
width=\"300\" height=\"263\"></logoImage></ad></event></events></city-getUpcomingEventsResponse>\n"
|
275
|
-
http_version:
|
275
|
+
http_version:
|
276
276
|
recorded_at: Tue, 26 Mar 2013 22:30:11 GMT
|
277
277
|
recorded_with: VCR 2.4.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://api.360durango.com/1.0/city.getEventAreas
|
5
|
+
uri: http://api.360durango.com/1.0/city.getEventAreas
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -44,6 +44,6 @@ http_interactions:
|
|
44
44
|
</eventAreas></city-getEventAreasResponse>
|
45
45
|
|
46
46
|
'
|
47
|
-
http_version:
|
47
|
+
http_version:
|
48
48
|
recorded_at: Tue, 26 Mar 2013 19:22:34 GMT
|
49
49
|
recorded_with: VCR 2.4.0
|
@@ -47,6 +47,6 @@ http_interactions:
|
|
47
47
|
and 7p.m. to receive your second entree FREE." imageURL="http://tours.360durango.com/81213/event_58794.jpg"></event></events></ad-getEventsResponse>
|
48
48
|
|
49
49
|
'
|
50
|
-
http_version:
|
50
|
+
http_version:
|
51
51
|
recorded_at: Wed, 12 Dec 2012 03:35:57 GMT
|
52
52
|
recorded_with: VCR 2.3.0
|
@@ -6,9 +6,9 @@ describe FullCircle::API do
|
|
6
6
|
let!(:api){FullCircle::API.new(FullCircle::Connection.new("360durango.com"))}
|
7
7
|
|
8
8
|
describe "#fetch_events_for_ad" do
|
9
|
-
|
9
|
+
skip "calls the appropriate method on call_api_method" do
|
10
10
|
mock_connection = double()
|
11
|
-
mock_connection.
|
11
|
+
expect(mock_connection).to receive(:call_api_method).with("ad.getEvents",{adId: "1"}) do
|
12
12
|
class ResponseDouble
|
13
13
|
def body
|
14
14
|
end
|
@@ -19,8 +19,7 @@ describe FullCircle::API do
|
|
19
19
|
described_class.new(mock_connection).fetch_events_for_ad("1")
|
20
20
|
end
|
21
21
|
|
22
|
-
describe "event object" do
|
23
|
-
use_vcr_cassette "single_get_events_response"
|
22
|
+
describe "event object", :vcr => {cassette_name: "single_get_events_response"} do
|
24
23
|
subject {api.fetch_events_for_ad("81213").first}
|
25
24
|
it_behaves_like "an event"
|
26
25
|
end
|
@@ -29,19 +28,19 @@ describe FullCircle::API do
|
|
29
28
|
it "returns an array of one event" do
|
30
29
|
VCR.use_cassette "single_get_events_response" do
|
31
30
|
results = api.fetch_events_for_ad "81213"
|
32
|
-
results.
|
31
|
+
expect(results).to be_a Array
|
33
32
|
results
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
36
|
end
|
38
|
-
|
37
|
+
|
39
38
|
context "with multiple events" do
|
40
39
|
it "returns an array of multiple events" do
|
41
40
|
VCR.use_cassette "multple_get_events_response" do
|
42
41
|
results = api.fetch_events_for_ad "89690"
|
43
|
-
results.
|
44
|
-
(results.length > 1).
|
42
|
+
expect(results).to be_a Array
|
43
|
+
expect(results.length > 1).to eq(true)
|
45
44
|
end
|
46
45
|
end
|
47
46
|
end
|
@@ -50,7 +49,7 @@ describe FullCircle::API do
|
|
50
49
|
it "returns an empty array" do
|
51
50
|
VCR.use_cassette "empty_get_events_response" do
|
52
51
|
results = api.fetch_events_for_ad "1"
|
53
|
-
results.
|
52
|
+
expect(results).to eq([])
|
54
53
|
end
|
55
54
|
end
|
56
55
|
end
|
@@ -60,19 +59,19 @@ describe FullCircle::API do
|
|
60
59
|
|
61
60
|
describe "#fetch_coupons_for_ad" do
|
62
61
|
|
63
|
-
|
62
|
+
skip "calls the appropriate method on call_api_method" do
|
64
63
|
mock_connection = double()
|
65
|
-
mock_connection.
|
64
|
+
expect(mock_connection).to receive(:call_api_method).with("ad.getCoupons",{adId: "1"})
|
66
65
|
|
67
66
|
described_class.new(mock_connection).fetch_coupons_for_ad("1")
|
68
67
|
end
|
69
|
-
|
68
|
+
|
70
69
|
context "with one coupon" do
|
71
70
|
it "returns an array of one coupon" do
|
72
71
|
VCR.use_cassette "single_get_coupons_response" do
|
73
72
|
results = api.fetch_coupons_for_ad "123094"
|
74
|
-
results.
|
75
|
-
results.length.
|
73
|
+
expect(results).to be_an(Array)
|
74
|
+
expect(results.length).to eq(1)
|
76
75
|
end
|
77
76
|
end
|
78
77
|
end
|
@@ -81,8 +80,8 @@ describe FullCircle::API do
|
|
81
80
|
it "returns an array of multiple coupons" do
|
82
81
|
VCR.use_cassette "multiple_get_coupons_response" do
|
83
82
|
results = api.fetch_coupons_for_ad "82196"
|
84
|
-
results.
|
85
|
-
results.length.
|
83
|
+
expect(results).to be_a(Array)
|
84
|
+
expect(results.length).to eq(3)
|
86
85
|
end
|
87
86
|
end
|
88
87
|
end
|
@@ -91,16 +90,16 @@ describe FullCircle::API do
|
|
91
90
|
it "returns an empty array" do
|
92
91
|
VCR.use_cassette "empty_get_coupons_response" do
|
93
92
|
results = api.fetch_coupons_for_ad "1"
|
94
|
-
results.
|
93
|
+
expect(results).to eq([])
|
95
94
|
end
|
96
95
|
end
|
97
96
|
end
|
98
97
|
end
|
99
98
|
|
100
99
|
describe "#fetch_event_areas" do
|
101
|
-
|
100
|
+
skip "calls the appropriate method on call_api_method" do
|
102
101
|
mock_connection = double()
|
103
|
-
mock_connection.
|
102
|
+
expect(mock_connection).to receive(:call_api_method).with("city.getEventAreas")
|
104
103
|
|
105
104
|
described_class.new(mock_connection).fetch_event_areas
|
106
105
|
end
|
@@ -109,8 +108,7 @@ describe FullCircle::API do
|
|
109
108
|
it "returns an array of one event area" do
|
110
109
|
VCR.use_cassette "single_event_areas_response" do
|
111
110
|
results = api.fetch_event_areas
|
112
|
-
results.
|
113
|
-
results.length.should eq 1
|
111
|
+
expect(results.length).to eq(1)
|
114
112
|
end
|
115
113
|
end
|
116
114
|
end
|
@@ -119,8 +117,7 @@ describe FullCircle::API do
|
|
119
117
|
it "returns an array of multiple event areas" do
|
120
118
|
VCR.use_cassette "multiple_event_areas_response" do
|
121
119
|
results = api.fetch_event_areas
|
122
|
-
results.
|
123
|
-
results.length.should eq 7
|
120
|
+
expect(results.length).to eq(7)
|
124
121
|
end
|
125
122
|
end
|
126
123
|
end
|
@@ -130,7 +127,7 @@ describe FullCircle::API do
|
|
130
127
|
it "returns an empty array" do
|
131
128
|
VCR.use_cassette "empty_event_area_response" do
|
132
129
|
results = api.fetch_event_areas
|
133
|
-
results.
|
130
|
+
expect(results).to eq([])
|
134
131
|
end
|
135
132
|
end
|
136
133
|
end
|
@@ -139,15 +136,14 @@ describe FullCircle::API do
|
|
139
136
|
|
140
137
|
describe "#fetch_upcoming_events" do
|
141
138
|
|
142
|
-
|
139
|
+
skip "calls the appropriate method on call_api_method" do
|
143
140
|
mock_connection = double()
|
144
|
-
mock_connection.
|
141
|
+
expect(mock_connection).to receive(:call_api_method).with("city.getUpcomingEvents",{})
|
145
142
|
|
146
143
|
described_class.new(mock_connection).fetch_upcoming_events
|
147
144
|
end
|
148
145
|
|
149
|
-
describe "event object" do
|
150
|
-
use_vcr_cassette "single_get_upcoming_events_response"
|
146
|
+
describe "event object", vcr: {cassette_name: "single_get_upcoming_events_response"} do
|
151
147
|
|
152
148
|
subject {api.fetch_upcoming_events(areaId:"592").first}
|
153
149
|
it_behaves_like "an event"
|
@@ -157,19 +153,17 @@ describe FullCircle::API do
|
|
157
153
|
it "returns an array of one event" do
|
158
154
|
VCR.use_cassette "single_get_upcoming_events_response" do
|
159
155
|
results = api.fetch_upcoming_events areaId: "592"
|
160
|
-
results.
|
161
|
-
results.length.should be 1
|
156
|
+
expect(results.length).to eq(1)
|
162
157
|
end
|
163
158
|
end
|
164
159
|
|
165
160
|
end
|
166
|
-
|
161
|
+
|
167
162
|
context "with multiple events" do
|
168
163
|
it "returns an array of multiple events" do
|
169
164
|
VCR.use_cassette "multiple_get_upcoming_events_response" do
|
170
165
|
results = api.fetch_upcoming_events
|
171
|
-
results.
|
172
|
-
(results.length > 1).should be_true
|
166
|
+
expect(results.length > 1).to eq(true)
|
173
167
|
end
|
174
168
|
end
|
175
169
|
end
|
@@ -179,7 +173,7 @@ describe FullCircle::API do
|
|
179
173
|
it "returns an empty array" do
|
180
174
|
VCR.use_cassette "empty_get_upcoming_events_response" do
|
181
175
|
results = api.fetch_upcoming_events
|
182
|
-
results.
|
176
|
+
expect(results).to eq([])
|
183
177
|
end
|
184
178
|
end
|
185
179
|
end
|
@@ -4,43 +4,57 @@ describe FullCircle::Connection do
|
|
4
4
|
|
5
5
|
subject {FullCircle::Connection.new "360durango.com"}
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
describe "#domain" do
|
8
|
+
it "returns the value set in the constructor" do
|
9
|
+
conn = described_class.new "360durango.com"
|
9
10
|
|
10
|
-
|
11
|
+
expect(conn.domain).to eq('360durango.com')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#base_uri" do
|
16
|
+
it "returns formats the domain into the proper uri" do
|
17
|
+
conn = described_class.new "360durango.com"
|
18
|
+
|
19
|
+
expect(conn.base_uri).to eq('http://api.360durango.com/1.0/')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
let!(:req_stub) {stub_request(:get, "api.360durango.com/1.0/ad.getCoupons").with(query: {adId: "81304"})
|
11
25
|
.to_return(body: "abc")
|
12
26
|
}
|
13
27
|
|
14
28
|
describe ".call_api_method" do
|
15
29
|
|
16
|
-
it "
|
30
|
+
it "requests the correct uri" do
|
17
31
|
subject.call_api_method "ad.getCoupons", adId: "81304"
|
18
32
|
|
19
|
-
req_stub.
|
33
|
+
expect(req_stub).to have_been_requested
|
20
34
|
end
|
21
35
|
|
22
|
-
it "
|
36
|
+
it "returns the correct data" do
|
23
37
|
response = subject.call_api_method "ad.getCoupons", adId: "81304"
|
24
|
-
response.body.
|
38
|
+
expect(response.body).to eq("abc")
|
25
39
|
end
|
26
40
|
|
27
41
|
context "without cache" do
|
28
|
-
it "
|
42
|
+
it "makes the http request each time" do
|
29
43
|
subject.call_api_method "ad.getCoupons", adId: "81304"
|
30
44
|
subject.call_api_method "ad.getCoupons", adId: "81304"
|
31
45
|
|
32
|
-
req_stub.
|
46
|
+
expect(req_stub).to have_been_requested.twice
|
33
47
|
end
|
34
48
|
end
|
35
49
|
|
36
50
|
context "with cache" do
|
37
51
|
subject {FullCircle::Connection.new "360durango.com", cache: {}}
|
38
52
|
|
39
|
-
it "
|
53
|
+
it "does not make the http request each time" do
|
40
54
|
subject.call_api_method "ad.getCoupons", adId: "81304"
|
41
55
|
subject.call_api_method "ad.getCoupons", adId: "81304"
|
42
56
|
|
43
|
-
req_stub.
|
57
|
+
expect(req_stub).to have_been_requested.once
|
44
58
|
end
|
45
59
|
end
|
46
60
|
|
@@ -9,14 +9,14 @@ describe FullCircle::ObjectBuilder do
|
|
9
9
|
|
10
10
|
it "builds a new event with the appropriate attribute set" do
|
11
11
|
object = builder.from_api_hash("id" => "123", "title" => "Hello World")
|
12
|
-
object.id.
|
13
|
-
object.title.
|
12
|
+
expect(object.id).to eq("123")
|
13
|
+
expect(object.title).to eq("Hello World")
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
it "builds a new event with camelcased attributes converted to underscored attributes" do
|
17
17
|
object = builder.from_api_hash("linkUrl" => "http://www.google.com", "siteId" => "77")
|
18
|
-
object.link_url.
|
19
|
-
object.site_id.
|
18
|
+
expect(object.link_url).to eq("http://www.google.com")
|
19
|
+
expect(object.site_id).to eq("77")
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
@@ -9,14 +9,14 @@ describe FullCircle::ParsedResponse do
|
|
9
9
|
<?xml version="1.0"?>
|
10
10
|
<ad-getListResponse page="2" resultsPerPage="2" totalPages="541" totalResults="1081">
|
11
11
|
<ads>
|
12
|
-
<ad id="81009" name="4Core" url="http://360Durango.com/Environmental/4core.html"
|
13
|
-
eventCount="0" couponCount="0" jobCount="0" locationCount="1" popupCount="0"
|
12
|
+
<ad id="81009" name="4Core" url="http://360Durango.com/Environmental/4core.html"
|
13
|
+
eventCount="0" couponCount="0" jobCount="0" locationCount="1" popupCount="0"
|
14
14
|
slideshowCount="0" linkCount="0">
|
15
15
|
<address addr1="949 E 2ND AV" city="DURANGO" state="CO" zipCode="81301"></address>
|
16
16
|
</ad>
|
17
|
-
<ad id="123760" name="4x4 Auto " url="http://360Durango.com/Automotive/4x4Auto.html"
|
18
|
-
description="Used Car Dealership Cortez 360Durango Colorado" eventCount="0"
|
19
|
-
couponCount="0" jobCount="0" locationCount="0" popupCount="0" slideshowCount="0"
|
17
|
+
<ad id="123760" name="4x4 Auto " url="http://360Durango.com/Automotive/4x4Auto.html"
|
18
|
+
description="Used Car Dealership Cortez 360Durango Colorado" eventCount="0"
|
19
|
+
couponCount="0" jobCount="0" locationCount="0" popupCount="0" slideshowCount="0"
|
20
20
|
linkCount="0">
|
21
21
|
</ad>
|
22
22
|
</ads>
|
@@ -24,15 +24,16 @@ describe FullCircle::ParsedResponse do
|
|
24
24
|
EOS
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
its([:page]){should eq 2}
|
30
|
-
its([:results_per_page]){should eq 2}
|
31
|
-
its([ :total_pages ]){should eq 541 }
|
32
|
-
its([ :total_results ]){should eq 1081}
|
33
|
-
|
34
|
-
|
27
|
+
it 'sets the appropriate kes and values in the hash' do
|
28
|
+
response = described_class.new(xml)
|
35
29
|
|
30
|
+
expect(response.metadata).to eq({
|
31
|
+
page: 2,
|
32
|
+
results_per_page: 2,
|
33
|
+
total_pages: 541,
|
34
|
+
total_results: 1081
|
35
|
+
})
|
36
|
+
end
|
36
37
|
end
|
37
38
|
|
38
39
|
context "with no provided metadata" do
|
@@ -41,12 +42,12 @@ EOS
|
|
41
42
|
<?xml version="1.0"?>
|
42
43
|
<ad-getCouponsResponse>
|
43
44
|
<coupons>
|
44
|
-
<coupon id="32025" name="90 for 90!" begin="2013-04-04"
|
45
|
+
<coupon id="32025" name="90 for 90!" begin="2013-04-04"
|
45
46
|
expire="2013-04-30" accept_offline="1" accept_online="0" acceptMobile="1" acceptPrint="1">
|
46
47
|
<offer>Get a relaxing and restorative 90 minute massage for just $90!</offer>
|
47
48
|
<restrictions>Service must be booked in the month of April.</restrictions>
|
48
49
|
</coupon>
|
49
|
-
<coupon id="32025" name="90 for 90!" begin="2013-04-04"
|
50
|
+
<coupon id="32025" name="90 for 90!" begin="2013-04-04"
|
50
51
|
expire="2013-04-30" accept_offline="1" accept_online="0" acceptMobile="1" acceptPrint="1">
|
51
52
|
<offer>Get a relaxing and restorative 90 minute massage for just $90!</offer>
|
52
53
|
<restrictions>Service must be booked in the month of April.</restrictions>
|
@@ -56,13 +57,16 @@ EOS
|
|
56
57
|
EOS
|
57
58
|
end
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
its([ :page ]){should eq 1}
|
62
|
-
its([ :total_pages ]){should eq 1 }
|
63
|
-
its([ :total_results ]) {should eq 2}
|
64
|
-
its([ :results_per_page ]) {should eq 2 }
|
60
|
+
it 'sets the appropriate kes and values in the hash' do
|
61
|
+
response = described_class.new(xml)
|
65
62
|
|
63
|
+
expect(response.metadata).to eq({
|
64
|
+
page: 1,
|
65
|
+
results_per_page: 2,
|
66
|
+
total_pages: 1,
|
67
|
+
total_results: 2
|
68
|
+
})
|
69
|
+
end
|
66
70
|
end
|
67
71
|
end
|
68
72
|
|
@@ -79,8 +83,11 @@ EOS
|
|
79
83
|
EOS
|
80
84
|
end
|
81
85
|
|
82
|
-
|
83
|
-
|
86
|
+
it 'returns an empty results array' do
|
87
|
+
response = described_class.new(xml)
|
88
|
+
|
89
|
+
expect(response.results).to eq([])
|
90
|
+
end
|
84
91
|
end
|
85
92
|
|
86
93
|
context "with one result" do
|
@@ -90,7 +97,7 @@ EOS
|
|
90
97
|
<?xml version="1.0"?>
|
91
98
|
<ad-getCouponsResponse>
|
92
99
|
<coupons>
|
93
|
-
<coupon id="32025" name="90 for 90!" begin="2013-04-04"
|
100
|
+
<coupon id="32025" name="90 for 90!" begin="2013-04-04"
|
94
101
|
expire="2013-04-30" accept_offline="1" accept_online="0" acceptMobile="1" acceptPrint="1">
|
95
102
|
<offer>Get a relaxing and restorative 90 minute massage for just $90!</offer>
|
96
103
|
<restrictions>Service must be booked in the month of April.</restrictions>
|
@@ -100,8 +107,11 @@ EOS
|
|
100
107
|
EOS
|
101
108
|
end
|
102
109
|
|
103
|
-
|
104
|
-
|
110
|
+
it 'returns one object in the results array' do
|
111
|
+
response = described_class.new(xml)
|
112
|
+
|
113
|
+
expect(response.results.length).to eq(1)
|
114
|
+
end
|
105
115
|
|
106
116
|
end
|
107
117
|
|
@@ -111,14 +121,14 @@ EOS
|
|
111
121
|
<?xml version="1.0"?>
|
112
122
|
<ad-getListResponse page="2" resultsPerPage="2" totalPages="541" totalResults="1081">
|
113
123
|
<ads>
|
114
|
-
<ad id="81009" name="4Core" url="http://360Durango.com/Environmental/4core.html"
|
115
|
-
eventCount="0" couponCount="0" jobCount="0" locationCount="1" popupCount="0"
|
124
|
+
<ad id="81009" name="4Core" url="http://360Durango.com/Environmental/4core.html"
|
125
|
+
eventCount="0" couponCount="0" jobCount="0" locationCount="1" popupCount="0"
|
116
126
|
slideshowCount="0" linkCount="0">
|
117
127
|
<address addr1="949 E 2ND AV" city="DURANGO" state="CO" zipCode="81301"></address>
|
118
128
|
</ad>
|
119
|
-
<ad id="123760" name="4x4 Auto " url="http://360Durango.com/Automotive/4x4Auto.html"
|
120
|
-
description="Used Car Dealership Cortez 360Durango Colorado" eventCount="0"
|
121
|
-
couponCount="0" jobCount="0" locationCount="0" popupCount="0" slideshowCount="0"
|
129
|
+
<ad id="123760" name="4x4 Auto " url="http://360Durango.com/Automotive/4x4Auto.html"
|
130
|
+
description="Used Car Dealership Cortez 360Durango Colorado" eventCount="0"
|
131
|
+
couponCount="0" jobCount="0" locationCount="0" popupCount="0" slideshowCount="0"
|
122
132
|
linkCount="0">
|
123
133
|
</ad>
|
124
134
|
</ads>
|
@@ -126,9 +136,11 @@ EOS
|
|
126
136
|
EOS
|
127
137
|
end
|
128
138
|
|
129
|
-
|
139
|
+
it 'returns an array with all results' do
|
140
|
+
response = described_class.new(xml)
|
130
141
|
|
131
|
-
|
142
|
+
expect(response.results.length).to eq(2)
|
143
|
+
end
|
132
144
|
end
|
133
145
|
|
134
146
|
end
|
@@ -14,13 +14,13 @@ describe FullCircle::ResponseBuilder do
|
|
14
14
|
subject {object_builder_double}
|
15
15
|
it_behaves_like "an object builder"
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
describe "#build" do
|
19
19
|
context "with empty array of api_results" do
|
20
20
|
subject{ described_class.new [], object_builder: object_builder_double }
|
21
|
-
|
21
|
+
|
22
22
|
it "calls object_builder.from_api_hash" do
|
23
|
-
object_builder_double.
|
23
|
+
expect(object_builder_double).not_to receive(:from_api_hash)
|
24
24
|
subject.build
|
25
25
|
end
|
26
26
|
|
@@ -28,18 +28,18 @@ describe FullCircle::ResponseBuilder do
|
|
28
28
|
|
29
29
|
context "with an array of multiple api_results" do
|
30
30
|
subject{ described_class.new [{},{}], object_builder: object_builder_double }
|
31
|
-
|
31
|
+
|
32
32
|
it "calls object_builder.from_api_hash" do
|
33
|
-
object_builder_double.
|
33
|
+
expect(object_builder_double).to receive(:from_api_hash).with({}).exactly(2).times
|
34
34
|
subject.build
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "response outgoing messages" do
|
39
39
|
subject{ described_class.new [{},{}], object_builder: object_builder_double }
|
40
|
-
|
41
|
-
it "
|
42
|
-
FullCircle::Response.
|
40
|
+
|
41
|
+
it "creates a response with the correct arguments" do
|
42
|
+
expect(FullCircle::Response).to receive(:new).with([nil,nil],{})
|
43
43
|
|
44
44
|
subject.build
|
45
45
|
end
|
@@ -2,28 +2,75 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FullCircle::Response do
|
4
4
|
|
5
|
-
describe
|
6
|
-
|
5
|
+
describe '#results' do
|
6
|
+
it 'defaults to an empty array' do
|
7
|
+
response = described_class.new([], {})
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
its(:total_pages){should eq 1}
|
11
|
-
its(:results_per_page){should eq 0 }
|
12
|
-
its(:total_results){should eq 0 }
|
9
|
+
expect(response.results).to eq([])
|
10
|
+
end
|
13
11
|
|
12
|
+
it 'can be set to the first argument in the constructor' do
|
13
|
+
results = double('results', length: 0)
|
14
|
+
|
15
|
+
response = described_class.new(results, {})
|
16
|
+
|
17
|
+
expect(response.results).to eq(results)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#page' do
|
22
|
+
it 'defaults to 1' do
|
23
|
+
response = described_class.new([], {})
|
24
|
+
|
25
|
+
expect(response.page).to eq(1)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'can be set in the metadata hash' do
|
29
|
+
response = described_class.new([], {page: 2 })
|
30
|
+
|
31
|
+
expect(response.page).to eq(2)
|
32
|
+
end
|
14
33
|
end
|
15
34
|
|
16
|
-
describe
|
17
|
-
|
35
|
+
describe '#total_pages' do
|
36
|
+
it 'defaults to 1' do
|
37
|
+
response = described_class.new([], {})
|
38
|
+
|
39
|
+
expect(response.total_pages).to eq(1)
|
40
|
+
end
|
18
41
|
|
19
|
-
|
20
|
-
|
21
|
-
its(:total_pages){should eq 5}
|
22
|
-
its(:results_per_page){should eq 5 }
|
23
|
-
its(:total_results){should eq 25 }
|
42
|
+
it 'can be set in the metadata hash' do
|
43
|
+
response = described_class.new([], {total_pages: 5 })
|
24
44
|
|
45
|
+
expect(response.total_pages).to eq(5)
|
46
|
+
end
|
25
47
|
end
|
26
48
|
|
49
|
+
describe '#results_per_page' do
|
50
|
+
it 'defaults to 0' do
|
51
|
+
response = described_class.new([], {})
|
27
52
|
|
53
|
+
expect(response.results_per_page).to eq(0)
|
54
|
+
end
|
28
55
|
|
56
|
+
it 'can be set in the metadata hash' do
|
57
|
+
response = described_class.new([], {results_per_page: 5 })
|
58
|
+
|
59
|
+
expect(response.results_per_page).to eq(5)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#total_results' do
|
64
|
+
it 'defaults to 0' do
|
65
|
+
response = described_class.new([], {})
|
66
|
+
|
67
|
+
expect(response.total_results).to eq(0)
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'can be set in the metadata hash' do
|
71
|
+
response = described_class.new([], {total_results: 25 })
|
72
|
+
|
73
|
+
expect(response.total_results).to eq(25)
|
74
|
+
end
|
75
|
+
end
|
29
76
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -10,8 +10,8 @@ Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
|
|
10
10
|
VCR.configure do |c|
|
11
11
|
c.cassette_library_dir = "spec/fixtures/vcr_cassettes"
|
12
12
|
c.hook_into :webmock
|
13
|
+
c.configure_rspec_metadata!
|
13
14
|
end
|
14
15
|
|
15
16
|
RSpec.configure do |c|
|
16
|
-
c.extend VCR::RSpec::Macros
|
17
17
|
end
|
@@ -2,8 +2,10 @@ shared_examples_for "an event" do
|
|
2
2
|
required_attrs = :id, :date, :time, :title, :all_day_event, :date_mode, :site_id,
|
3
3
|
:type, :description
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
required_attrs.each do |field|
|
6
|
+
it "does not have a blank #{field}" do
|
7
|
+
expect(subject.send("#{field}")).to be_present
|
8
|
+
end
|
7
9
|
end
|
8
10
|
|
9
11
|
|
File without changes
|
metadata
CHANGED
@@ -1,127 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: full_circle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Renner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_xml
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.2
|
33
|
+
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.2
|
40
|
+
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: vcr
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ! '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: webmock
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ~>
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '2.9'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - ~>
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: '2.9'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: webmock
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - '>='
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - '>='
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: rake
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- -
|
87
|
+
- - '>='
|
102
88
|
- !ruby/object:Gem::Version
|
103
89
|
version: '0'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- -
|
94
|
+
- - '>='
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rb-inotify
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.9'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ~>
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.9'
|
125
97
|
description: Library for interfacing with the 360Directories API
|
126
98
|
email:
|
127
99
|
- aaron@animascodelabs.com
|
@@ -130,8 +102,9 @@ extensions: []
|
|
130
102
|
extra_rdoc_files: []
|
131
103
|
files:
|
132
104
|
- .gitignore
|
105
|
+
- .rspec
|
106
|
+
- .ruby-version
|
133
107
|
- Gemfile
|
134
|
-
- Guardfile
|
135
108
|
- LICENSE.txt
|
136
109
|
- README.md
|
137
110
|
- Rakefile
|
@@ -165,10 +138,10 @@ files:
|
|
165
138
|
- spec/full_circle/response_spec.rb
|
166
139
|
- spec/full_circle/upcoming_event_builder_spec.rb
|
167
140
|
- spec/spec_helper.rb
|
168
|
-
- spec/support/shared/
|
169
|
-
- spec/support/shared/
|
170
|
-
- spec/support/shared/
|
171
|
-
homepage: https://github.com/
|
141
|
+
- spec/support/shared/cacher_examples.rb
|
142
|
+
- spec/support/shared/event_examples.rb
|
143
|
+
- spec/support/shared/object_builder_examples.rb
|
144
|
+
homepage: https://github.com/animascodelabs/full_circle
|
172
145
|
licenses: []
|
173
146
|
metadata: {}
|
174
147
|
post_install_message:
|
@@ -177,17 +150,17 @@ require_paths:
|
|
177
150
|
- lib
|
178
151
|
required_ruby_version: !ruby/object:Gem::Requirement
|
179
152
|
requirements:
|
180
|
-
- -
|
153
|
+
- - '>='
|
181
154
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
155
|
+
version: 2.0.0
|
183
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
157
|
requirements:
|
185
|
-
- -
|
158
|
+
- - '>='
|
186
159
|
- !ruby/object:Gem::Version
|
187
160
|
version: '0'
|
188
161
|
requirements: []
|
189
162
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.0.
|
163
|
+
rubygems_version: 2.0.14
|
191
164
|
signing_key:
|
192
165
|
specification_version: 4
|
193
166
|
summary: Library for interfacing with the 360Directories API
|
@@ -212,6 +185,6 @@ test_files:
|
|
212
185
|
- spec/full_circle/response_spec.rb
|
213
186
|
- spec/full_circle/upcoming_event_builder_spec.rb
|
214
187
|
- spec/spec_helper.rb
|
215
|
-
- spec/support/shared/
|
216
|
-
- spec/support/shared/
|
217
|
-
- spec/support/shared/
|
188
|
+
- spec/support/shared/cacher_examples.rb
|
189
|
+
- spec/support/shared/event_examples.rb
|
190
|
+
- spec/support/shared/object_builder_examples.rb
|
data/Guardfile
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
guard 'rspec', :cli => "--color" do
|
5
|
-
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
|
-
watch('spec/spec_helper.rb') { "spec" }
|
8
|
-
|
9
|
-
# Rails example
|
10
|
-
# watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
-
# watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
-
# watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
-
# watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
-
# watch('config/routes.rb') { "spec/routing" }
|
15
|
-
# watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
-
|
17
|
-
# Capybara features specs
|
18
|
-
# watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
19
|
-
|
20
|
-
# Turnip features and steps
|
21
|
-
# watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
-
# watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
-
end
|
24
|
-
|