brewery_db 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +93 -0
- data/Rakefile +3 -0
- data/brewery_db.gemspec +22 -0
- data/lib/brewery_db.rb +36 -0
- data/lib/brewery_db/client.rb +36 -0
- data/lib/brewery_db/config.rb +21 -0
- data/lib/brewery_db/resource.rb +36 -0
- data/lib/brewery_db/resources/beers.rb +13 -0
- data/lib/brewery_db/resources/breweries.rb +13 -0
- data/lib/brewery_db/resources/categories.rb +13 -0
- data/lib/brewery_db/resources/glassware.rb +13 -0
- data/lib/brewery_db/resources/search.rb +25 -0
- data/lib/brewery_db/resources/styles.rb +13 -0
- data/lib/brewery_db/response.rb +18 -0
- data/lib/brewery_db/version.rb +3 -0
- data/spec/brewery_db/client_spec.rb +44 -0
- data/spec/brewery_db/config_spec.rb +54 -0
- data/spec/brewery_db/resource_spec.rb +33 -0
- data/spec/brewery_db/resources/beers_spec.rb +93 -0
- data/spec/brewery_db/resources/breweries_spec.rb +65 -0
- data/spec/brewery_db/resources/categories_spec.rb +49 -0
- data/spec/brewery_db/resources/glassware_spec.rb +47 -0
- data/spec/brewery_db/resources/search_spec.rb +72 -0
- data/spec/brewery_db/resources/styles_spec.rb +83 -0
- data/spec/brewery_db/response_spec.rb +19 -0
- data/spec/brewery_db_spec.rb +18 -0
- data/spec/fixtures/beers.yml +445 -0
- data/spec/fixtures/breweries.yml +409 -0
- data/spec/fixtures/categories.yml +102 -0
- data/spec/fixtures/glassware.yml +65 -0
- data/spec/fixtures/search.yml +314 -0
- data/spec/fixtures/styles.yml +317 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/shared/a_resource.rb +11 -0
- data/spec/support/vcr.rb +6 -0
- metadata +183 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BreweryDB::Config do
|
4
|
+
{
|
5
|
+
ADAPTER: Faraday.default_adapter,
|
6
|
+
ENDPOINT: 'http://api.brewerydb.com/v2',
|
7
|
+
USER_AGENT: "BreweryDB Ruby Gem #{BreweryDB::VERSION}"
|
8
|
+
}.each do |constant, value|
|
9
|
+
context constant do
|
10
|
+
subject { described_class.const_get(constant) }
|
11
|
+
|
12
|
+
it { should == value }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'defaults' do
|
17
|
+
its(:adapter) { should == described_class::ADAPTER }
|
18
|
+
its(:api_key) { should == nil }
|
19
|
+
its(:endpoint) { should == described_class::ENDPOINT }
|
20
|
+
its(:user_agent) { should == described_class::USER_AGENT }
|
21
|
+
end
|
22
|
+
|
23
|
+
context '#adapter=' do
|
24
|
+
specify do
|
25
|
+
expect {
|
26
|
+
subject.adapter = :typhoeus
|
27
|
+
}.to change(subject, :adapter).to(:typhoeus)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context '#api_key=' do
|
32
|
+
specify do
|
33
|
+
expect {
|
34
|
+
subject.api_key = 'A1029384756B'
|
35
|
+
}.to change(subject, :api_key).to('A1029384756B')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context '#endpoint=' do
|
40
|
+
specify do
|
41
|
+
expect {
|
42
|
+
subject.endpoint = 'http://api.playground.brewerydb.com'
|
43
|
+
}.to change(subject, :endpoint).to('http://api.playground.brewerydb.com')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context '#user_agent=' do
|
48
|
+
specify do
|
49
|
+
expect {
|
50
|
+
subject.user_agent = 'A BreweryDB Application'
|
51
|
+
}.to change(subject, :user_agent).to('A BreweryDB Application')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BreweryDB::Resource do
|
4
|
+
let(:client) { BreweryDB::Client.new }
|
5
|
+
|
6
|
+
context '.new' do
|
7
|
+
it 'accepts a client' do
|
8
|
+
described_class.new(client).should be_a(described_class)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'raises an exception without a client' do
|
12
|
+
expect { described_class.new }.to raise_error
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context '#connection' do
|
17
|
+
let(:endpoint) { URI.parse(BreweryDB::Config::ENDPOINT) }
|
18
|
+
|
19
|
+
subject { described_class.new(client).connection }
|
20
|
+
|
21
|
+
it { should be_a(Faraday::Connection) }
|
22
|
+
|
23
|
+
its(:'builder.handlers') { should include(FaradayMiddleware::ParseJson) }
|
24
|
+
|
25
|
+
its(:scheme) { should == endpoint.scheme }
|
26
|
+
its(:host) { should == endpoint.host }
|
27
|
+
its(:path_prefix) { should == endpoint.path }
|
28
|
+
|
29
|
+
its(:headers) do
|
30
|
+
should == { 'User-Agent' => BreweryDB::Config::USER_AGENT }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe BreweryDB::Resources::Beers do
|
6
|
+
it_behaves_like 'a resource' do
|
7
|
+
context '#all' do
|
8
|
+
let(:response) { described_class.new(client).all(abv: '5.5') }
|
9
|
+
|
10
|
+
subject { response }
|
11
|
+
|
12
|
+
its(:current_page) { should == 1 }
|
13
|
+
its(:number_of_pages) { should == 8 }
|
14
|
+
its(:status) { should == 'success' }
|
15
|
+
its(:data) { should be_a(Array) }
|
16
|
+
its(:data) { should have(50).results }
|
17
|
+
|
18
|
+
context 'result' do
|
19
|
+
subject { response.data.first }
|
20
|
+
|
21
|
+
it { should have(14).keys }
|
22
|
+
|
23
|
+
its(:id) { should == 'VjQIQW' }
|
24
|
+
its(:name) { should == '2011 Christmas Ale' }
|
25
|
+
its(:description) { should == "Every year since 1975 the brewers at Anchor have brewed a distinctive and unique Christmas Ale, which is available from early November to mid-January. The Ale's recipe is different every year—as is the tree on the label—but the intent with which we offer it remains the same: joy and celebration of the newness of life." }
|
26
|
+
its(:abv) { should == '5.5' }
|
27
|
+
its(:glassware_id) { should == 5 }
|
28
|
+
its(:available_id) { should == 4 }
|
29
|
+
its(:is_organic) { should == 'N' }
|
30
|
+
its(:status) { should == 'verified' }
|
31
|
+
its(:status_display) { should == 'Verified' }
|
32
|
+
its(:'glass.id') { should == 5 }
|
33
|
+
its(:'glass.name') { should == 'Pint' }
|
34
|
+
its(:'glass.create_date') { should == '2012-03-26 04:00:04' }
|
35
|
+
its(:'available.name') { should == 'Seasonal' }
|
36
|
+
its(:'available.description') { should == 'Available at the same time of year, every year.' }
|
37
|
+
its(:style_id) { should == 98 }
|
38
|
+
its(:'style.id') { should == 98 }
|
39
|
+
its(:'style.category.id') { should == 23 }
|
40
|
+
its(:'style.category.name') { should == 'Specialty Beer' }
|
41
|
+
its(:'style.category.bjcp_category') { should == '23' }
|
42
|
+
its(:'style.category.create_date') { should == '2012-03-26 04:00:04' }
|
43
|
+
its(:'style.category_id') { should == 23 }
|
44
|
+
its(:'style.name') { should == 'Specialty Beer' }
|
45
|
+
its(:'style.simple_url') { should == 'specialty-beer' }
|
46
|
+
its(:'style.create_date') { should == '2012-03-26 04:00:04' }
|
47
|
+
its(:create_date) { should == '2012-03-26 04:00:59' }
|
48
|
+
its(:update_date) { should be_nil }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context '#find' do
|
53
|
+
let(:response) { described_class.new(client).find('vYlBZQ') }
|
54
|
+
|
55
|
+
subject { response }
|
56
|
+
|
57
|
+
its(:status) { should == 'success' }
|
58
|
+
|
59
|
+
context 'data' do
|
60
|
+
subject { response.data }
|
61
|
+
|
62
|
+
it { should have(16).keys }
|
63
|
+
|
64
|
+
its(:id) { should == 'vYlBZQ' }
|
65
|
+
its(:name) { should == 'Peacemaker' }
|
66
|
+
its(:description) { should == 'Peace is a dangerous thing. Peacemaker is a west coast style American Pale Ale that uses several hop varieties to produces a unique and bountiful hop aroma with well balanced bitterness. A special blend of American and European malts make this a very well rounded, characterful beer.' }
|
67
|
+
its(:abv) { should == '5.7' }
|
68
|
+
its(:glassware_id) { should == 5 }
|
69
|
+
its(:available_id) { should == 1 }
|
70
|
+
its(:is_organic) { should == 'N' }
|
71
|
+
its(:status) { should == 'verified' }
|
72
|
+
its(:status_display) { should == 'Verified' }
|
73
|
+
its(:'glass.id') { should == 5 }
|
74
|
+
its(:'glass.name') { should == 'Pint' }
|
75
|
+
its(:'glass.create_date') { should == '2012-03-26 04:00:04' }
|
76
|
+
its(:'available.name') { should == 'Year Round' }
|
77
|
+
its(:'available.description') { should == 'Available year round as a staple beer.' }
|
78
|
+
its(:style_id) { should == 33 }
|
79
|
+
its(:'style.id') { should == 33 }
|
80
|
+
its(:'style.category.id') { should == 10 }
|
81
|
+
its(:'style.category.name') { should == 'American Ale' }
|
82
|
+
its(:'style.category.bjcp_category') { should == '10' }
|
83
|
+
its(:'style.category.create_date') { should == '2012-03-26 04:00:04' }
|
84
|
+
its(:'style.category_id') { should == 10 }
|
85
|
+
its(:'style.name') { should == 'American Pale Ale' }
|
86
|
+
its(:'style.simple_url') { should == 'american-pale-ale' }
|
87
|
+
its(:'style.create_date') { should == '2012-03-26 04:00:04' }
|
88
|
+
its(:create_date) { should == '2012-03-26 04:02:10' }
|
89
|
+
its(:update_date) { should == '2012-03-26 04:38:49' }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe BreweryDB::Resources::Breweries do
|
6
|
+
it_behaves_like 'a resource' do
|
7
|
+
context '#all' do
|
8
|
+
let(:response) { described_class.new(client).all(established: 2006) }
|
9
|
+
|
10
|
+
subject { response }
|
11
|
+
|
12
|
+
its(:current_page) { should == 1 }
|
13
|
+
its(:number_of_pages) { should == 1 }
|
14
|
+
its(:status) { should == 'success' }
|
15
|
+
its(:data) { should be_a(Array) }
|
16
|
+
its(:data) { should have(38).results }
|
17
|
+
|
18
|
+
context 'result' do
|
19
|
+
subject { response.data.first }
|
20
|
+
|
21
|
+
it { should have(9).keys }
|
22
|
+
|
23
|
+
its(:id) { should == 'Qt4daP' }
|
24
|
+
its(:name) { should == '612 Brew LLC' }
|
25
|
+
its(:description) { should == "At 612Brew, the newest beer company in the 612, we want to make your newest favorite beer you’ve never had.\n\nWith our operation moving to a larger location in Uptown, we have the opportunity to make and test out much larger batches of hand crafted beer and present them for you to try. You never know what we may brew next, a Porter, a Pilsner, a Bock or a Belgian. We are excited for each new beer that we make and hope you get excited to try them." }
|
26
|
+
its(:website) { should == 'http://612brew.com/' }
|
27
|
+
its(:established) { should == '2006' }
|
28
|
+
its(:is_organic) { should == 'N' }
|
29
|
+
its(:images) { should be_nil }
|
30
|
+
its(:status) { should == 'verified' }
|
31
|
+
its(:status_display) { should == 'Verified' }
|
32
|
+
its(:create_date) { should == '2012-03-25 04:00:17' }
|
33
|
+
its(:update_date) { should be_nil }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context '#find' do
|
38
|
+
let(:response) { described_class.new(client).find('d1zSa7') }
|
39
|
+
|
40
|
+
subject { response }
|
41
|
+
|
42
|
+
its(:status) { should == 'success' }
|
43
|
+
|
44
|
+
context 'data' do
|
45
|
+
subject { response.data }
|
46
|
+
|
47
|
+
it { should have(11).keys }
|
48
|
+
|
49
|
+
its(:id) { should == 'd1zSa7' }
|
50
|
+
its(:name) { should == 'Lonerider Brewing Company' }
|
51
|
+
its(:description) { should == "We opened our doors on January 23rd, 2009 and since then we have been impressed with the enthusiasm of craft beer aficionados we meet daily. The craft brewing industry is booming and you can find a tremendous variety out there. North Carolina has undoubtedly become the Southern State for beer with Asheville reigning supreme and Raleigh/Durham/CH not far behind. We hope you continue to support the variety and encourage new brewers to experiment with and craft new styles for everybody’s pleasure.\n\n\"Effect change; don't be an audience. Walk your own path, and instead of thinking outside the box, imagine if there was no box.\"" }
|
52
|
+
its(:website) { should == 'http://www.loneriderbeer.com/' }
|
53
|
+
its(:established) { should == '2009' }
|
54
|
+
its(:is_organic) { should == 'N' }
|
55
|
+
its(:'images.icon') { should == 'http://s3.amazonaws.com/brewerydbapi/brewery/d1zSa7/upload_kwaFB7-icon.png' }
|
56
|
+
its(:'images.medium') { should == 'http://s3.amazonaws.com/brewerydbapi/brewery/d1zSa7/upload_kwaFB7-medium.png' }
|
57
|
+
its(:'images.large') { should == 'http://s3.amazonaws.com/brewerydbapi/brewery/d1zSa7/upload_kwaFB7-large.png' }
|
58
|
+
its(:status) { should == 'verified' }
|
59
|
+
its(:status_display) { should == 'Verified' }
|
60
|
+
its(:create_date) { should == '2012-03-25 04:00:30' }
|
61
|
+
its(:update_date) { should == '2012-03-25 04:40:10' }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe BreweryDB::Resources::Categories do
|
6
|
+
it_behaves_like 'a resource' do
|
7
|
+
context '#all' do
|
8
|
+
let(:response) { described_class.new(client).all }
|
9
|
+
|
10
|
+
subject { response }
|
11
|
+
|
12
|
+
its(:current_page) { should be_nil }
|
13
|
+
its(:number_of_pages) { should be_nil }
|
14
|
+
its(:status) { should == 'success' }
|
15
|
+
its(:data) { should be_a(Array) }
|
16
|
+
its(:data) { should have(28).results }
|
17
|
+
|
18
|
+
context 'result' do
|
19
|
+
subject { response.data.first }
|
20
|
+
|
21
|
+
it { should have(4).keys }
|
22
|
+
|
23
|
+
its(:id) { should == 1 }
|
24
|
+
its(:name) { should == 'Light Lager' }
|
25
|
+
its(:bjcp_category) { should == '1' }
|
26
|
+
its(:create_date) { should == '2012-04-05 04:00:04' }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context '#find' do
|
31
|
+
let(:response) { described_class.new(client).find(1) }
|
32
|
+
|
33
|
+
subject { response }
|
34
|
+
|
35
|
+
its(:status) { should == 'success' }
|
36
|
+
|
37
|
+
context 'data' do
|
38
|
+
subject { response.data }
|
39
|
+
|
40
|
+
it { should have(4).keys }
|
41
|
+
|
42
|
+
its(:id) { should == 1 }
|
43
|
+
its(:name) { should == 'Light Lager' }
|
44
|
+
its(:bjcp_category) { should == '1' }
|
45
|
+
its(:create_date) { should == '2012-04-05 04:00:04' }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe BreweryDB::Resources::Glassware do
|
6
|
+
it_behaves_like 'a resource' do
|
7
|
+
context '#all' do
|
8
|
+
let(:response) { described_class.new(client).all }
|
9
|
+
|
10
|
+
subject { response }
|
11
|
+
|
12
|
+
its(:current_page) { should be_nil }
|
13
|
+
its(:number_of_pages) { should be_nil }
|
14
|
+
its(:status) { should == 'success' }
|
15
|
+
its(:data) { should be_a(Array) }
|
16
|
+
its(:data) { should have(15).results }
|
17
|
+
|
18
|
+
context 'result' do
|
19
|
+
subject { response.data.first }
|
20
|
+
|
21
|
+
it { should have(3).keys }
|
22
|
+
|
23
|
+
its(:id) { should == 1 }
|
24
|
+
its(:name) { should == 'Flute' }
|
25
|
+
its(:create_date) { should == '2012-01-03 02:41:33' }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context '#find' do
|
30
|
+
let(:response) { described_class.new(client).find(1) }
|
31
|
+
|
32
|
+
subject { response }
|
33
|
+
|
34
|
+
its(:status) { should == 'success' }
|
35
|
+
|
36
|
+
context 'data' do
|
37
|
+
subject { response.data }
|
38
|
+
|
39
|
+
it { should have(3).keys }
|
40
|
+
|
41
|
+
its(:id) { should == 1 }
|
42
|
+
its(:name) { should == 'Flute' }
|
43
|
+
its(:create_date) { should == '2012-01-03 02:41:33' }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe BreweryDB::Resources::Search do
|
6
|
+
it_behaves_like 'a resource' do
|
7
|
+
context '#all' do
|
8
|
+
let(:response) { described_class.new(client).all(q: 'IPA') }
|
9
|
+
|
10
|
+
subject { response }
|
11
|
+
|
12
|
+
its(:current_page) { should == 1 }
|
13
|
+
its(:number_of_pages) { should == 14 }
|
14
|
+
its(:status) { should == 'success' }
|
15
|
+
its(:data) { should be_a(Array) }
|
16
|
+
its(:data) { should have(50).results }
|
17
|
+
|
18
|
+
context 'result' do
|
19
|
+
subject { response.data.first }
|
20
|
+
|
21
|
+
it { should have(9).keys }
|
22
|
+
|
23
|
+
its(:type) { should be_nil }
|
24
|
+
its(:id) { should == 'ZnS2BI' }
|
25
|
+
its(:name) { should == 'IPA' }
|
26
|
+
its(:abv) { should == '6' }
|
27
|
+
its(:is_organic) { should == 'N' }
|
28
|
+
its(:'style.id') { should == 49 }
|
29
|
+
its(:'style.abv_max') { should == '7.5' }
|
30
|
+
its(:'style.abv_min') { should == '5.5' }
|
31
|
+
its(:'style.bjcp_subcategory') { should == 'B' }
|
32
|
+
its(:'style.category.id') { should == 14 }
|
33
|
+
its(:'style.category.name') { should == 'India Pale Ale (IPA)' }
|
34
|
+
its(:'style.category.bjcp_category') { should == '14' }
|
35
|
+
its(:'style.category.create_date') { should == '2012-04-05 04:00:04' }
|
36
|
+
its(:'style.category_id') { should == 14 }
|
37
|
+
its(:'style.name') { should == 'American IPA' }
|
38
|
+
its(:'style.fg_max') { should == '1.018' }
|
39
|
+
its(:'style.fg_min') { should == '1.01' }
|
40
|
+
its(:'style.ibu_max') { should == '70' }
|
41
|
+
its(:'style.ibu_min') { should == '40' }
|
42
|
+
its(:'style.og_max') { should == '1.075' }
|
43
|
+
its(:'style.og_min') { should == '1.056' }
|
44
|
+
its(:'style.srm_max') { should == '15' }
|
45
|
+
its(:'style.srm_min') { should == '6' }
|
46
|
+
its(:'style.simple_url') { should == 'american-ipa' }
|
47
|
+
its(:'style.create_date') { should == '2012-04-05 04:00:04' }
|
48
|
+
its(:style_id) { should == 49 }
|
49
|
+
its(:status) { should == 'verified' }
|
50
|
+
its(:status_display) { should == 'Verified' }
|
51
|
+
its(:create_date) { should == '2012-04-05 04:01:50' }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
{
|
56
|
+
beers: 'beer',
|
57
|
+
breweries: 'brewery',
|
58
|
+
guilds: 'guild',
|
59
|
+
events: 'event'
|
60
|
+
}.each do |method, type|
|
61
|
+
context "##{method}" do
|
62
|
+
subject { described_class.new(client) }
|
63
|
+
|
64
|
+
specify do
|
65
|
+
results = mock(:results)
|
66
|
+
subject.should_receive(:all).with(type: type, q: 'IPA').and_return(results)
|
67
|
+
subject.send(method, q: 'IPA').should == results
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe BreweryDB::Resources::Styles do
|
6
|
+
it_behaves_like 'a resource' do
|
7
|
+
context '#all' do
|
8
|
+
let(:response) { described_class.new(client).all }
|
9
|
+
|
10
|
+
subject { response }
|
11
|
+
|
12
|
+
its(:current_page) { should be_nil }
|
13
|
+
its(:number_of_pages) { should be_nil }
|
14
|
+
its(:status) { should == 'success' }
|
15
|
+
its(:data) { should be_a(Array) }
|
16
|
+
its(:data) { should have(98).results }
|
17
|
+
|
18
|
+
context 'result' do
|
19
|
+
subject { response.data.first }
|
20
|
+
|
21
|
+
it { should have(17).keys }
|
22
|
+
|
23
|
+
its(:id) { should == 1 }
|
24
|
+
its(:name) { should == 'Lite American Lager' }
|
25
|
+
its(:'category.id') { should == 1 }
|
26
|
+
its(:'category.name') { should == 'Light Lager' }
|
27
|
+
its(:'category.bjcp_category') { should == '1' }
|
28
|
+
its(:'category.create_date') { should == '2012-04-04 04:00:04' }
|
29
|
+
its(:category_id) { should == 1 }
|
30
|
+
its(:bjcp_subcategory) { should == 'A' }
|
31
|
+
its(:simple_url) { should == 'lite-american-lager' }
|
32
|
+
its(:ibu_min) { should == '8' }
|
33
|
+
its(:ibu_max) { should == '12' }
|
34
|
+
its(:abv_min) { should == '2.8' }
|
35
|
+
its(:abv_max) { should == '4.2' }
|
36
|
+
its(:srm_min) { should == '2' }
|
37
|
+
its(:srm_max) { should == '3' }
|
38
|
+
its(:og_min) { should == '1.028' }
|
39
|
+
its(:og_max) { should == '1.04' }
|
40
|
+
its(:fg_min) { should == '0.998' }
|
41
|
+
its(:fg_max) { should == '1.008' }
|
42
|
+
its(:create_date) { should == '2012-04-04 04:00:04' }
|
43
|
+
its(:update_date) { should be_nil }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context '#find' do
|
48
|
+
let(:response) { described_class.new(client).find(1) }
|
49
|
+
|
50
|
+
subject { response }
|
51
|
+
|
52
|
+
its(:status) { should == 'success' }
|
53
|
+
|
54
|
+
context 'data' do
|
55
|
+
subject { response.data }
|
56
|
+
|
57
|
+
it { should have(17).keys }
|
58
|
+
|
59
|
+
its(:id) { should == 1 }
|
60
|
+
its(:name) { should == 'Lite American Lager' }
|
61
|
+
its(:'category.id') { should == 1 }
|
62
|
+
its(:'category.name') { should == 'Light Lager' }
|
63
|
+
its(:'category.bjcp_category') { should == '1' }
|
64
|
+
its(:'category.create_date') { should == '2012-04-04 04:00:04' }
|
65
|
+
its(:category_id) { should == 1 }
|
66
|
+
its(:bjcp_subcategory) { should == 'A' }
|
67
|
+
its(:simple_url) { should == 'lite-american-lager' }
|
68
|
+
its(:ibu_min) { should == '8' }
|
69
|
+
its(:ibu_max) { should == '12' }
|
70
|
+
its(:abv_min) { should == '2.8' }
|
71
|
+
its(:abv_max) { should == '4.2' }
|
72
|
+
its(:srm_min) { should == '2' }
|
73
|
+
its(:srm_max) { should == '3' }
|
74
|
+
its(:og_min) { should == '1.028' }
|
75
|
+
its(:og_max) { should == '1.04' }
|
76
|
+
its(:fg_min) { should == '0.998' }
|
77
|
+
its(:fg_max) { should == '1.008' }
|
78
|
+
its(:create_date) { should == '2012-04-04 04:00:04' }
|
79
|
+
its(:update_date) { should be_nil }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|