lita-onewheel-beer-wayfinder 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,92 @@
1
+ require 'spec_helper'
2
+
3
+ describe Lita::Handlers::OnewheelBeerWayfinder, lita_handler: true do
4
+ it { is_expected.to route_command('wayfinder') }
5
+ it { is_expected.to route_command('wayfinder 4') }
6
+ it { is_expected.to route_command('wayfinder nitro') }
7
+ it { is_expected.to route_command('wayfinder CASK') }
8
+ it { is_expected.to route_command('wayfinder <$4') }
9
+ it { is_expected.to route_command('wayfinder < $4') }
10
+ it { is_expected.to route_command('wayfinder <=$4') }
11
+ it { is_expected.to route_command('wayfinder <= $4') }
12
+ it { is_expected.to route_command('wayfinder >4%') }
13
+ it { is_expected.to route_command('wayfinder > 4%') }
14
+ it { is_expected.to route_command('wayfinder >=4%') }
15
+ it { is_expected.to route_command('wayfinder >= 4%') }
16
+ it { is_expected.to route_command('wayfinderabvhigh') }
17
+ it { is_expected.to route_command('wayfinderabvlow') }
18
+
19
+ before do
20
+ mock = File.open('spec/fixtures/wayfinder.html').read
21
+ allow(RestClient).to receive(:get) { mock }
22
+ end
23
+
24
+ it 'shows the taps' do
25
+ send_command 'wayfinder'
26
+ expect(replies.last).to include("taps: 1) Wayfinder ANDECHS VOLLBIER HELLES LAGER")
27
+ end
28
+
29
+ it 'displays details for tap 4' do
30
+ send_command 'wayfinder 4'
31
+ expect(replies.last).to include('Wayfinder tap 4) WEIHENSTEPHAN HEFEWEISSEBIER GERMAN HEFEWEIZEN')
32
+ end
33
+
34
+ it 'doesn\'t explode on 1' do
35
+ send_command 'wayfinder 1'
36
+ expect(replies.count).to eq(1)
37
+ expect(replies.last).to eq('Wayfinder tap 1) ANDECHS VOLLBIER HELLES LAGER - Beautifully malty, immensely drinkable Bavarian lager, 4.8%, ')
38
+ end
39
+
40
+ it 'searches for ipa' do
41
+ send_command 'wayfinder ipa'
42
+ expect(replies.last).to include('Wayfinder tap 14) PFRIEM TRIPLE IPA')
43
+ end
44
+
45
+ it 'searches for abv >9%' do
46
+ send_command 'wayfinder >9%'
47
+ expect(replies.count).to eq(2)
48
+ expect(replies[0]).to eq('Wayfinder tap 10) EVIL TWIN BISCOTTI BREAK IMPERIAL STOUT - Pitch black and deep. Coffee, toffee, aged cherry and roast. A wonderful dessert., 11.5%, ')
49
+ expect(replies[1]).to eq('Wayfinder tap 14) PFRIEM TRIPLE IPA - Three times the amount of hops and malt, brimming with flavors of peaches and cream, strawberries, ripe citrus., 10.5%, ')
50
+ end
51
+
52
+ it 'searches for abv > 9%' do
53
+ send_command 'wayfinder > 9%'
54
+ expect(replies.count).to eq(2)
55
+ expect(replies[0]).to eq('Wayfinder tap 10) EVIL TWIN BISCOTTI BREAK IMPERIAL STOUT - Pitch black and deep. Coffee, toffee, aged cherry and roast. A wonderful dessert., 11.5%, ')
56
+ expect(replies[1]).to eq('Wayfinder tap 14) PFRIEM TRIPLE IPA - Three times the amount of hops and malt, brimming with flavors of peaches and cream, strawberries, ripe citrus., 10.5%, ')
57
+ end
58
+
59
+ it 'searches for abv >= 9%' do
60
+ send_command 'wayfinder >= 9%'
61
+ expect(replies.count).to eq(2)
62
+ expect(replies[0]).to eq('Wayfinder tap 10) EVIL TWIN BISCOTTI BREAK IMPERIAL STOUT - Pitch black and deep. Coffee, toffee, aged cherry and roast. A wonderful dessert., 11.5%, ')
63
+ expect(replies.last).to eq('Wayfinder tap 14) PFRIEM TRIPLE IPA - Three times the amount of hops and malt, brimming with flavors of peaches and cream, strawberries, ripe citrus., 10.5%, ')
64
+ end
65
+
66
+ it 'runs a random beer through' do
67
+ send_command 'wayfinder roulette'
68
+ expect(replies.count).to eq(1)
69
+ expect(replies.last).to include('Wayfinder tap')
70
+ end
71
+
72
+ it 'runs a random beer through' do
73
+ send_command 'wayfinder random'
74
+ expect(replies.count).to eq(1)
75
+ expect(replies.last).to include('Wayfinder tap')
76
+ end
77
+
78
+ it 'searches with a space' do
79
+ send_command 'wayfinder cider riot'
80
+ expect(replies.last).to eq('Wayfinder tap 16) CIDER RIOT! EVERYBODY POGO HOPPED CIDER - Fantastic dry cider from our local buds., 6.7%, ')
81
+ end
82
+
83
+ it 'displays low abv' do
84
+ send_command 'wayfinderabvhigh'
85
+ expect(replies.last).to eq('Wayfinder tap 10) EVIL TWIN BISCOTTI BREAK IMPERIAL STOUT - Pitch black and deep. Coffee, toffee, aged cherry and roast. A wonderful dessert., 11.5%, ')
86
+ end
87
+
88
+ it 'displays high abv' do
89
+ send_command 'wayfinderabvlow'
90
+ expect(replies.last).to eq('Wayfinder tap 1) ANDECHS VOLLBIER HELLES LAGER - Beautifully malty, immensely drinkable Bavarian lager, 4.8%, ')
91
+ end
92
+ 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-wayfinder'
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,213 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-onewheel-beer-wayfinder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kreps
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-21 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'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sanitize
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: lita-onewheel-beer-base
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.4'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack-test
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.6'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.6'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.10'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.10'
153
+ - !ruby/object:Gem::Dependency
154
+ name: coveralls
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.8'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.8'
167
+ description: Lita interface to Wafinder's Barlistings.
168
+ email:
169
+ - andrew.kreps@gmail.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".gitignore"
175
+ - ".travis.yml"
176
+ - Gemfile
177
+ - README.md
178
+ - Rakefile
179
+ - lib/lita-onewheel-beer-wayfinder.rb
180
+ - lib/lita/handlers/onewheel_beer_wayfinder.rb
181
+ - lita-onewheel-beer-wayfinder.gemspec
182
+ - spec/fixtures/wayfinder.html
183
+ - spec/lita/handlers/onewheel_beer_wayfinder_spec.rb
184
+ - spec/spec_helper.rb
185
+ homepage: https://github.com/onewheelskyward/lita-onewheel-beer-wayfinder
186
+ licenses:
187
+ - MIT
188
+ metadata:
189
+ lita_plugin_type: handler
190
+ post_install_message:
191
+ rdoc_options: []
192
+ require_paths:
193
+ - lib
194
+ required_ruby_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ requirements: []
205
+ rubyforge_project:
206
+ rubygems_version: 2.5.2
207
+ signing_key:
208
+ specification_version: 4
209
+ summary: See above.
210
+ test_files:
211
+ - spec/fixtures/wayfinder.html
212
+ - spec/lita/handlers/onewheel_beer_wayfinder_spec.rb
213
+ - spec/spec_helper.rb