Created
February 21, 2014 16:13
-
-
Save oddlyfunctional/9137168 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe Api::V1::SessionsController do | |
let(:password) { '12345678' } | |
let(:student) { create(:student, password: password) } | |
describe "POST /api/v1/students/sign_in" do | |
before(:each) do | |
post "/api/v1/students/sign_in", { student: { email: student.email, password: password } } | |
end | |
it { expect(response).to be_successful } | |
it { expect(json["authentication_token"]).to eq(student.authentication_token) } | |
it { expect(controller.current_student).to eq(student) } | |
it "should allow access with authentication_token after the sign in" do | |
get "/api/v1/organizations/#{student.organization.uuid}/events.json", | |
{ student_email: student.email, student_token: student.authentication_token } | |
expect(controller.current_student).to eq(student) | |
end | |
end | |
en |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment