Sha256: 4cc58104d9c7e6da70422352af675d9c6e7af64a2771525f3943fc886d7be54d
Contents?: true
Size: 1.48 KB
Versions: 41
Compression:
Stored size: 1.48 KB
Contents
# -*- coding: utf-8 -*- require 'spec_helper' describe SessionsController do describe 'ログインする (XHR POST create)' do let(:params) { { username: '1102', } } context 'RAILS_ENVがstandaloneの場合', set_standalone_rails_env: true do before do xhr :post, :create, params, {} end describe 'レスポンスボディ' do subject { response.body } it { should eq('1102') } end describe 'session' do subject { session } describe '[:username]' do subject { super()[:username] } it { should eq(params[:username]) } end end end context 'RAILS_ENVがstandaloneではない場合' do it do expect { xhr :post, :create, params, {} }.to raise_exception end end end describe 'ログアウトする (DELETE destroy)' do let(:_session) { { username: '1102', } } context 'RAILS_ENVがstandaloneの場合', set_standalone_rails_env: true do before do xhr :delete, :destroy, {}, _session end describe 'session' do subject { session } describe '[:username]' do subject { super()[:username] } it { should be_nil } end end end context 'RAILS_ENVがstandaloneではない場合' do it do expect { xhr :post, :create, params, {} }.to raise_exception end end end end
Version data entries
41 entries across 41 versions & 1 rubygems