[rspec-users] [Sinatra] "tried to create Proc object without a block"

Ernst Arnold lists at ruby-forum.com
Fri Dec 3 19:55:13 EST 2010


I adapted the first lines of service_spec.rb according to Jason's code:

require File.dirname(__FILE__) + '/../service'
require 'rspec'                               # was 'spec' (Jason)
#require 'spec/interop/test'                  # no idea what this was
require 'rack/test'
require 'test/unit'                           # gem install test-unit
require 'sinatra'
require 'json'

set :environment, :test
Test::Unit::TestCase.send :include, Rack::Test::Methods

RSpec.configure do |conf|                    #from Jason
  conf.include Rack::Test::Methods
end

Also needed to replace
JSON.parse(last_response.body)
with
JSON.parse(last_response.body)["user"]

At last
rspec  spec/service_spec.rb
passes

ruby service.rb -p 3000
seems to work but
telnet locahost 3000 never connects

Thank you for sharing your code.

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list