-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0cad58
commit b99d536
Showing
10 changed files
with
180 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
RSpec::Core::RakeTask.new(:spec, :tag) do |t, task_args| | ||
t.rspec_opts = "--tag #{task_args[:tag]}" if task_args[:tag] | ||
end | ||
|
||
task :default => :spec | ||
task :test => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
def fixture_path | ||
File.expand_path("../../fixtures", __FILE__) | ||
end | ||
|
||
def fixture(file) | ||
File.new(fixture_path + '/' + file) | ||
end | ||
|
||
def enable_http | ||
WebMock.allow_net_connect! | ||
end | ||
|
||
def disable_http | ||
WebMock.disable_net_connect!(:allow => 'coveralls.io') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module Sendgrid | ||
class Mock | ||
include WebMock::API | ||
|
||
def initialize(user, key) | ||
@user = user | ||
@key = key | ||
end | ||
|
||
def stub_post(path, params = {}) | ||
stub_request(:post, Sendgrid::API::REST::Resource::ENDPOINT + '/' + path). | ||
with(:body => params.merge(authentication_params)) | ||
end | ||
|
||
def a_post(path, params = {}) | ||
a_request(:post, Sendgrid::API::REST::Resource::ENDPOINT + '/' + path). | ||
with(:body => params.merge(authentication_params)) | ||
end | ||
|
||
private | ||
|
||
def authentication_params | ||
{ :api_key => @key, :api_user => @user } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
shared_examples 'online tests' do | ||
before do | ||
enable_http | ||
end | ||
after do | ||
disable_http | ||
end | ||
|
||
let(:env_user) { ENV['SENDGRID_USER'] } | ||
let(:env_key) { ENV['SENDGRID_KEY'] } | ||
end |