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/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to