Sha256: 5278fd263a525f563c10a16274f62a927983e96b7cc33b3857b4090bd885a955
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' module Tasuku describe Taskables::Code::ResponsesController do routes { Tasuku::Engine.routes } describe "POST 'create'" do it 'routes' do expect(post: '/code/requests/1/responses').to route_to( action: 'create', controller: 'tasuku/taskables/code/responses', request_id: '1' ) end context 'with a response' do let(:user) { create :user } let(:code_request) { create :code_request, code: '1337' } let(:params) { { request_id: code_request.id, taskables_code_response: { code: '1337' } } } 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(code_request.responses.count).to eq 1 expect(code_request.responses.first.code).to eq '1337' end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tasuku-1.1.0 | spec/controllers/tasuku/taskables/code/responses_controller_spec.rb |
tasuku-1.0.1 | spec/controllers/tasuku/taskables/code/responses_controller_spec.rb |