Sha256: e4b705e6887ffefa869d6cb97a4d4a8a5cae1e9353fcbf23bea99f590c4c81d9
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require 'rubygems' require 'sinatra/base' require 'json' require 'sinatra/activerecord' require 'rspectacles/config.rb' require 'rspectacles/app/models/example' require 'puma' module RSpectacles class App < Sinatra::Base require 'rspectacles/app/helpers' register Sinatra::ActiveRecordExtension set :database_file, 'config/database.yml' config = RSpectacles.config dir = File.dirname(File.expand_path(__FILE__)) set :app_file, __FILE__ set :root, dir set :views, "#{dir}/app/views" set :static, true if respond_to? :public_folder set :public_folder, "#{dir}/app/public" else set :public, "#{dir}/app/public" end # Routes get '/watch/:key' do erb :index end get '/watch' do params['key'] = config.last_run_primary_key erb :index end get '/examples/:key' do Example.where(rspec_run: params['key']).to_json end post '/examples' do payload = JSON.parse(request.body.read) data = payload['examples'].map do |args| { rspec_run: args['rspec_run'], properties: args } end { errors: Example.create(data).count { |i| !i.persisted? } }.to_json end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspectacles-0.3.1 | lib/rspectacles/app.rb |