twelve 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +220 -0
- data/Rakefile +8 -0
- data/lib/twelve.rb +32 -0
- data/lib/twelve/api/clients.rb +55 -0
- data/lib/twelve/api/gauges.rb +67 -0
- data/lib/twelve/api/gauges/content.rb +36 -0
- data/lib/twelve/api/gauges/engines.rb +32 -0
- data/lib/twelve/api/gauges/locations.rb +32 -0
- data/lib/twelve/api/gauges/referrers.rb +36 -0
- data/lib/twelve/api/gauges/resolutions.rb +32 -0
- data/lib/twelve/api/gauges/shares.rb +45 -0
- data/lib/twelve/api/gauges/technology.rb +32 -0
- data/lib/twelve/api/gauges/terms.rb +36 -0
- data/lib/twelve/api/gauges/traffic.rb +32 -0
- data/lib/twelve/api/me.rb +28 -0
- data/lib/twelve/connection.rb +26 -0
- data/lib/twelve/resource_proxy.rb +46 -0
- data/lib/twelve/version.rb +4 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/twelve/api/clients_spec.rb +43 -0
- data/spec/twelve/api/gauges/content_spec.rb +54 -0
- data/spec/twelve/api/gauges/engines_spec.rb +32 -0
- data/spec/twelve/api/gauges/locations_spec.rb +32 -0
- data/spec/twelve/api/gauges/referrers_spec.rb +54 -0
- data/spec/twelve/api/gauges/resolutions_spec.rb +36 -0
- data/spec/twelve/api/gauges/shares_spec.rb +74 -0
- data/spec/twelve/api/gauges/technology_spec.rb +36 -0
- data/spec/twelve/api/gauges/terms_spec.rb +52 -0
- data/spec/twelve/api/gauges/traffic_spec.rb +34 -0
- data/spec/twelve/api/gauges_spec.rb +119 -0
- data/spec/twelve/api/me_spec.rb +34 -0
- data/spec/twelve/connection_spec.rb +11 -0
- data/spec/twelve/resource_proxy_spec.rb +34 -0
- data/spec/twelve_spec.rb +16 -0
- data/twelve.gemspec +29 -0
- metadata +230 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Content do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#content" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return top content" do
|
9
|
+
VCR.use_cassette('content') do
|
10
|
+
response = subject.gauges(GAUGE_ID).content
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response['page'].should == 1
|
13
|
+
response['per_page'].should == 50
|
14
|
+
response.should have_key('urls')
|
15
|
+
|
16
|
+
content = response['content']
|
17
|
+
content.size.should > 0
|
18
|
+
content.first['title'].should_not be_nil
|
19
|
+
content.first['views'].should be_instance_of(Fixnum)
|
20
|
+
content.first['path'].should_not be_nil
|
21
|
+
content.first['host'].should_not be_nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with page number" do
|
27
|
+
it "should return content for page" do
|
28
|
+
VCR.use_cassette('content(:page => 2)') do
|
29
|
+
response = subject.gauges(GAUGE_ID).content(:page => 2)
|
30
|
+
response['page'].should == 2
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with a date" do
|
36
|
+
it "should return content for that date" do
|
37
|
+
VCR.use_cassette('content("2011-12-8")') do
|
38
|
+
response = subject.gauges(GAUGE_ID).content('2011-12-8')
|
39
|
+
response['date'].should == '2011-12-08'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "with a date and page" do
|
45
|
+
it "should return content for that date" do
|
46
|
+
VCR.use_cassette('content("2011-12-8", :page => 2)') do
|
47
|
+
response = subject.gauges(GAUGE_ID).content('2011-12-8', :page => 2)
|
48
|
+
response['date'].should == '2011-12-08'
|
49
|
+
response['page'].should == 2
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Engines do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#engines" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return search engines" do
|
9
|
+
VCR.use_cassette('engines') do
|
10
|
+
response = subject.gauges(GAUGE_ID).engines
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response.should have_key('urls')
|
13
|
+
|
14
|
+
engines = response['engines']
|
15
|
+
engines.size.should > 0
|
16
|
+
engines.first['title'].should_not be_nil
|
17
|
+
engines.first['views'].should be_instance_of(Fixnum)
|
18
|
+
engines.first['key'].should_not be_nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with a date" do
|
24
|
+
it "should return engines for that date" do
|
25
|
+
VCR.use_cassette('engines("2011-12-8")') do
|
26
|
+
response = subject.gauges(GAUGE_ID).engines('2011-12-8')
|
27
|
+
response['date'].should == '2011-12-08'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Locations do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#locations" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return locations" do
|
9
|
+
VCR.use_cassette('locations') do
|
10
|
+
response = subject.gauges(GAUGE_ID).locations
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response.should have_key('urls')
|
13
|
+
|
14
|
+
locations = response['locations']
|
15
|
+
locations.size.should > 0
|
16
|
+
locations.first['title'].should_not be_nil
|
17
|
+
locations.first['views'].should be_instance_of(Fixnum)
|
18
|
+
locations.first['key'].should_not be_nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with a date" do
|
24
|
+
it "should return locations for that date" do
|
25
|
+
VCR.use_cassette('locations("2011-12-8")') do
|
26
|
+
response = subject.gauges(GAUGE_ID).locations('2011-12-8')
|
27
|
+
response['date'].should == '2011-12-08'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Referrers do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#referrers" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return todays referrers" do
|
9
|
+
VCR.use_cassette('referrers') do
|
10
|
+
response = subject.gauges(GAUGE_ID).referrers
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response['page'].should == 1
|
13
|
+
response['per_page'].should == 50
|
14
|
+
response.should have_key('urls')
|
15
|
+
|
16
|
+
referrers = response['referrers']
|
17
|
+
referrers.size.should > 0
|
18
|
+
referrers.first['url'].should_not be_nil
|
19
|
+
referrers.first['views'].should be_instance_of(Fixnum)
|
20
|
+
referrers.first['path'].should_not be_nil
|
21
|
+
referrers.first['host'].should_not be_nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with page number" do
|
27
|
+
it "should return content for page" do
|
28
|
+
VCR.use_cassette('referrers(:page => 2)') do
|
29
|
+
response = subject.gauges(GAUGE_ID).referrers(:page => 2)
|
30
|
+
response['page'].should == 2
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with a date" do
|
36
|
+
it "should return content for that date" do
|
37
|
+
VCR.use_cassette('referrers("2011-12-8")') do
|
38
|
+
response = subject.gauges(GAUGE_ID).referrers('2011-12-8')
|
39
|
+
response['date'].should == '2011-12-08'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "with a date and page" do
|
45
|
+
it "should return content for that date" do
|
46
|
+
VCR.use_cassette('referrers("2011-12-8", :page => 2)') do
|
47
|
+
response = subject.gauges(GAUGE_ID).referrers('2011-12-8', :page => 2)
|
48
|
+
response['date'].should == '2011-12-08'
|
49
|
+
response['page'].should == 2
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Resolutions do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#resolutions" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return top resolutions" do
|
9
|
+
VCR.use_cassette('resolutions') do
|
10
|
+
response = subject.gauges(GAUGE_ID).resolutions
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response.should have_key('urls')
|
13
|
+
|
14
|
+
browser_heights = response['browser_heights']
|
15
|
+
browser_heights.first['title'].should_not be_nil
|
16
|
+
browser_heights.first['views'].should be_instance_of(Fixnum)
|
17
|
+
browser_widths = response['browser_widths']
|
18
|
+
browser_widths.first['title'].should_not be_nil
|
19
|
+
browser_widths.first['views'].should be_instance_of(Fixnum)
|
20
|
+
screen_widths = response['screen_widths']
|
21
|
+
screen_widths.first['title'].should_not be_nil
|
22
|
+
screen_widths.first['views'].should be_instance_of(Fixnum)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with a date" do
|
28
|
+
it "should return resolutions for that date" do
|
29
|
+
VCR.use_cassette('resolutions("2011-12-8")') do
|
30
|
+
response = subject.gauges(GAUGE_ID).resolutions('2011-12-8')
|
31
|
+
response['date'].should == '2011-12-08'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Shares do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
def should_be_a_share(gauge, share)
|
7
|
+
share['name'].should_not be_nil
|
8
|
+
share['id'].should_not be_nil
|
9
|
+
['user', 'invite'].should include(share['type'])
|
10
|
+
share['email'].should_not be_nil
|
11
|
+
share['urls']['remove'].should == "https://secure.gaug.es/gauges/#{gauge['id']}/shares/#{share['id']}"
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#shares" do
|
15
|
+
it "returns list of users gauge is shared with" do
|
16
|
+
VCR.use_cassette('shares') do
|
17
|
+
# setup
|
18
|
+
temp = subject.gauges.create({
|
19
|
+
:title => 'Twelve Gauge',
|
20
|
+
:tz => 'Eastern Time (US & Canada)'
|
21
|
+
})
|
22
|
+
subject.gauges(temp['id']).share({:email => 'john@doe.com'})
|
23
|
+
|
24
|
+
# the meat of the test
|
25
|
+
shares = subject.gauges(temp['id']).shares
|
26
|
+
shares.size.should > 0
|
27
|
+
should_be_a_share(temp, shares.first)
|
28
|
+
|
29
|
+
# teardown
|
30
|
+
subject.gauges(temp['id']).destroy
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#share" do
|
36
|
+
it "shares gauge" do
|
37
|
+
VCR.use_cassette('share') do
|
38
|
+
# setup
|
39
|
+
temp = subject.gauges.create({
|
40
|
+
:title => 'Twelve Gauge',
|
41
|
+
:tz => 'Eastern Time (US & Canada)'
|
42
|
+
})
|
43
|
+
|
44
|
+
# the meat of the test
|
45
|
+
share = subject.gauges(temp['id']).share({:email => 'john@doe.com'})
|
46
|
+
should_be_a_share(temp, share)
|
47
|
+
share['email'].should == 'john@doe.com'
|
48
|
+
|
49
|
+
# teardown
|
50
|
+
subject.gauges(temp['id']).destroy
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#unshare" do
|
56
|
+
it "un-shares a gauge" do
|
57
|
+
VCR.use_cassette('unshare') do
|
58
|
+
# setup
|
59
|
+
temp = subject.gauges.create({
|
60
|
+
:title => 'Twelve Gauge',
|
61
|
+
:tz => 'Eastern Time (US & Canada)'
|
62
|
+
})
|
63
|
+
temp_share = subject.gauges(temp['id']).share({:email => 'john@doe.com'})
|
64
|
+
|
65
|
+
# the meat of the test
|
66
|
+
share = subject.gauges(temp['id']).unshare(temp_share['id'])
|
67
|
+
share['id'].should == temp_share['id']
|
68
|
+
|
69
|
+
# teardown
|
70
|
+
subject.gauges(temp['id']).destroy
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Technology do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#technology" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return top technology" do
|
9
|
+
VCR.use_cassette('technology') do
|
10
|
+
response = subject.gauges(GAUGE_ID).technology
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response.should have_key('urls')
|
13
|
+
|
14
|
+
browsers = response['browsers']
|
15
|
+
browsers.first['title'].should_not be_nil
|
16
|
+
browsers.first['views'].should be_instance_of(Fixnum)
|
17
|
+
browsers.first['versions'].size.should > 0
|
18
|
+
browsers.first['key'].should_not be_nil
|
19
|
+
platforms = response['platforms']
|
20
|
+
platforms.first['title'].should_not be_nil
|
21
|
+
platforms.first['views'].should be_instance_of(Fixnum)
|
22
|
+
platforms.first['key'].should_not be_nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with a date" do
|
28
|
+
it "should return technology for that date" do
|
29
|
+
VCR.use_cassette('technology("2011-12-8")') do
|
30
|
+
response = subject.gauges(GAUGE_ID).technology('2011-12-8')
|
31
|
+
response['date'].should == '2011-12-08'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Terms do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#terms" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return search terms" do
|
9
|
+
VCR.use_cassette('terms') do
|
10
|
+
response = subject.gauges(GAUGE_ID).terms
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response['page'].should == 1
|
13
|
+
response['per_page'].should == 50
|
14
|
+
response.should have_key('urls')
|
15
|
+
|
16
|
+
terms = response['terms']
|
17
|
+
terms.size.should > 0
|
18
|
+
terms.first['term'].should_not be_nil
|
19
|
+
terms.first['views'].should be_instance_of(Fixnum)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "with page number" do
|
25
|
+
it "should return terms for page" do
|
26
|
+
VCR.use_cassette('terms(:page => 2)') do
|
27
|
+
response = subject.gauges(GAUGE_ID).terms(:page => 2)
|
28
|
+
response['page'].should == 2
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with a date" do
|
34
|
+
it "should return terms for that date" do
|
35
|
+
VCR.use_cassette('terms("2011-12-8")') do
|
36
|
+
response = subject.gauges(GAUGE_ID).terms('2011-12-8')
|
37
|
+
response['date'].should == '2011-12-08'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "with a date and page" do
|
43
|
+
it "should return terms for that date" do
|
44
|
+
VCR.use_cassette('terms("2011-12-8", :page => 2)') do
|
45
|
+
response = subject.gauges(GAUGE_ID).terms('2011-12-8', :page => 2)
|
46
|
+
response['date'].should == '2011-12-08'
|
47
|
+
response['page'].should == 2
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges::Traffic do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
describe "#traffic" do
|
7
|
+
context "with no args" do
|
8
|
+
it "should return top traffic" do
|
9
|
+
VCR.use_cassette('traffic') do
|
10
|
+
response = subject.gauges(GAUGE_ID).traffic
|
11
|
+
response['date'].should_not be_nil
|
12
|
+
response.should have_key('urls')
|
13
|
+
response['views'].should be_instance_of(Fixnum)
|
14
|
+
response['people'].should be_instance_of(Fixnum)
|
15
|
+
|
16
|
+
traffic = response['traffic']
|
17
|
+
traffic.size.should > 0
|
18
|
+
traffic.first['date'].should_not be_nil
|
19
|
+
traffic.first['views'].should be_instance_of(Fixnum)
|
20
|
+
traffic.first['people'].should be_instance_of(Fixnum)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with a date" do
|
26
|
+
it "should return traffic for that date" do
|
27
|
+
VCR.use_cassette('traffic("2011-12-8")') do
|
28
|
+
response = subject.gauges(GAUGE_ID).traffic('2011-12-8')
|
29
|
+
response['date'].should == '2011-12-08'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twelve::API::Gauges do
|
4
|
+
subject { Twelve.new(ACCESS_TOKEN) }
|
5
|
+
|
6
|
+
def should_be_a_gauge(gauge)
|
7
|
+
gauge['id'].should_not be_nil
|
8
|
+
gauge['title'].should_not be_nil
|
9
|
+
gauge['tz'].should_not be_nil
|
10
|
+
gauge['urls']['self'].should == "https://secure.gaug.es/gauges/#{gauge['id']}"
|
11
|
+
gauge['urls']['referrers'].should == "https://secure.gaug.es/gauges/#{gauge['id']}/referrers"
|
12
|
+
gauge['urls']['technology'].should == "https://secure.gaug.es/gauges/#{gauge['id']}/technology"
|
13
|
+
gauge.should have_key('all_time')
|
14
|
+
gauge.should have_key('today')
|
15
|
+
gauge.should have_key('yesterday')
|
16
|
+
gauge.should have_key('recent_hours')
|
17
|
+
gauge.should have_key('recent_days')
|
18
|
+
gauge.should have_key('recent_months')
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#gauges" do
|
22
|
+
# will only pass if you already have a gauge created on your account
|
23
|
+
context "without an id" do
|
24
|
+
it "returns your gauges" do
|
25
|
+
VCR.use_cassette('gauges') do
|
26
|
+
# setup
|
27
|
+
temp = subject.gauges.create({
|
28
|
+
:title => 'Twelve Gauge',
|
29
|
+
:tz => 'Eastern Time (US & Canada)'
|
30
|
+
})
|
31
|
+
|
32
|
+
# actually run the request and tests
|
33
|
+
gauges = subject.gauges
|
34
|
+
gauges.should be_instance_of(Array)
|
35
|
+
gauges.size.should > 0
|
36
|
+
should_be_a_gauge(gauges.first)
|
37
|
+
|
38
|
+
# teardown
|
39
|
+
subject.gauges(temp['id']).destroy
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#create" do
|
44
|
+
it "creates and returns gauge" do
|
45
|
+
VCR.use_cassette('gauges_create') do
|
46
|
+
gauge = subject.gauges.create({
|
47
|
+
:title => 'Twelve Gauge',
|
48
|
+
:tz => 'Eastern Time (US & Canada)'
|
49
|
+
})
|
50
|
+
should_be_a_gauge(gauge)
|
51
|
+
gauge['title'].should == 'Twelve Gauge'
|
52
|
+
|
53
|
+
# teardown
|
54
|
+
subject.gauges(gauge['id']).destroy
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
#
|
60
|
+
context "with an id" do
|
61
|
+
context "with attributes" do
|
62
|
+
it "updates and returns the gauge" do
|
63
|
+
VCR.use_cassette('gauges(id, attributes)') do
|
64
|
+
# setup
|
65
|
+
temp = subject.gauges.create({
|
66
|
+
:title => 'Twelve Gauge',
|
67
|
+
:tz => 'Eastern Time (US & Canada)'
|
68
|
+
})
|
69
|
+
|
70
|
+
gauge = subject.gauges(temp['id'], {
|
71
|
+
:title => '12 Gauge'
|
72
|
+
})
|
73
|
+
should_be_a_gauge(gauge)
|
74
|
+
gauge['title'].should == '12 Gauge'
|
75
|
+
|
76
|
+
# teardown
|
77
|
+
subject.gauges(temp['id']).destroy
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "without attributes" do
|
83
|
+
it "returns a gauge" do
|
84
|
+
VCR.use_cassette('gauges(id)') do
|
85
|
+
# setup
|
86
|
+
temp = subject.gauges.create({
|
87
|
+
:title => 'Twelve Gauge',
|
88
|
+
:tz => 'Eastern Time (US & Canada)'
|
89
|
+
})
|
90
|
+
|
91
|
+
# actually run the request and tests
|
92
|
+
gauge = subject.gauges(temp['id'])
|
93
|
+
should_be_a_gauge(gauge)
|
94
|
+
gauge['title'].should == 'Twelve Gauge'
|
95
|
+
|
96
|
+
# teardown
|
97
|
+
subject.gauges(temp['id']).destroy
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "#delete" do
|
102
|
+
it "deletes and returns gauge" do
|
103
|
+
VCR.use_cassette('gauges_delete') do
|
104
|
+
# setup
|
105
|
+
delete = subject.gauges.create({
|
106
|
+
:title => 'Twelve Gauge',
|
107
|
+
:tz => 'Eastern Time (US & Canada)'
|
108
|
+
})
|
109
|
+
|
110
|
+
gauge = subject.gauges(delete['id']).destroy
|
111
|
+
should_be_a_gauge(gauge)
|
112
|
+
gauge['id'].should == delete['id']
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|