Sha256: 62a312aa993a1a622e757b0ec7122f6e32f4116ce1ba154640dd2d46d68bea57

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

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

    describe "POST 'create'" do
      it 'routes' do
        expect(post: '/verifications/1/confirmations').to route_to(
          action: 'create',
          controller: 'tasuku/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

4 entries across 4 versions & 1 rubygems

Version Path
tasuku-1.1.0 spec/controllers/tasuku/taskables/verifications/confirmations_controller_spec.rb
tasuku-1.0.1 spec/controllers/tasuku/taskables/verifications/confirmations_controller_spec.rb
tasuku-0.1.1 spec/controllers/tasuku/taskables/verifications/confirmations_controller_spec.rb
tasuku-0.1.0 spec/controllers/tasuku/taskables/verifications/confirmations_controller_spec.rb