Skip to content

Commit

Permalink
Add rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
sosedoff committed Oct 31, 2013
1 parent a23edf2 commit ef23617
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format=documentation
2 changes: 1 addition & 1 deletion lib/slack-notify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(subdomain, token, options={})

def test
send_payload(
text: "This is a test message!"
text: "This is a test message!",
channel: @channel,
username: @username
)
Expand Down
15 changes: 15 additions & 0 deletions spec/slack-notify/client_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require "spec_helper"

describe SlackNotify::Client do
describe "#initialize" do
it "requires subdomain" do
expect { described_class.new(nil, nil) }.
to raise_error ArgumentError, "Subdomain required"
end

it "requires token" do
expect { described_class.new("foobar", nil) }.
to raise_error ArgumentError, "Token required"
end
end
end
17 changes: 17 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require "simplecov"
SimpleCov.start

$:.unshift File.expand_path("../..", __FILE__)

require "webmock"
require "webmock/rspec"
require "slack-notify"

def fixture_path(filename=nil)
path = File.expand_path("../fixtures", __FILE__)
filename.nil? ? path : File.join(path, filename)
end

def fixture(file)
File.read(File.join(fixture_path, file))
end

0 comments on commit ef23617

Please sign in to comment.