boty 0.0.2 → 0.0.3

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: 748d4a310415b259aa1f4bc59de28841bf526146
4
- data.tar.gz: df5b63db2607e615c5ed70ed55f032de33abfefb
3
+ metadata.gz: 9bf71695e734493e496a84de1edc72ad4d1efdd8
4
+ data.tar.gz: 35449d7a8978b5c3543d3b3041e7c47c29cb737f
5
5
  SHA512:
6
- metadata.gz: 64b8378c295747a414308b0f360bad3606c74bad7648693947394fa91de4d5fc6155ab1b6075d69c40e0d366a03150eb8ddfa777f038de546540fe77747a530a
7
- data.tar.gz: 849a9ca497b019181b738a8a6138d8c57e08be2c3e498d6d3e01d68f55f12b5770c3c7549266e9701e5ab8eeed4ca225c2d291e19492b881556bb8e921c9ca72
6
+ metadata.gz: ffd4910d8a3de3f7f5d51e1d256ede4404d532074f9fb7ed780c4360e74a32747f1c0bbbad2ac50a6369d63e345e3bdfc0705ad677eed1dea733269f9e1dca05
7
+ data.tar.gz: 10f90b4d27edbc3a12d90018d584d479f09195d1b582bf6070126f8f52c5e0175d856d1ceedee09d4479bed73d3c9d41247c16349a1bcc846361ab2696411ce1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boty (0.0.2)
4
+ boty (0.0.3)
5
5
  eventmachine
6
6
  faye-websocket
7
7
  thor
data/lib/boty/rspec.rb ADDED
@@ -0,0 +1,38 @@
1
+ module Boty
2
+ module RSpec
3
+ module Bot
4
+ def self.included(base)
5
+ base.instance_eval do
6
+ let(:bot) {
7
+ bot = Boty::Bot.new(
8
+ {"id" => "1234", "name" => "bot"},
9
+ Boty::Session.new(ENV["SLACK_COMPANY"] || "acme")
10
+ )
11
+
12
+ class << bot
13
+ attr_accessor :_response
14
+
15
+ def say(message)
16
+ @_response = message
17
+ end
18
+ end
19
+
20
+ bot
21
+ }
22
+ end
23
+
24
+ def message_event(text)
25
+ bot.event "type" => "message", "text" => text
26
+ end
27
+ end
28
+ end
29
+
30
+ ::RSpec::Matchers.define :have_responded do |expected|
31
+ match do |bot|
32
+ response = bot._response
33
+ bot._response = nil
34
+ response == expected
35
+ end
36
+ end
37
+ end
38
+ end
data/lib/boty/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Boty
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -2,3 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  gem "boty"
4
4
  gem "dotenv"
5
+
6
+ group :test do
7
+ gem "rspec"
8
+ end
@@ -0,0 +1,4 @@
1
+ require "rspec/core/rake_task"
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ task default: :spec
@@ -0,0 +1,7 @@
1
+ RSpec.describe "bot", "/ping/i", :bot do
2
+ it "responds with pong" do
3
+ message_event "<@bot>: ping"
4
+
5
+ expect(bot).to have_responded("pong")
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require "bundler"; Bundler.setup :default, :test
2
+ require "boty"
3
+ require "boty/rspec"
4
+
5
+ Dir['./spec/support/**/*.rb'].each { |f| require f }
6
+
7
+ RSpec.configure do |config|
8
+ config.include Boty::RSpec::Bot, bot: true
9
+ 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.2
4
+ version: 0.0.3
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-11-17 00:00:00.000000000 Z
11
+ date: 2015-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -178,6 +178,7 @@ files:
178
178
  - lib/boty/cli.rb
179
179
  - lib/boty/dsl.rb
180
180
  - lib/boty/message.rb
181
+ - lib/boty/rspec.rb
181
182
  - lib/boty/session.rb
182
183
  - lib/boty/version.rb
183
184
  - lib/tasks/.keep
@@ -188,10 +189,13 @@ files:
188
189
  - template/project/Gemfile
189
190
  - template/project/Procfile.tt
190
191
  - template/project/README.md
192
+ - template/project/Rakefile
191
193
  - template/project/app/.empty
192
194
  - template/project/bot.tt
193
195
  - template/project/script/ping.rb
194
196
  - template/project/spec/.empty
197
+ - template/project/spec/script/ping_spec.rb
198
+ - template/project/spec/spec_helper.rb
195
199
  homepage: http://github.com/ricardovaleriano/boty
196
200
  licenses:
197
201
  - MIT