lita-onewheel-beer-base 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,188 @@
1
+ require 'spec_helper'
2
+
3
+ describe Lita::Handlers::OnewheelBeerBase, lita_handler: true do
4
+ it { is_expected.to route_command('taps') }
5
+ it { is_expected.to route_command('taps 4') }
6
+ it { is_expected.to route_command('taps nitro') }
7
+ it { is_expected.to route_command('taps CASK') }
8
+ it { is_expected.to route_command('taps <$4') }
9
+ it { is_expected.to route_command('taps < $4') }
10
+ it { is_expected.to route_command('taps <=$4') }
11
+ it { is_expected.to route_command('taps <= $4') }
12
+ it { is_expected.to route_command('taps >4%') }
13
+ it { is_expected.to route_command('taps > 4%') }
14
+ it { is_expected.to route_command('taps >=4%') }
15
+ it { is_expected.to route_command('taps >= 4%') }
16
+ it { is_expected.to route_command('tapslow') }
17
+ it { is_expected.to route_command('tapsabvhigh') }
18
+ it { is_expected.to route_command('tapsabvlow') }
19
+
20
+ before do
21
+ mock = File.open('spec/fixtures/baileys.html').read
22
+ allow(RestClient).to receive(:get) { mock }
23
+ end
24
+
25
+ it 'shows the taps' do
26
+ send_command 'taps'
27
+ expect(replies.last).to eq("Bailey's taps: 1) Cider Riot! Plastic Paddy 2) Fox Tail Rosenberry 3) (Cask) Machine House Crystal Maze 4) Wild Ride Solidarity 5) Mazama Gillian’s Red 6) (Nitro) Backwoods Winchester Brown 7) Fort George Vortex 8) Fat Head’s Zeus Juice 9) Hopworks Noggin’ Floggin’ 10) Anderson Valley Briney Melon Gose 11) Lagunitas Copper Fusion Ale 12) Double Mountain Fast Lane 13) Burnside Couch Lager 14) Bell’s Oatmeal Stout 15) Baerlic Wildcat 16) New Belgium La Folie 17) Culmination Urizen 18) Knee Deep Hop Surplus 19) Cascade Lakes Ziggy Stardust 20) Knee Deep Dark Horse 21) Coronado Orange Avenue Wit 22) GoodLife 29er 23) Amnesia Slow Train Porter 24) Oakshire Perfect Storm 25) Green Flash Passion Fruit Kicker")
28
+ end
29
+
30
+ it 'displays details for tap 4' do
31
+ send_command 'taps 4'
32
+ expect(replies.last).to eq('Bailey\'s tap 4) Wild Ride Solidarity - Abbey Dubbel – Barrel Aged (Pinot Noir) 8.2%, 4oz - $4 | 12oz - $7, 26% remaining')
33
+ end
34
+
35
+ it 'doesn\'t explode on 1' do
36
+ send_command 'taps 1'
37
+ expect(replies.count).to eq(1)
38
+ expect(replies.last).to eq('Bailey\'s tap 1) Cider Riot! Plastic Paddy - Apple Cider w/ Irish tea 6.0%, 10oz - $4 | 20oz - $7 | 32oz Crowler - $10, 48% remaining')
39
+ end
40
+
41
+ it 'gets nitro' do
42
+ send_command 'taps nitro'
43
+ expect(replies.last).to eq('Bailey\'s tap 6) (Nitro) Backwoods Winchester Brown - Brown Ale 6.2%, 10oz - $3 | 20oz - $5, 98% remaining')
44
+ end
45
+
46
+ it 'gets cask' do
47
+ send_command 'taps cask'
48
+ expect(replies.last).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
49
+ end
50
+
51
+ it 'searches for ipa' do
52
+ send_command 'taps ipa'
53
+ expect(replies.last).to eq("Bailey's tap 24) Oakshire Perfect Storm - Imperial IPA 9.0%, 10oz - $4 | 20oz - $6 | 32oz Crowler - $10, 61% remaining")
54
+ end
55
+
56
+ it 'searches for brown' do
57
+ send_command 'taps brown'
58
+ expect(replies.last).to eq("Bailey's tap 22) GoodLife 29er - India Brown Ale 6.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 37% remaining")
59
+ end
60
+
61
+ it 'searches for abv >9%' do
62
+ send_command 'taps >9%'
63
+ expect(replies.count).to eq(4)
64
+ expect(replies[0]).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
65
+ expect(replies[1]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
66
+ expect(replies[2]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
67
+ expect(replies[3]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
68
+ end
69
+
70
+ it 'searches for abv > 9%' do
71
+ send_command 'taps > 9%'
72
+ expect(replies.count).to eq(4)
73
+ expect(replies[0]).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
74
+ expect(replies[1]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
75
+ expect(replies[2]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
76
+ expect(replies[3]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
77
+ end
78
+
79
+ it 'searches for abv >= 9%' do
80
+ send_command 'taps >= 9%'
81
+ expect(replies.count).to eq(5)
82
+ expect(replies[0]).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
83
+ expect(replies[1]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
84
+ expect(replies[2]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
85
+ expect(replies[3]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
86
+ expect(replies.last).to eq("Bailey's tap 24) Oakshire Perfect Storm - Imperial IPA 9.0%, 10oz - $4 | 20oz - $6 | 32oz Crowler - $10, 61% remaining")
87
+ end
88
+
89
+ it 'searches for abv <4.1%' do
90
+ send_command 'taps <4.1%'
91
+ expect(replies.count).to eq(2)
92
+ expect(replies[0]).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
93
+ expect(replies.last).to eq("Bailey's tap 11) Lagunitas Copper Fusion Ale - Copper Ale 4.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 19% remaining")
94
+ end
95
+
96
+ it 'searches for abv < 4.1%' do
97
+ send_command 'taps < 4.1%'
98
+ expect(replies.count).to eq(2)
99
+ expect(replies[0]).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
100
+ expect(replies.last).to eq("Bailey's tap 11) Lagunitas Copper Fusion Ale - Copper Ale 4.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 19% remaining")
101
+ end
102
+
103
+ it 'searches for abv <= 4%' do
104
+ send_command 'taps <= 4%'
105
+ expect(replies.count).to eq(2)
106
+ expect(replies[0]).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
107
+ expect(replies.last).to eq("Bailey's tap 11) Lagunitas Copper Fusion Ale - Copper Ale 4.0%, 10oz - $3 | 20oz - $5 | 32oz Crowler - $8, 19% remaining")
108
+ end
109
+
110
+ it 'searches for prices >$6' do
111
+ send_command 'taps >$6'
112
+ expect(replies.count).to eq(2)
113
+ expect(replies[0]).to eq("Bailey's tap 1) Cider Riot! Plastic Paddy - Apple Cider w/ Irish tea 6.0%, 10oz - $4 | 20oz - $7 | 32oz Crowler - $10, 48% remaining")
114
+ expect(replies[1]).to eq("Bailey's tap 4) Wild Ride Solidarity - Abbey Dubbel – Barrel Aged (Pinot Noir) 8.2%, 4oz - $4 | 12oz - $7, 26% remaining")
115
+ end
116
+
117
+ it 'searches for prices >=$6' do
118
+ send_command 'taps >=$6'
119
+ expect(replies.count).to eq(4)
120
+ expect(replies[0]).to eq("Bailey's tap 1) Cider Riot! Plastic Paddy - Apple Cider w/ Irish tea 6.0%, 10oz - $4 | 20oz - $7 | 32oz Crowler - $10, 48% remaining")
121
+ expect(replies[1]).to eq("Bailey's tap 4) Wild Ride Solidarity - Abbey Dubbel – Barrel Aged (Pinot Noir) 8.2%, 4oz - $4 | 12oz - $7, 26% remaining")
122
+ expect(replies[2]).to eq("Bailey's tap 9) Hopworks Noggin’ Floggin’ - Barleywine 11.0%, 4oz - $3 | 12oz - $6 | 32oz Crowler - $13, 34% remaining")
123
+ expect(replies[3]).to eq("Bailey's tap 24) Oakshire Perfect Storm - Imperial IPA 9.0%, 10oz - $4 | 20oz - $6 | 32oz Crowler - $10, 61% remaining")
124
+ end
125
+
126
+ it 'searches for prices > $6' do
127
+ send_command 'taps > $6'
128
+ expect(replies.count).to eq(2)
129
+ expect(replies[0]).to eq("Bailey's tap 1) Cider Riot! Plastic Paddy - Apple Cider w/ Irish tea 6.0%, 10oz - $4 | 20oz - $7 | 32oz Crowler - $10, 48% remaining")
130
+ expect(replies[1]).to eq("Bailey's tap 4) Wild Ride Solidarity - Abbey Dubbel – Barrel Aged (Pinot Noir) 8.2%, 4oz - $4 | 12oz - $7, 26% remaining")
131
+ end
132
+
133
+ it 'searches for prices <$4.1' do
134
+ send_command 'taps <$4.1'
135
+ expect(replies.count).to eq(3)
136
+ expect(replies[0]).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
137
+ expect(replies[1]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
138
+ expect(replies[2]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
139
+ end
140
+
141
+ it 'searches for prices < $4.01' do
142
+ send_command 'taps < $4.01'
143
+ expect(replies.count).to eq(3)
144
+ expect(replies[0]).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
145
+ expect(replies[1]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
146
+ expect(replies[2]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
147
+ end
148
+
149
+ it 'searches for prices <= $4.00' do
150
+ send_command 'taps <= $4.00'
151
+ expect(replies.count).to eq(3)
152
+ expect(replies[0]).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
153
+ expect(replies[1]).to eq("Bailey's tap 18) Knee Deep Hop Surplus - Triple IPA 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 25% remaining")
154
+ expect(replies[2]).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
155
+ end
156
+
157
+ it 'runs a random beer through' do
158
+ send_command 'taps roulette'
159
+ expect(replies.count).to eq(1)
160
+ expect(replies.last).to include("Bailey's tap")
161
+ end
162
+
163
+ it 'runs a random beer through' do
164
+ send_command 'taps random'
165
+ expect(replies.count).to eq(1)
166
+ expect(replies.last).to include("Bailey's tap")
167
+ end
168
+
169
+ it 'searches with a space' do
170
+ send_command 'taps zeus juice'
171
+ expect(replies.last).to eq("Bailey's tap 8) Fat Head’s Zeus Juice - Belgian Strong Blonde 10.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $9, 44% remaining")
172
+ end
173
+
174
+ it 'displays low taps' do
175
+ send_command 'tapslow'
176
+ expect(replies.last).to eq("Bailey's tap 25) Green Flash Passion Fruit Kicker - Wheat Ale w/ Passion Fruit 5.5%, 10oz - $3 | 20oz - $5, <= 1% remaining")
177
+ end
178
+
179
+ it 'displays low abv' do
180
+ send_command 'tapsabvhigh'
181
+ expect(replies.last).to eq("Bailey's tap 20) Knee Deep Dark Horse - Imperial Stout 12.0%, 4oz - $2 | 12oz - $4 | 32oz Crowler - $10, 39% remaining")
182
+ end
183
+
184
+ it 'displays high abv' do
185
+ send_command 'tapsabvlow'
186
+ expect(replies.last).to eq("Bailey's tap 3) (Cask) Machine House Crystal Maze - ESB 4.0%, 10oz - $3 | 20oz - $5, 57% remaining")
187
+ end
188
+ end
@@ -0,0 +1,14 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ SimpleCov.formatters = [
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ Coveralls::SimpleCov::Formatter
6
+ ]
7
+ SimpleCov.start { add_filter '/spec/' }
8
+
9
+ require 'lita-onewheel-beer-base'
10
+ require 'lita/rspec'
11
+
12
+ # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
13
+ # was generated with Lita 4, the compatibility mode should be left disabled.
14
+ Lita.version_3_compatibility_mode = false
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-onewheel-beer-base
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kreps
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: lita
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sanitize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rest-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rack-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.10'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.10'
125
+ - !ruby/object:Gem::Dependency
126
+ name: coveralls
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.8'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.8'
139
+ description: Lita base class for beer searches.
140
+ email:
141
+ - andrew.kreps@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
+ - Gemfile
149
+ - README.md
150
+ - Rakefile
151
+ - lib/lita-onewheel-beer-base.rb
152
+ - lib/lita/handlers/onewheel_beer_base.rb
153
+ - lita-onewheel-beer-base.gemspec
154
+ - spec/fixtures/baileys.html
155
+ - spec/fixtures/baileys_no_brewery_link.html
156
+ - spec/lita/handlers/onewheel_baileys_spec.rb
157
+ - spec/spec_helper.rb
158
+ homepage: https://github.com/onewheelskyward/lita-onewheel-beer-base
159
+ licenses:
160
+ - MIT
161
+ metadata:
162
+ lita_plugin_type: handler
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.5.1
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: See above.
183
+ test_files:
184
+ - spec/fixtures/baileys.html
185
+ - spec/fixtures/baileys_no_brewery_link.html
186
+ - spec/lita/handlers/onewheel_baileys_spec.rb
187
+ - spec/spec_helper.rb