Sha256: e020549d2e3b53d8af6c6d5331073857d23922446b30d8ff3ae63835e229a4dc

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

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

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

      context 'with a response' do
        let(:user)          { create :user }
        let(:image_request) { create :image_request }
        let(:params)        { { request_id: image_request.id, taskables_image_response: { image: fixture_file_upload('doge.jpg', 'image/jpg') } } }

        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(image_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/image/responses_controller_spec.rb