boty 0.0.16 → 0.0.17
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 +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/boty/cli.rb +0 -2
- data/lib/boty/rspec.rb +22 -14
- data/lib/boty/version.rb +1 -1
- data/template/project/.rspec +1 -0
- data/template/project/Gemfile +1 -0
- data/template/project/spec/script/ping_spec.rb +1 -1
- data/template/project/spec/spec_helper.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d60d83658211dd0b17fdfeb269033ce2c73ee291
|
4
|
+
data.tar.gz: 29148f8ba9a8d4dfa83d36f612c2a97959f5e5ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e583ec20c26d42226cf1e52bedfebab6b184bbccca3a3ecab576fe305a0adb96ea1a6d56a1d19d0e115cb1e1c5682c81ddb15b8505956b8a6e32f2a525269b9
|
7
|
+
data.tar.gz: cef240051671e266025c744489090c199c54177305da4dd0343b131076c270ad8278c1350be895e8d9b726c5af8224658cac95fc774fc3e8deb49f63cbfd0d91
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
boty (0.0.
|
4
|
+
boty (0.0.17)
|
5
5
|
eventmachine
|
6
6
|
faraday
|
7
7
|
faye-websocket
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
fakefs (0.6.7)
|
19
19
|
faraday (0.9.2)
|
20
20
|
multipart-post (>= 1.2, < 3)
|
21
|
-
faye-websocket (0.10.
|
21
|
+
faye-websocket (0.10.2)
|
22
22
|
eventmachine (>= 0.12.0)
|
23
23
|
websocket-driver (>= 0.5.1)
|
24
24
|
i18n (0.7.0)
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Boty
|
2
|
-
|
2
|
+
[<img src="https://travis-ci.org/ricardovaleriano/boty.svg?branch=master" />](https://travis-ci.org/ricardovaleriano/boty)
|
3
3
|
|
4
4
|
`Boty` is a utilitary to create bots (at this time, specificaly Slack bots).
|
5
5
|
|
data/lib/boty/cli.rb
CHANGED
data/lib/boty/rspec.rb
CHANGED
@@ -1,40 +1,48 @@
|
|
1
1
|
module Boty
|
2
2
|
module RSpec
|
3
3
|
module Bot
|
4
|
+
require File.expand_path "../../../spec/support/slack_support", __FILE__
|
5
|
+
|
4
6
|
def self.included(base)
|
5
7
|
base.instance_eval do
|
6
|
-
|
7
|
-
bot = Boty::Bot.new({"id" => "1234", "name" => "bot"},
|
8
|
-
Boty::Session.new)
|
8
|
+
include SlackSupport::Users
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
before do
|
11
|
+
@_bot = Boty::Bot.new(
|
12
|
+
{"id" => "1234", "name" => "bot"},
|
13
|
+
Boty::Session.new
|
14
|
+
)
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
class << Boty::Slack.chat
|
17
|
+
attr_accessor :messages
|
18
|
+
|
19
|
+
def post_message(message, options)
|
20
|
+
@messages ||= []
|
21
|
+
@messages << { message: message, options: options }
|
15
22
|
end
|
16
23
|
end
|
24
|
+
end
|
17
25
|
|
18
|
-
|
26
|
+
let(:bot) {
|
27
|
+
Boty::ScriptDSL.new @_bot
|
19
28
|
}
|
20
29
|
end
|
21
30
|
end
|
22
31
|
|
23
32
|
def event(options)
|
24
|
-
|
33
|
+
@_bot.event({ "type" => "message" }.merge options)
|
25
34
|
end
|
26
35
|
|
27
|
-
def
|
36
|
+
def message(text)
|
28
37
|
event "text" => text
|
29
38
|
end
|
30
39
|
end
|
31
40
|
|
32
41
|
::RSpec::Matchers.define :have_responded do |expected|
|
33
42
|
# TODO: add proper messages for failures.
|
34
|
-
match do |
|
35
|
-
|
36
|
-
|
37
|
-
response == expected
|
43
|
+
match do |dsl|
|
44
|
+
last_message = Slack.chat.messages.last
|
45
|
+
expected == last_message[:message]
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
data/lib/boty/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
--require=spec_helper
|
data/template/project/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "bundler"; Bundler.
|
1
|
+
require "bundler"; Bundler.require :default, :test
|
2
2
|
require "boty"
|
3
3
|
require "boty/rspec"
|
4
4
|
|
@@ -6,4 +6,6 @@ Dir["./spec/support/**/*.rb"].each { |f| require f }
|
|
6
6
|
|
7
7
|
RSpec.configure do |config|
|
8
8
|
config.include Boty::RSpec::Bot, bot: true
|
9
|
+
|
10
|
+
Boty::Logger.adapter = Boty::Logger::Null.new
|
9
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Valeriano
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -204,6 +204,7 @@ files:
|
|
204
204
|
- script/remember.rb
|
205
205
|
- template/project/%bot_name%.rb
|
206
206
|
- template/project/.env.local.tt
|
207
|
+
- template/project/.rspec
|
207
208
|
- template/project/Gemfile
|
208
209
|
- template/project/Procfile.tt
|
209
210
|
- template/project/README.md
|