Created
September 6, 2017 16:58
-
-
Save lucywyman/fe61303a6ed546dc10851e925b97fe90 to your computer and use it in GitHub Desktop.
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
require 'sinatra' | |
require 'octokit' | |
require 'git' | |
require 'json' | |
require 'fileutils' | |
require 'sinatra/base' | |
require_relative 'helpers/helpers.rb' | |
class Kukla < Sinatra::Base | |
helpers Sinatra::Kukla::Helpers | |
get '/' do | |
erb :index | |
end | |
post '/' do | |
# Stuff | |
end | |
run! | |
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
require 'rubygems' | |
require 'bundler' | |
require './app.rb' | |
Bundler.require | |
run Kukla |
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
module Sinatra | |
module Kukla | |
module Helpers | |
# Some functions here | |
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
require_relative '../../app.rb' | |
require 'spec_helper' | |
describe Kukla do | |
include Rack::Test::Methods | |
def app | |
Kukla | |
end | |
it 'displays the home page' do | |
get '/' | |
expect(last_response.status).to eq 200 | |
end | |
it 'accepts POST with JSON' do | |
contents = File.read('webhook_data.json') | |
json = JSON.parse(contents) | |
post '/', json, {'CONTENT_TYPE' => 'application/json'} | |
expect(last_response.status).to eq 200 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment