Sha256: 1ba35042fafa4fc370d3f7b4a9b3c6e922221a84a78e496ec609c7dea377bee3

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

require 'rails_helper'

RSpec.describe Chaltron::SessionsController, type: :controller do
  context 'devise' do
    before { @request.env['devise.mapping'] = Devise.mappings[:user] }
    let(:user) { create :user }

    context 'login' do
      it 'generates log message' do
        expect do
          post :create, user: { username: user.username, password: user.password }
        end.to change(Log, :count).by(1)
      end
    end

    context 'logout' do
      before do
        sign_in user
      end

      it 'generates log message' do
        expect { delete :destroy }.to change(Log, :count).by(1)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chaltron-0.1.0 spec/controllers/chaltron/sessions_controller_spec.rb