Sha256: 8947121783167e1566a8aebaa2ee9752f32d38278c954e23b0799ff6664855b9
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require "spec_helper" RSpec.describe Ribose::Session do describe ".create" do it "creates a new user session" do username = "super.user" password = "supper.secreet.password" stub_post_signin_request session = Ribose::Session.create(username: username, password: password) expect(session.uid).to eq(session_headers["uid"]) expect(session.client).to eq(session_headers["client"]) expect(session["access-token"]).to eq(session_headers["access-token"]) end end def session_headers @session_headers ||= { "uid" => "user@example.com", "expiry" => Time.now, "client" => "sample-user-client", "access-token" => "super.secret.access.token", } end def stub_post_signin_request stub_request(:post, login_url).and_return( body: ribose_fixture("empty"), headers: session_headers, ) end def login_url [api_host, "api/v2/auth/sign_in"].join("/") end def api_host "https://#{Ribose.configuration.api_host}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ribose-0.5.0 | spec/ribose/session_spec.rb |