Last active
December 8, 2018 16:32
-
-
Save EtienneDepaulis/92633d46f2f9868f1331e63caa7aa27f to your computer and use it in GitHub Desktop.
CircleCi notifications article - basic Gemfile
This file contains hidden or 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
# spec/circleci-notifications_spec.rb | |
require 'spec_helper' | |
describe 'handler' do | |
let(:event_payload) { File.read("spec/events/#{filename}.json") } | |
let(:event) { {'body' => event_payload} } | |
let(:response) { handler(event: event, context: {}) } | |
let(:parsed_body) { JSON.parse(response[:body]) } | |
context 'failed' do | |
let(:filename) { 'sample_body_failed' } | |
it 'works' do | |
expect(parsed_body['message']).to eq "Failure detected" | |
end | |
end | |
context 'success' do | |
let(:filename) { 'sample_body_success' } | |
it 'works' do | |
expect(parsed_body['message']).to eq "No failure detected" | |
end | |
end | |
context 'success after failed' do | |
let(:filename) { 'sample_body_success_after_failed' } | |
it 'works' do | |
expect(parsed_body['message']).to eq "No failure detected" | |
end | |
end | |
end |
This file contains hidden or 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
source 'https://rubygems.org' | |
gem 'rspec' | |
gem 'webmock' | |
gem 'awesome_print' |
This file contains hidden or 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
# spec/spec_helper.rb | |
require_relative '../circleci-notifications' | |
require 'rspec' | |
require 'webmock/rspec' | |
require 'awesome_print' | |
RSpec.configure do |config| | |
config.order = :random | |
WebMock.disable_net_connect! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment