lita-onewheel-duckduckgo 0.0.1 → 0.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: 631c3e55555937e7cf6b0ed5865a7630716277c8
4
- data.tar.gz: d49f6b0b0b3ca4b578f52675ec828b788b5c5a31
3
+ metadata.gz: d8a06a1cd22705cbc9d94d21eef284bff472ca25
4
+ data.tar.gz: 2011ae1201bfb165f9b8b571495cce9787998833
5
5
  SHA512:
6
- metadata.gz: c1a5b747f82d4f4713de044ede3d1c5d4f7583e3fb83d32934ca022b734d5dc6e299cd133d49d5f0b2d8ad3384e9388d689f734a3bc5f0b230c2a38d4c45a2ee
7
- data.tar.gz: '05906647d2963462ce1803c4a9f725d065232396f2cb1962ec5658d248d7cb41028fc3ec67652a02e31279097b4eec2947c82e85d24db65d94701ab033c32ca4'
6
+ metadata.gz: 0e2b122d6fb0549029b8f3fd68967730cf3a7fee5e322873c95a96f606499b129c462a61166a8eefc3a04f6f9de03bba5d269bfb8706b8948b0ee30b10eb62bc
7
+ data.tar.gz: 8ea1a94f499e367ebefd0df7aa012f2a1423844505b091cc5ab59e7e20b87eff09f368cb8c07dbd06a9ada62ce26737b68aad74d623a800f76634a4338169ec4
@@ -21,7 +21,7 @@ module Lita
21
21
  end
22
22
 
23
23
  def get_result(query)
24
- result = RestClient.get("http://api.duckduckgo.com/?q=#{query}&format=json")
24
+ JSON.parse(RestClient.get("http://api.duckduckgo.com/?q=#{query}&format=json"))
25
25
  end
26
26
 
27
27
  Lita.register_handler(self)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-duckduckgo'
3
- spec.version = '0.0.1'
3
+ spec.version = '0.0.2'
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.'
@@ -6,19 +6,28 @@ describe Lita::Handlers::OnewheelDuckDuckGo, lita_handler: true do
6
6
  before(:each) do
7
7
  end
8
8
 
9
+ def mock(file)
10
+ mock_result_json = File.open("spec/fixtures/#{file}.json").read
11
+ allow(RestClient).to receive(:get).and_return( mock_result_json)
12
+ end
13
+
9
14
  it { is_expected.to route_command('duck something') }
10
15
 
11
16
  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)
17
+ mock('mock_result')
14
18
  send_command 'duck yo'
15
19
  expect(replies.last).to include('DuckDuckGo Result: DuckDuckGo is an Internet search engine that emphasizes')
16
20
  end
17
21
 
18
22
  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)
23
+ mock('mock_no_abstract')
21
24
  send_command 'duck yo'
22
25
  expect(replies.last).to include('DuckDuckGo Result: https://en.wikipedia.org/wiki/Duck_(disambiguation)')
23
26
  end
27
+
28
+ it 'checks for go' do
29
+ mock('mock_go')
30
+ send_command 'duck go'
31
+ expect(replies.last).to include('DuckDuckGo Result: https://en.wikipedia.org/wiki/Go')
32
+ end
24
33
  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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps