Sha256: e99fd59dcda599d2300d9fe5a10cedc0a632c2ec29b8daf8fde9f9bef36597fe
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
require_relative '../spec_helper' require "rack/test" require 'restpack_web/test_support' include Rack::Test::Methods describe RestPack::Web do let(:app) { RestPack::Web::App.new( lambda { |env| [200, {'Content-Type' => 'text/plain'}, 'hello world'] }, { core_domain: ENV['RESTPACK_CORE_SERVICE'], password: ENV['RESTPACK_ACCESS_KEY'] }) } before do RestPack::Web::TestSupport.stub_restpack_web end it "returns a valid response" do get '/' last_response.ok?.must_equal true last_response.body.must_equal 'hello world' end describe '#add_user' do let(:users_path){ File.expand_path('./spec/fixtures/users.json') } before do stub_request(:get, 'http://auth.restpack-sample.org/api/v1/users/1.json'). to_return(:body => File.read(users_path)) end it 'inject an user into env' do get '/', {}, 'rack.session' => { :user_id => 1 } last_request.env[:restpack][:user_id].must_equal 1 last_request.env[:restpack][:user]['email'].must_equal 'lukasz.krystkowiak@gmail.com' last_request.env[:restpack][:user]['nickname'].must_equal 'lukkry' end end end
Version data entries
5 entries across 5 versions & 1 rubygems