Sha256: 028d38d3c3fb81bc9c21693f8032c5882ea4ce28a3d1af162f9e4093a928b6b1

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

module Tasks
  describe Taskables::Text::ResponsesController do
    routes { Tasks::Engine.routes }

    describe "POST 'create'" do
      it 'routes' do
        expect(post: '/text/requests/1/responses').to route_to(
          action: 'create',
          controller: 'tasks/taskables/text/responses',
          request_id: '1'
        )
      end

      context 'with a response' do
        let(:user)          { create :user }
        let(:text_request) { create :text_request }
        let(:params)        { { request_id: text_request.id, taskables_text_response: { text: 'Yes hello this is dog?' } } }

        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 response' do
          post :create, params

          expect(text_request.responses.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/text/responses_controller_spec.rb