Sha256: dcf125ed2e9450032e0189945bbd867e5a45c071b22d860878cf60345c21a13c

Contents?: true

Size: 1.16 KB

Versions: 30

Compression:

Stored size: 1.16 KB

Contents

require 'rails_helper'

module MnoEnterprise
  describe InvoicesController, type: :controller do
    render_views
    routes { MnoEnterprise::Engine.routes }

    # Stub controller ability
    let!(:ability) { stub_ability }
    before { allow(ability).to receive(:can?).with(any_args).and_return(true) }

    # Stub model calls
    let(:user) { build(:user) }
    let(:organization) { build(:organization) }
    let(:invoice) { build(:invoice, organization_id: organization.id) }
    before { api_stub_for(get: "/users/#{user.id}", response: from_api(user)) }
    before { api_stub_for(get: "/organizations/#{organization.id}", response: from_api(organization)) }
    before { api_stub_for(get: "/users/#{user.id}/organizations/#{organization.id}", response: from_api(organization)) }
    before { api_stub_for(get: "/invoices", params: { filter: { slug: '**' } }, response: from_api([invoice])) }


    describe "GET #show" do
      before { sign_in user }
      subject { get :show, id: invoice.slug }

      it_behaves_like "a navigatable protected user action"
      it_behaves_like "a user protected resource"

      it { subject; expect(response).to be_success }
    end

  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mno-enterprise-frontend-3.4.0 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.3.3 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.3.2 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.2.1 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.3.1 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.3.0 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.2.0 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.1.4 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.0.7 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-2.0.9 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.1.3 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.0.6 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-2.0.8 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.1.2 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.0.5 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-2.0.7 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-2.0.6 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-2.0.5 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.1.1 spec/controllers/mno_enterprise/invoices_controller_spec.rb
mno-enterprise-frontend-3.0.4 spec/controllers/mno_enterprise/invoices_controller_spec.rb