lita-tweet 0.4.1 → 0.4.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
- SHA1:
3
- metadata.gz: d0ee908dae8c2ab0b54d26f2a7657454a1335945
4
- data.tar.gz: e12bb161c880dd29968e175002542aeb3b310988
2
+ SHA256:
3
+ metadata.gz: 0a8381085cef7ac265ebdbee6861d7b06a116842a4043f4fcb9ab883ff842584
4
+ data.tar.gz: c2973b1a8602a946538116211895fe6860c967c022dbea8507c8bc76dc76323f
5
5
  SHA512:
6
- metadata.gz: 6e5d32eb644b7e26223cefa39cfc4baa891f2abd26fb02cd05cb9bb4572c8588c8bf6b03c955dc640aa52b2130e51ed417b639f5b0b950a1bc4c262c75846efc
7
- data.tar.gz: 7d38e45c18ddd345532f3a591a68b6a4b5e8f9db67cbb6772b7ef2842d66b2e10c12a82e001e3556b0540cf92afa25e91c54efeeb803b20eb18f2c92ad7000cf
6
+ metadata.gz: 4cb282492f1fd3d3d4ccc50ce58e207f17714909281e8d9102f4e270d3e7d7e44367a8f0dbb3206832fd348781637cc91c504bd5dad65bc2e7a0efcf6f5cdc03
7
+ data.tar.gz: b3fd7b1ce959e4b996e8569e81db3c6588b03f77550b2a02168505b6fadc07a5f8dd5ad1f383033b02fd458cdefd8394357535dafdd6329222f856a2ed7b826e
@@ -7,11 +7,11 @@ module Lita
7
7
  config :consumer_secret, type: String
8
8
  config :http_url
9
9
 
10
- route %r{^tweet\s(.+)}, :tweet, command: true, restrict_to: :tweeters,
10
+ route %r{\Atweet\s(.+)}m, :tweet, command: true, restrict_to: :tweeters,
11
11
  help: {"tweet MESSAGE" => "Post a tweet."}
12
- route %r{^untweet}, :untweet, command: true, restrict_to: :tweeters,
12
+ route %r{\Auntweet}, :untweet, command: true, restrict_to: :tweeters,
13
13
  help: {"untweet" => "Delete the last tweet."}
14
- route %r{^twitter accounts}, :accounts, command: true,
14
+ route %r{\Atwitter accounts}, :accounts, command: true,
15
15
  restrict_to: :tweeters, help: {
16
16
  "twitter accounts" => "List accounts that can be tweeted from.",
17
17
  "twitter accounts add" => "Authorize a new account for tweeting.",
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-tweet"
3
- spec.version = "0.4.1"
3
+ spec.version = "0.4.2"
4
4
  spec.authors = ["Andre Arko"]
5
5
  spec.email = ["andre@arko.net"]
6
6
  spec.description = "Tweeting for Lita"
@@ -30,6 +30,20 @@ describe Lita::Handlers::Tweet, lita_handler: true do
30
30
  Lita::Authorization.new(registry.config).add_user_to_group!(source.user, :tweeters)
31
31
  end
32
32
 
33
+ def expect_tweet(body)
34
+ stub_request(:post, "https://api.twitter.com/1.1/statuses/update.json").
35
+ with(body: {status: body}).to_return(status: 200, body: %q[{
36
+ "created_at": "Sun Aug 14 01:53:54 +0000 2016",
37
+ "id": 12345,
38
+ "text": "some text",
39
+ "user": {
40
+ "id": 123,
41
+ "screen_name": "handle",
42
+ "created_at": "Wed Nov 04 17:18:22 +0000 2009"
43
+ }
44
+ }])
45
+ end
46
+
33
47
  describe "#tweet" do
34
48
  context "without an authorized account" do
35
49
  it "should complain" do
@@ -44,19 +58,15 @@ describe Lita::Handlers::Tweet, lita_handler: true do
44
58
  end
45
59
 
46
60
  it "should send a tweet" do
47
- stub_request(:post, "https://api.twitter.com/1.1/statuses/update.json").
48
- with(body: {status: "some text"}).to_return(status: 200, body: %q[{
49
- "created_at": "Sun Aug 14 01:53:54 +0000 2016",
50
- "id": 12345,
51
- "text": "some text",
52
- "user": {
53
- "id": 123,
54
- "screen_name": "handle",
55
- "created_at": "Wed Nov 04 17:18:22 +0000 2009"
56
- }
57
- }])
61
+ expect_tweet("some text")
58
62
  send_command("tweet some text")
59
- expect(replies).to include("https://twitter.com/handle/status/12345")
63
+ expect(replies).to include("Tweet posted!")
64
+ end
65
+
66
+ it "should capture newlines" do
67
+ expect_tweet("para one\n\npara two")
68
+ send_command("tweet para one\n\npara two")
69
+ expect(replies).to include("Tweet posted!")
60
70
  end
61
71
  end
62
72
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-tweet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andre Arko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-20 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.5.1
121
+ rubygems_version: 2.7.6
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Allows the Lita chat bot to tweet on command