Sha256: 9a29a79ce09760ef5c49d380dbc2a753bb7996d38dc1d34a955d078142592d3a

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

module Tasks
  describe Taskables::Verifications::ConfirmationsController do
    routes { Tasks::Engine.routes }

    describe "POST 'create'" do
      it 'routes' do
        expect(post: '/verifications/1/confirmations').to route_to(
          action: 'create',
          controller: 'tasks/taskables/verifications/confirmations',
          verification_id: '1'
        )
      end

      context 'with a confirmation' do
        let(:user)         { create :user }
        let(:verification) { create :verification }
        let(:params)       { { verification_id: verification.id } }

        before { request.env['HTTP_REFERER'] = 'http://example.org' }
        before { expect(subject).to receive(:current_user).and_return(user) }

        it_behaves_like 'redirectable' do
          let(:action) { :create }
          let(:verb)   { :post }
        end

        it 'creates a new confirmation' do
          post :create, params

          expect(verification.confirmations.count).to eq 1
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tasuku-0.0.1 spec/controllers/tasks/taskables/verifications/confirmations_controller_spec.rb