lita-onewheel-beer-base 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf6b6da4d315c947e527249351bb2c16aa321fe1
4
- data.tar.gz: 96fdeea036a329521a653e24c1cadc15d9461e5c
3
+ metadata.gz: ba27f059e2386c8f073e36d1dd964cfa044d2290
4
+ data.tar.gz: 0ae882e0f099c96eee1df5c97e278a5f3c1b9f7e
5
5
  SHA512:
6
- metadata.gz: e9052d55acb31707866488d4944f981f586aa26471cd0594bf484f3fdcda35555ae1afb8aaf1addc43acb3e936b5d4279b90723de446dda4719a32020b989a60
7
- data.tar.gz: bb0efd2b616d2b5a0a41331e1211d5cef69f46e835ffe0b054741b4930bc72034c5335cdf838fb4fe91395b26c5701e9f17151e403257694151f0a60d86c2707
6
+ metadata.gz: 05f2f636fb6b37c9b648cde8a00f6d6e3b959f747a9105a3887c847a17e0bab75a36a6e9cde0cdd2083821d2bdd75009fadc04540fe01206bc489e887190b668
7
+ data.tar.gz: 7d83e20a0a193febd2b865e49dc79064c31ad0cdf57bed59400572562942bd0d687ffd251de1ae9e1a3dab20142bb8a88b4d48b7ef17186c2e711a06bf7c8071
@@ -5,12 +5,9 @@ require 'sanitize'
5
5
  module Lita
6
6
  module Handlers
7
7
  class OnewheelBeerBase < Handler
8
- attr_accessor :bar_name
9
-
10
8
  def taps_list(response)
11
- # wakka wakka
12
9
  beers = self.get_source
13
- reply = "#{@bar_name} taps: "
10
+ reply = 'taps: '
14
11
  beers.each do |tap, datum|
15
12
  reply += "#{tap}) "
16
13
  reply += get_tap_type_text(datum[:type])
@@ -34,7 +31,9 @@ module Lita
34
31
  query = response.matches[0][0].strip
35
32
  # Search directly by tap number OR full text match.
36
33
  # Let's make cask and nitro taps specific.
37
- if (query.match(/^\d+$/) and tap == query) or (datum[:search].to_s.match(/#{query}/i)) or (datum[:type].to_s.downcase.match(/#{query}/i)) # Cask and Nitro
34
+ if query.match(/^\d+$/) and tap == query
35
+ send_response(tap, datum, response)
36
+ elsif (datum[:search].to_s.match(/#{query}/i)) or (datum[:type].to_s.downcase.match(/#{query}/i)) # Cask and Nitro
38
37
  send_response(tap, datum, response)
39
38
  end
40
39
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-beer-base'
3
- spec.version = '2.0.1'
3
+ spec.version = '2.0.2'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita base class for beer searches.}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-beer-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
@@ -153,7 +153,6 @@ files:
153
153
  - lita-onewheel-beer-base.gemspec
154
154
  - spec/fixtures/baileys.html
155
155
  - spec/fixtures/baileys_no_brewery_link.html
156
- - spec/lita/handlers/onewheel_baileys_spec.rb
157
156
  - spec/spec_helper.rb
158
157
  homepage: https://github.com/onewheelskyward/lita-onewheel-beer-base
159
158
  licenses:
@@ -183,5 +182,4 @@ summary: See above.
183
182
  test_files:
184
183
  - spec/fixtures/baileys.html
185
184
  - spec/fixtures/baileys_no_brewery_link.html
186
- - spec/lita/handlers/onewheel_baileys_spec.rb
187
185
  - spec/spec_helper.rb
@@ -1,188 +0,0 @@
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