Sha256: 26b0535940520f16fdc858bc8d666fae9fd58166773036dcc44c0d34f570ef2d
Contents?: true
Size: 858 Bytes
Versions: 4
Compression:
Stored size: 858 Bytes
Contents
require 'spec_helper' describe Maily::EmailsController, type: :controller do routes { Maily::Engine.routes } before(:each) do Maily.init! end it 'responds ok if enabled' do expect { get :index }.not_to raise_error end it 'raise error if disabled' do Maily.enabled = false get :index expect(response.status).to eq(404) end it 'responds with 401 if http authorization fails' do Maily.http_authorization = { username: 'admin', password: 'admin' } get :index expect(response.status).to eq(401) end it 'responds ok with valid http authorization' do Maily.http_authorization = { username: 'admin', password: 'admin' } request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials('admin', 'admin') get :index expect(response.status).to eq(200) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
maily-0.6.3 | spec/controllers_spec.rb |
maily-0.6.2 | spec/controllers_spec.rb |
maily-0.6.1 | spec/controllers_spec.rb |
maily-0.6.0 | spec/controllers_spec.rb |