Sha256: 61f42ea501f1f0c9d90994b1586d51a9119da1a080aa568693dc36eb3addbb86

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

require 'spec_helper'

RSpec.describe QuickbooksWebConnector::QwcController, type: :controller do

  routes { QuickbooksWebConnector::Engine.routes }

  describe 'GET :download' do
    it 'renders the QWC file' do
      QuickbooksWebConnector.config.user 'jane', 'password', '/path/to/company.qbw'

      get :download, username: 'jane', format: :xml

      expect(response).to be_success
      expect(response.header['Content-Type']).to match(/application\/xml/)
      expect(response.header['Content-Disposition']).to match(/attachment/)
      expect(response.header['Content-Disposition']).to match(/jane\.qwc/)
      expect(response).to render_template(:qwc)
      expect(assigns(:user).username).to eq('jane')
    end

    it 'returns a 404 when no user matches the given username' do
      get :download, username: 'jane', format: :xml

      expect(response.code).to eq('404')
      expect(response).to_not render_template(:qwc)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quickbooks_web_connector-0.6.3 spec/controllers/quickbooks_web_connector/qwc_controller_spec.rb