lita-onewheel-duckduckgo 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01535e1cbb8312c96c6a3e4c5859710ad28330b7
4
- data.tar.gz: 00dfbc205fc831eb27458c5be33aedd59c3406e7
3
+ metadata.gz: 631c3e55555937e7cf6b0ed5865a7630716277c8
4
+ data.tar.gz: d49f6b0b0b3ca4b578f52675ec828b788b5c5a31
5
5
  SHA512:
6
- metadata.gz: 02aedf57221835c910c8e77aaef76f95bbcdc1a1fa8d601ad54290a0edcaf07330e52e6b7d8294dd8b432208510615d4b3ee1693462624846ad5aa3a585b78d1
7
- data.tar.gz: 340740bbb8142d4cba620efb9ea593eade576c478848b24d0cff35c914fcd5846f14c27f89afc08e0b7e4a120d06286abbe340f5e95e7192125802492ca1f3a1
6
+ metadata.gz: c1a5b747f82d4f4713de044ede3d1c5d4f7583e3fb83d32934ca022b734d5dc6e299cd133d49d5f0b2d8ad3384e9388d689f734a3bc5f0b230c2a38d4c45a2ee
7
+ data.tar.gz: '05906647d2963462ce1803c4a9f725d065232396f2cb1962ec5658d248d7cb41028fc3ec67652a02e31279097b4eec2947c82e85d24db65d94701ab033c32ca4'
@@ -10,7 +10,12 @@ module Lita
10
10
  Lita.logger.debug "Querying for #{query}"
11
11
  result = get_result(query)
12
12
  Lita.logger.debug "Result: #{result}"
13
- reply = "DuckDuckGo Result: #{result['Abstract'][0..250]}"
13
+ reply = 'DuckDuckGo Result: '
14
+ if result['Abstract'].empty?
15
+ reply += result['AbstractURL']
16
+ else
17
+ reply += result['Abstract'][0..250]
18
+ end
14
19
  Lita.logger.debug "Reply: #{reply}"
15
20
  response.reply reply
16
21
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-duckduckgo'
3
- spec.version = '0.0.0'
3
+ spec.version = '0.0.1'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'Lita handler for Duck Duck Go\'s answers engine.'
File without changes
@@ -4,14 +4,21 @@ require 'spec_helper'
4
4
  describe Lita::Handlers::OnewheelDuckDuckGo, lita_handler: true do
5
5
 
6
6
  before(:each) do
7
- mock_result_json = File.open('spec/fixtures/mock_result.json').read
8
- allow(RestClient).to receive(:get).and_return(JSON.parse mock_result_json)
9
7
  end
10
8
 
11
9
  it { is_expected.to route_command('duck something') }
12
10
 
13
11
  it 'does neat ducky things' do
12
+ mock_result_json = File.open('spec/fixtures/mock_result.json').read
13
+ allow(RestClient).to receive(:get).and_return(JSON.parse mock_result_json)
14
+ send_command 'duck yo'
15
+ expect(replies.last).to include('DuckDuckGo Result: DuckDuckGo is an Internet search engine that emphasizes')
16
+ end
17
+
18
+ it 'uses the url unless the abstract exists' do
19
+ mock_result_json = File.open('spec/fixtures/mock_no_abstract.json').read
20
+ allow(RestClient).to receive(:get).and_return(JSON.parse mock_result_json)
14
21
  send_command 'duck yo'
15
- expect(replies.last).to include("DuckDuckGo Result: DuckDuckGo is an Internet search engine that emphasizes")
22
+ expect(replies.last).to include('DuckDuckGo Result: https://en.wikipedia.org/wiki/Duck_(disambiguation)')
16
23
  end
17
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-duckduckgo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
@@ -137,8 +137,8 @@ files:
137
137
  - lib/lita-onewheel-duckduckgo.rb
138
138
  - lib/lita/handlers/onewheel_duckduckgo.rb
139
139
  - lita-onewheel-duckduckgo.gemspec
140
+ - spec/fixtures/mock_no_abstract.json
140
141
  - spec/fixtures/mock_result.json
141
- - spec/fixtures/x.json
142
142
  - spec/lita/handlers/onewheel_duckduckgo_spec.rb
143
143
  - spec/spec_helper.rb
144
144
  homepage: https://github.com/onewheelskyward/lita-onewheel-duckduckgo
@@ -167,7 +167,7 @@ signing_key:
167
167
  specification_version: 4
168
168
  summary: Duck Duck Goose
169
169
  test_files:
170
+ - spec/fixtures/mock_no_abstract.json
170
171
  - spec/fixtures/mock_result.json
171
- - spec/fixtures/x.json
172
172
  - spec/lita/handlers/onewheel_duckduckgo_spec.rb
173
173
  - spec/spec_helper.rb