Sha256: 77a9a17cc70431a8cae155f6433567eadda855c9e66694b132190b95961bd725

Contents?: true

Size: 635 Bytes

Versions: 5

Compression:

Stored size: 635 Bytes

Contents

require 'rails_helper'

module Mks
  module Rate
    RSpec.describe UnitOfChargesController, type: :controller do
      routes { Mks::Rate::Engine.routes }

      before(:each) do
        u = create(:user)
        token = Mks::Auth::TokenAuth.issue(name: u.full_name, email: u.email, id: u.id)
        request.headers['Authorization'] = "Bearer #{token}"
      end

      describe 'GET #index' do
        it 'returns all unit of charges' do
          3.times { create(:unit_of_charge) }
          get :index
          result = JSON(response.body)
          expect(result['data'].count).to eq(3)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mks_rate-1.0.5 spec/controllers/mks/rate/unit_of_charges_controller_spec.rb
mks_rate-1.0.4 spec/controllers/mks/rate/unit_of_charges_controller_spec.rb
mks_rate-1.0.3 spec/controllers/mks/rate/unit_of_charges_controller_spec.rb
mks_rate-1.0.2 spec/controllers/mks/rate/unit_of_charges_controller_spec.rb
mks_rate-1.0.1 spec/controllers/mks/rate/unit_of_charges_controller_spec.rb