Skip to content

Commit

Permalink
[MNOE-406] Updated test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
MAhsenArif committed Feb 16, 2018
1 parent 3dfe08e commit 2acf831
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ def partial_hash_for_arrears(arrear)
let(:org_invite) { build(:org_invite, organization: organization) }
let(:app_instance) { build(:app_instance, organization: organization) }
let(:credit_card) { build(:credit_card, organization: organization) }
let(:app) { build(:app)}

before do
organizations = [organization]
allow(organizations).to receive(:loaded?).and_return(true)
allow_any_instance_of(MnoEnterprise::User).to receive(:organizations).and_return(organizations)
allow_any_instance_of(MnoEnterprise::AppInstance).to receive(:app).and_return(app)
api_stub_for(get: "/organizations/#{organization.id}/invoices", response: from_api([invoice]))
api_stub_for(get: "/organizations", response: from_api([organization]))
api_stub_for(get: "/organizations/#{organization.id}", response: from_api(organization))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ module MnoEnterprise
before { api_stub_for(get: "/users/#{user.id}", response: from_api(user)) }
# Stub organization + associations
let(:organization) { build(:organization) }
let(:app) { build(:app)}
before { allow_any_instance_of(MnoEnterprise::User).to receive(:organizations).and_return([organization]) }

before { allow_any_instance_of(MnoEnterprise::AppInstance).to receive(:without_tenant).and_return(true) }
before { allow_any_instance_of(MnoEnterprise::AppInstance).to receive(:app).and_return(app) }

describe 'GET #index' do
let(:app_instance) { build(:app_instance, status: "running") }
let(:app_instance) { build(:app_instance, under_free_trial: false) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module MnoEnterprise
let(:credit_card) { build(:credit_card) }
let(:organization) { build(:organization) }
before do
allow_any_instance_of(MnoEnterprise::AppInstance).to receive(:app).and_return(app)
api_stub_for(get: "/users/#{user.id}", response: from_api(user))
api_stub_for(get: "/users/#{user.id}/organizations", response: from_api([organization]))
api_stub_for(get: "/organizations/#{organization.id}/app_instances", response: from_api([app_instance]))
Expand Down

0 comments on commit 2acf831

Please sign in to comment.