Skip to content
This repository was archived by the owner on May 28, 2024. It is now read-only.

Commit 226aae4

Browse files
committed
* add spec
1 parent 93665cd commit 226aae4

8 files changed

+54
-0
lines changed

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format documentation

lib/simple_slack_bot/config.rb

+10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ def reset
1616

1717
attr_accessor(*Config::ATTRIBUTES)
1818
end
19+
20+
class << self
21+
def configure
22+
block_given? ? yield(Config) : Config
23+
end
24+
25+
def config
26+
Config
27+
end
28+
end
1929
end
2030

2131
SlackBot::Config.reset()

simple-slack-bot.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ Gem::Specification.new do |s|
2020

2121
s.add_development_dependency 'bundler'
2222
s.add_development_dependency 'rake'
23+
s.add_development_dependency 'rspec'
2324
end

spec/client_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# TODO

spec/command_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# TODO

spec/config_spec.rb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'spec_helper'
2+
3+
describe SlackBot::Config do
4+
before do
5+
SlackBot.configure do |config|
6+
config.join_message = 'Hi!'
7+
config.debug = true
8+
config.token = 'TOKEN'
9+
end
10+
end
11+
12+
it 'sets config' do
13+
expect(SlackBot.config.join_message).to eq 'Hi!'
14+
expect(SlackBot.config.debug).to eq true
15+
expect(SlackBot.config.token).to eq 'TOKEN'
16+
end
17+
end

spec/spec_helper.rb

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require 'bundler/setup'
2+
Bundler.setup
3+
4+
require 'simple-slack-bot'
5+
6+
RSpec.configure do |config|
7+
end
8+
9+
SlackBot.configure do |config|
10+
config.join_message = 'Hello!'
11+
config.debug = true
12+
config.token = ENV['SLACK_API_TOKEN']
13+
end

spec/version_spec.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'spec_helper'
2+
3+
describe SlackBot do
4+
it 'has a version' do
5+
expect(SlackBot::VERSION).to_not be nil
6+
end
7+
end

0 commit comments

Comments
 (0)