Sha256: e74405f7a44cf3c0b0e502be88164f28d737915eb5a3a0f453539ef5b8c81162
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
Contents
Bundler.setup require 'exemplor' require 'rr' require 'rack/test' $:.unshift "#{File.dirname(__FILE__)}/lib" require "#{File.dirname(__FILE__)}/example" Sinatra::Application.set :environment, :production eg.helpers do include Rack::Test::Methods include RR::Adapters::RRMethods def app Sinatra::Application end end eg.setup do RR.reset @toadhopper = ::Toadhopper.new("") stub(::Toadhopper).new do |api_key| @api_key = api_key @toadhopper end stub(@toadhopper).post! do |*args| @error, @options, @header = *args end end eg "Posting" do post "/register", :name => "Billy", :password => "Bob" Check(@api_key).is("apikey") Check(@toadhopper.send(:filters)).is([/password/]) Check(@error.class).is(RuntimeError) Check(@error.message).is("Kaboom!") Check(@options[:environment]).is(ENV.to_hash) Check(@options[:url]).is("http://example.org/register") Check(@options[:params]).is({"name"=>"Billy", "password"=>"Bob"}) Check(@options[:framework_env]).is("production") Check(@options[:project_root]).is(app.root) Check(@options[:session]).is({:user_id => 42}) Check(@options[:notifier_name]).is("toadhopper-sinatra") Check(@header['X-Hoptoad-Client-Name']).is("toadhopper-sinatra") end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
toadhopper-sinatra-2.1 | test_example.rb |
toadhopper-sinatra-2.0 | test_example.rb |
toadhopper-sinatra-1.0.5 | test_example.rb |
toadhopper-sinatra-1.0.4 | test_example.rb |