mno-enterprise-api 3.0.7 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mno_enterprise/config.js.coffee.erb +2 -0
  3. data/app/controllers/mno_enterprise/impersonate_controller.rb +1 -2
  4. data/app/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller.rb +2 -2
  5. data/app/controllers/mno_enterprise/jpi/v1/admin/invites_controller.rb +50 -0
  6. data/app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb +13 -27
  7. data/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb +82 -1
  8. data/app/controllers/mno_enterprise/jpi/v1/admin/users_controller.rb +9 -1
  9. data/app/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller.rb +2 -2
  10. data/app/controllers/mno_enterprise/jpi/v1/marketplace_controller.rb +1 -1
  11. data/app/controllers/mno_enterprise/status_controller.rb +2 -4
  12. data/app/views/mno_enterprise/auth/confirmations/_form.html.haml +2 -2
  13. data/app/views/mno_enterprise/auth/registrations/_form.html.haml +1 -1
  14. data/app/views/mno_enterprise/auth/unlocks/new.html.haml +11 -11
  15. data/app/views/mno_enterprise/jpi/v1/admin/base_resource/_member.json.jbuilder +28 -0
  16. data/app/views/mno_enterprise/jpi/v1/admin/organizations/invite_member.json.jbuilder +3 -0
  17. data/app/views/mno_enterprise/jpi/v1/admin/organizations/show.json.jbuilder +2 -2
  18. data/app/views/mno_enterprise/jpi/v1/admin/users/_user.json.jbuilder +1 -1
  19. data/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder +2 -1
  20. data/app/views/mno_enterprise/jpi/v1/current_users/show.json.jbuilder +1 -0
  21. data/app/views/mno_enterprise/jpi/v1/impac/kpis/_kpi.json.jbuilder +1 -1
  22. data/app/views/mno_enterprise/jpi/v1/marketplace/_app.json.jbuilder +1 -1
  23. data/app/views/mno_enterprise/jpi/v1/organizations/_credit_card.json.jbuilder +2 -2
  24. data/config/initializers/health_check.rb +5 -3
  25. data/config/routes.rb +8 -1
  26. data/lib/mno_enterprise/concerns/controllers/jpi/v1/organizations_controller.rb +0 -1
  27. data/lib/mno_enterprise/concerns/mailers/system_notification_mailer.rb +19 -5
  28. data/spec/controllers/mno_enterprise/impersonate_controller_spec.rb +4 -14
  29. data/spec/controllers/mno_enterprise/jpi/v1/admin/invites_controller_spec.rb +63 -0
  30. data/spec/controllers/mno_enterprise/jpi/v1/admin/invoices_controller_spec.rb +4 -14
  31. data/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb +65 -0
  32. data/spec/controllers/mno_enterprise/jpi/v1/admin/users_controller_spec.rb +16 -16
  33. data/spec/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller_spec.rb +14 -22
  34. data/spec/controllers/mno_enterprise/jpi/v1/current_users_controller_spec.rb +4 -1
  35. data/spec/controllers/mno_enterprise/jpi/v1/impac/kpis_controller_spec.rb +2 -2
  36. data/spec/controllers/mno_enterprise/jpi/v1/marketplace_controller_spec.rb +43 -2
  37. data/spec/controllers/mno_enterprise/pages_controller_spec.rb +0 -4
  38. data/spec/controllers/mno_enterprise/status_controller_spec.rb +0 -4
  39. data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +1 -5
  40. data/spec/mailer/mno_enterprise/system_notification_mailer_spec.rb +23 -11
  41. data/spec/routing/mno_enterprise/jpi/v1/admin/invites_controller_routing_spec.rb +11 -0
  42. data/spec/routing/mno_enterprise/jpi/v1/admin/organizations_controller_routing_spec.rb +8 -0
  43. data/spec/routing/mno_enterprise/jpi/v1/admin/users_controller_routing_spec.rb +4 -0
  44. metadata +13 -8
  45. data/app/views/mno_enterprise/auth/unlocks/_form.html.haml +0 -10
  46. data/app/views/mno_enterprise/jpi/v1/admin/organizations/_member.json.jbuilder +0 -14
@@ -13,6 +13,7 @@ json.cache! ['v1', @user.cache_key] do
13
13
  json.website @user.website
14
14
  json.sso_session @user.sso_session
15
15
  json.admin_role @user.admin_role
16
+ json.avatar_url avatar_url(@user)
16
17
  if current_impersonator
17
18
  json.current_impersonator true
18
19
  end
@@ -1 +1 @@
1
- json.extract! kpi, :id, :element_watched, :endpoint, :source, :targets, :settings, :extra_params
1
+ json.extract! kpi, :id, :name, :element_watched, :endpoint, :source, :targets, :settings, :extra_params
@@ -1,5 +1,5 @@
1
1
  json.extract! app, :id, :nid, :name, :stack, :key_benefits, :categories, :tags, :tiny_description,
2
- :testimonials, :pictures, :pricing_plans
2
+ :testimonials, :pictures, :pricing_plans, :rank
3
3
 
4
4
  json.description markdown(app.sanitized_description)
5
5
 
@@ -2,6 +2,6 @@ json.credit_card do
2
2
  if credit_card
3
3
  json.extract! credit_card, :id, :title,:first_name,:last_name,:month,:year,:country,:billing_address,:billing_city,:billing_postcode, :billing_country
4
4
  json.number credit_card.masked_number
5
- json.verification_value credit_card.id ? 'CVV' : nil
5
+ json.verification_value 'CVV'
6
6
  end
7
- end
7
+ end
@@ -1,6 +1,7 @@
1
- HealthCheck::Engine.routes_explicitly_defined = true
1
+ HealthCheck::Engine.routes_manually_defined = true
2
2
 
3
3
  HealthCheck.setup do |config|
4
+
4
5
  # Text output upon success
5
6
  config.success = 'success'
6
7
 
@@ -20,14 +21,15 @@ HealthCheck.setup do |config|
20
21
  config.http_status_for_error_object = 500
21
22
 
22
23
  # You can customize which checks happen on a standard health check
23
- config.standard_checks = %w(site cache redis-if-present)
24
+ config.standard_checks = [ 'database', 'migrations', 'custom' ]
24
25
 
25
26
  # You can set what tests are run with the 'full' or 'all' parameter
26
- config.full_checks = %w(site cache custom redis-if-present sidekiq-redis-if-present)
27
+ config.full_checks = ['database', 'migrations', 'cache', 'custom']
27
28
 
28
29
  # Add one or more custom checks that return a blank string if ok, or an error message if there is an error
29
30
  config.add_custom_check do
30
31
  # any code that returns blank on success and non blank string upon failure
31
32
  MnoEnterprise::HealthCheck.perform_mno_hub_check
32
33
  end
34
+
33
35
  end
data/config/routes.rb CHANGED
@@ -127,13 +127,20 @@ MnoEnterprise::Engine.routes.draw do
127
127
  resources :users, only: [:index, :show, :destroy, :update, :create] do
128
128
  collection do
129
129
  get :count
130
+ post :signup_email
130
131
  end
131
132
  end
132
- resources :organizations, only: [:index, :show] do
133
+ resources :organizations, only: [:index, :show, :create] do
133
134
  collection do
134
135
  get :in_arrears
135
136
  get :count
136
137
  end
138
+ member do
139
+ post :users, action: :invite_member
140
+ end
141
+ resources :users, only: [] do
142
+ resource :invites, only: [:create]
143
+ end
137
144
  end
138
145
  resources :tenant_invoices, only: [:index, :show]
139
146
  resources :invoices, only: [:index, :show] do
@@ -176,5 +176,4 @@ module MnoEnterprise::Concerns::Controllers::Jpi::V1::OrganizationsController
176
176
  def organization_update_params
177
177
  params.fetch(:organization, {}).permit(*organization_permitted_update_params)
178
178
  end
179
-
180
179
  end
@@ -33,7 +33,7 @@ module MnoEnterprise::Concerns::Mailers::SystemNotificationMailer
33
33
  #
34
34
  def confirmation_instructions(record, token, opts={})
35
35
  template = record.confirmed? && record.unconfirmed_email? ? 'reconfirmation-instructions' : 'confirmation-instructions'
36
- MandrillClient.deliver(template,
36
+ MnoEnterprise::MailClient.deliver(template,
37
37
  default_sender,
38
38
  recipient(record),
39
39
  user_vars(record).merge(confirmation_link: user_confirmation_url(confirmation_token: token))
@@ -51,7 +51,7 @@ module MnoEnterprise::Concerns::Mailers::SystemNotificationMailer
51
51
  # :reset_password_link
52
52
  #
53
53
  def reset_password_instructions(record, token, opts={})
54
- MandrillClient.deliver('reset-password-instructions',
54
+ MnoEnterprise::MailClient.deliver('reset-password-instructions',
55
55
  default_sender,
56
56
  recipient(record),
57
57
  user_vars(record).merge(reset_password_link: edit_user_password_url(reset_password_token: token))
@@ -69,7 +69,7 @@ module MnoEnterprise::Concerns::Mailers::SystemNotificationMailer
69
69
  # :unlock_link
70
70
  #
71
71
  def unlock_instructions(record, token, opts={})
72
- MandrillClient.deliver('unlock-instructions',
72
+ MnoEnterprise::MailClient.deliver('unlock-instructions',
73
73
  default_sender,
74
74
  recipient(record),
75
75
  user_vars(record).merge(unlock_link: user_unlock_url(unlock_token: token))
@@ -101,7 +101,7 @@ module MnoEnterprise::Concerns::Mailers::SystemNotificationMailer
101
101
  confirmation_link = new_user ? user_confirmation_url(confirmation_token: org_invite.user.confirmation_token) : org_invite_url(org_invite, token: org_invite.token)
102
102
  email_template = new_user ? 'organization-invite-new-user' : 'organization-invite-existing-user'
103
103
 
104
- MandrillClient.deliver(email_template,
104
+ MnoEnterprise::MailClient.deliver(email_template,
105
105
  default_sender,
106
106
  recipient(org_invite.user,new_user),
107
107
  invite_vars(org_invite,new_user).merge(confirmation_link: confirmation_link)
@@ -118,13 +118,27 @@ module MnoEnterprise::Concerns::Mailers::SystemNotificationMailer
118
118
  # :full_name
119
119
  # :terminate_account_link
120
120
  def deletion_request_instructions(record, deletion_request)
121
- MandrillClient.deliver('deletion-request-instructions',
121
+ MnoEnterprise::MailClient.deliver('deletion-request-instructions',
122
122
  default_sender,
123
123
  recipient(record),
124
124
  user_vars(record).merge(terminate_account_link: deletion_request_url(deletion_request))
125
125
  )
126
126
  end
127
127
 
128
+ # Description:
129
+ # Email providing registration instructions
130
+ #
131
+ # Variables:
132
+ # :registration_link
133
+ def registration_instructions(email)
134
+ MnoEnterprise::MailClient.deliver(
135
+ 'registration-instructions',
136
+ default_sender,
137
+ {email: email},
138
+ {registration_link: new_user_registration_url}
139
+ )
140
+ end
141
+
128
142
  protected
129
143
 
130
144
  def recipient(record, new_user = false)
@@ -30,23 +30,13 @@ module MnoEnterprise
30
30
 
31
31
  describe "#destroy" do
32
32
  subject { get :destroy }
33
+ before { get :create, user_id: user2.id }
33
34
 
34
- context 'without redirect_path' do
35
- before { get :create, user_id: user2.id }
35
+ it { expect(controller.current_user.id).to eq(user2.id) }
36
36
 
37
- it { expect(controller.current_user.id).to eq(user2.id) }
38
-
39
- it { subject; expect(controller.current_user.id).to eq(user.id) }
40
-
41
- it { is_expected.to redirect_to('/admin/') }
42
- end
43
-
44
- context 'with a redirect_path' do
45
- before { get :create, user_id: user2.id, redirect_path: '/admin/redirect#path' }
46
-
47
- it { is_expected.to redirect_to('/admin/redirect#path') }
48
- end
37
+ it { subject; expect(controller.current_user.id).to eq(user.id) }
49
38
  end
50
39
  end
51
40
  end
41
+
52
42
  end
@@ -0,0 +1,63 @@
1
+ require 'rails_helper'
2
+
3
+ module MnoEnterprise
4
+ RSpec.describe Jpi::V1::Admin::InvitesController do
5
+ routes { MnoEnterprise::Engine.routes }
6
+ before { request.env['HTTP_ACCEPT'] = 'application/json' }
7
+
8
+ #===============================================
9
+ # Assignments
10
+ #===============================================
11
+ # Stub user and user call
12
+ let(:user) { build(:user, admin_role: 'admin') }
13
+ before do
14
+ api_stub_for(get: "/users/#{user.id}", response: from_api(user))
15
+ sign_in user
16
+ end
17
+
18
+ let(:organization) { FactoryGirl.build(:organization) }
19
+ let(:invitee) { FactoryGirl.build(:user) }
20
+ let(:invite) { FactoryGirl.build(:org_invite, user: invitee, organization: organization, status: 'staged') }
21
+
22
+ # Stub ActionMailer
23
+ let(:message_delivery) { instance_double(ActionMailer::MessageDelivery) }
24
+ before { allow(message_delivery).to receive(:deliver_later).with(no_args) }
25
+
26
+ # API stubs
27
+ before do
28
+ api_stub_for(get: "/organizations/#{organization.id}", response: from_api(organization))
29
+ api_stub_for(get: "/organizations/#{organization.id}/org_invites?filter[status.in][]=pending&filter[status.in][]=staged&filter[user_id]=#{invitee.id}", response: from_api([invite]))
30
+
31
+ allow(MnoEnterprise::User).to receive(:find) do |user_id|
32
+ case user_id.to_i
33
+ when user.id then user
34
+ when invitee.id then invitee
35
+ end
36
+ end
37
+
38
+ api_stub_for(put: "/org_invites/#{invite.id}", response: from_api(invite))
39
+ end
40
+
41
+ # unconfirmed
42
+ describe 'POST #create' do
43
+ subject { post :create, user_id: invitee.id, organization_id: organization.id }
44
+
45
+ context 'existing user' do
46
+ it 'sends the invitation email' do
47
+ expect(SystemNotificationMailer).to receive(:organization_invite).with(invite).and_return(message_delivery)
48
+ subject
49
+ expect(response).to be_success
50
+ end
51
+ end
52
+
53
+ context 'new user' do
54
+ before { invitee.confirmed_at = nil }
55
+
56
+ it 'sends the confirmation instructions' do
57
+ expect(invitee).to receive(:resend_confirmation_instructions)
58
+ subject
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -39,13 +39,16 @@ module MnoEnterprise
39
39
  # Stub invoice and invoice call
40
40
  let(:invoice) { build(:invoice) }
41
41
  let(:user) { build(:user, :admin) }
42
- let(:tenant) { build(:tenant, current_billing_amount: Money.new(11_000,'AUD')) }
42
+ let(:tenant) { build(:tenant) }
43
+ let(:org1) { build(:organization, current_billing: Money.new(10_000,'AUD')) }
44
+ let(:org2) { build(:organization, current_billing: Money.new(1000,'AUD')) }
43
45
 
44
46
  before do
45
47
  api_stub_for(get: "/invoices", response: from_api([invoice]))
46
48
  api_stub_for(get: "/invoices/#{invoice.id}", response: from_api(invoice))
47
49
  api_stub_for(get: "/users", response: from_api([user]))
48
50
  api_stub_for(get: "/users/#{user.id}", response: from_api(user))
51
+ api_stub_for(get: "/organizations", response: from_api([org1, org2]))
49
52
  api_stub_for(get: "/tenant", response: from_api(tenant))
50
53
  sign_in user
51
54
  end
@@ -82,19 +85,6 @@ module MnoEnterprise
82
85
  describe 'GET #current_billing_amount' do
83
86
  subject { get :current_billing_amount }
84
87
 
85
- context 'with an old MnoHub' do
86
- let(:tenant) { build(:old_tenant) }
87
-
88
- before { subject }
89
-
90
- it { expect(response).to be_success }
91
-
92
- it 'returns the sum of the current_billing' do
93
- expected = {'current_billing_amount' => {"amount"=>"N/A", "currency"=>""}}
94
- expect(response.body).to eq(expected.to_json)
95
- end
96
- end
97
-
98
88
  context 'success' do
99
89
  before { subject }
100
90
 
@@ -52,6 +52,7 @@ module MnoEnterprise
52
52
  api_stub_for(get: "/organizations/#{organization.id}/app_instances", response: from_api([app_instance]))
53
53
  api_stub_for(get: "/organizations/#{organization.id}/credit_card", response: from_api([credit_card]))
54
54
  api_stub_for(get: "/arrears_situations", response: from_api([arrears]))
55
+ api_stub_for(post: "/organizations", response: from_api([organization]))
55
56
  end
56
57
 
57
58
  let(:expected_hash_for_organizations) {
@@ -112,5 +113,69 @@ module MnoEnterprise
112
113
  end
113
114
  end
114
115
  end
116
+
117
+ describe 'POST #create' do
118
+ let(:params) { FactoryGirl.attributes_for(:organization) }
119
+ before { allow(MnoEnterprise::Organization).to receive(:create) { organization } }
120
+
121
+ subject { post :create, organization: params }
122
+
123
+ it 'creates the organization' do
124
+ expect(MnoEnterprise::Organization).to receive(:create).with(params.slice(:name)) { organization }
125
+ subject
126
+ end
127
+
128
+ it 'provision the app instances' do
129
+ params.merge!(app_nids: ['xero', app_instance.app.nid])
130
+
131
+ # Track the API call
132
+ create = false
133
+ stub = -> { create = true; from_api(app_instance) }
134
+ api_stub_for(post: "/organizations/#{organization.id}/app_instances", response: stub)
135
+
136
+ subject
137
+
138
+ expect(create).to be true
139
+ end
140
+ end
141
+
142
+ describe 'POST #invite_member' do
143
+ before do
144
+ # Track the api call
145
+ @api_call = false
146
+ stub = -> { @api_call = true; from_api(org_invite) }
147
+ api_stub_for(post: "/organizations/#{organization.id}/org_invites", response: stub)
148
+ end
149
+
150
+ let(:params) { FactoryGirl.attributes_for(:user) }
151
+ subject { post :invite_member, id: organization.id, user: params }
152
+
153
+ context 'with existing user' do
154
+ before { allow(MnoEnterprise::User).to receive(:find_by) { user } }
155
+
156
+ it 'creates an invite' do
157
+ subject
158
+ expect(@api_call).to be true
159
+ end
160
+ end
161
+
162
+ context 'with new user' do
163
+ before { allow(MnoEnterprise::User).to receive(:find_by) { nil } }
164
+
165
+ # Directly stubbing the controller method as user creation is a PITA to stub
166
+ let(:new_user) { build(:user, params.slice(:email, :name, :surname, :phone)) }
167
+ before { allow(controller).to receive(:create_unconfirmed_user) { new_user } }
168
+
169
+ it 'creates a user' do
170
+ expect(controller).to receive(:create_unconfirmed_user) { new_user }
171
+ subject
172
+ end
173
+
174
+ it 'creates an invite' do
175
+ subject
176
+ expect(@api_call).to be true
177
+ end
178
+ end
179
+ end
115
180
  end
116
181
  end
@@ -28,33 +28,20 @@ module MnoEnterprise
28
28
  'admin_role' => user.admin_role,
29
29
  'created_at' => user.created_at,
30
30
  'last_sign_in_at' => user.last_sign_in_at,
31
- 'confirmed_at' => user.confirmed_at,
32
- 'organizations' => partial_hash_for_organization(user)
33
- }
34
- end
35
-
36
- def partial_hash_for_users(user)
37
- {
38
- 'id' => user.id,
39
- 'uid' => user.uid,
40
- 'email' => user.email,
41
- 'name' => user.name,
42
- 'surname' => user.surname,
43
- 'admin_role' => user.admin_role,
44
- 'created_at' => user.created_at
31
+ 'confirmed_at' => user.confirmed_at
45
32
  }
46
33
  end
47
34
 
48
35
  def hash_for_users(users)
49
36
  {
50
- 'users' => users.map { |o| partial_hash_for_users(o) },
37
+ 'users' => users.map { |o| partial_hash_for_user(o) },
51
38
  'metadata' => {'pagination' => {'count' => users.count}}
52
39
  }
53
40
  end
54
41
 
55
42
  def hash_for_user(user)
56
43
  hash = {
57
- 'user' => partial_hash_for_user(user)
44
+ 'user' => partial_hash_for_user(user).merge('organizations' => partial_hash_for_organization(user))
58
45
  }
59
46
 
60
47
  return hash
@@ -131,7 +118,20 @@ module MnoEnterprise
131
118
 
132
119
  # Test that the user is deleted by testing the api endpoint was called
133
120
  it { expect(user_to_delete.name).to eq('deleted') }
121
+ end
122
+
123
+ describe 'POST #signup_email' do
124
+ let(:email) { 'test@test.com' }
125
+ subject { post :signup_email, user: {email: email}}
134
126
 
127
+ it { expect(response).to be_success }
128
+
129
+ it 'sends the signup instructions' do
130
+ message_delivery = instance_double(ActionMailer::MessageDelivery)
131
+ expect(SystemNotificationMailer).to receive(:registration_instructions).with(email) { message_delivery }
132
+ expect(message_delivery).to receive(:deliver_later).with(no_args)
133
+ subject
134
+ end
135
135
  end
136
136
  end
137
137
  end
@@ -8,7 +8,7 @@ module MnoEnterprise
8
8
  render_views
9
9
  routes { MnoEnterprise::Engine.routes }
10
10
  before { request.env["HTTP_ACCEPT"] = 'application/json' }
11
-
11
+
12
12
 
13
13
  #===============================================
14
14
  # Assignments
@@ -16,7 +16,7 @@ module MnoEnterprise
16
16
  # Stub controller ability
17
17
  let!(:ability) { stub_ability }
18
18
  before { allow(ability).to receive(:can?).with(any_args).and_return(true) }
19
-
19
+
20
20
  # Stub user and user call
21
21
  let(:user) { build(:user) }
22
22
  before do
@@ -24,12 +24,12 @@ module MnoEnterprise
24
24
  api_stub_for(put: "/users/#{user.id}", response: from_api(user))
25
25
  end
26
26
  before { sign_in user }
27
-
27
+
28
28
  # Stub organization
29
29
  let(:organization) { build(:organization) }
30
30
  before { allow_any_instance_of(MnoEnterprise::User).to receive(:organizations).and_return([organization]) }
31
31
 
32
-
32
+
33
33
  #===============================================
34
34
  # Specs
35
35
  #===============================================
@@ -49,7 +49,7 @@ module MnoEnterprise
49
49
  before { api_stub_for(get: "/organizations/#{organization.id}/app_instances_sync/anything", response: from_api(progress_results)) }
50
50
 
51
51
  subject { get :index, organization_id: organization.uid }
52
-
52
+
53
53
  it_behaves_like "jpi v1 protected action"
54
54
 
55
55
  it "verifies the user's rights" do
@@ -74,29 +74,21 @@ module MnoEnterprise
74
74
  before { subject }
75
75
  it { expect(JSON.parse(response.body)['is_syncing']).to be_falsey }
76
76
  end
77
-
78
- context "when connector is pending" do
79
- let(:progress_results) { { connectors: [
80
- HashWithIndifferentAccess.new({name: 'a_name', status: 'PENDING', date: nil})
81
- ] } }
82
- before { subject }
83
- it { expect(JSON.parse(response.body)['is_syncing']).to be_truthy }
84
- end
85
77
  end
86
78
 
87
79
  describe "POST #create" do
88
- xit "to spec: cannot stub 'post /app_instances_syncs data%5Bmode%5D=a_mode'"
80
+ it "to spec: cannot stub 'post /app_instances_syncs data%5Bmode%5D=a_mode'"
89
81
 
90
- # # Apps sync
91
- # let(:sync_results) { [] }
92
- # before { api_stub_for(post: "/app_instances_sync", response: from_api(sync_results)) }
82
+ # Apps sync
83
+ let(:sync_results) { {connectors: []} }
84
+ before { api_stub_for(post: "/app_instances_syncs", response: from_api(sync_results)) }
93
85
 
94
- # subject { post :create, organization_id: organization.uid, mode: 'a_mode', return_url: 'a/random/url' }
86
+ subject { post :create, organization_id: organization.uid, mode: 'a_mode', return_url: 'a/random/url' }
95
87
 
96
- # it "verifies the user's rights" do
97
- # expect(ability).to receive(:can?).with(:sync_apps, organization)
98
- # subject
99
- # end
88
+ it "verifies the user's rights" do
89
+ expect(ability).to receive(:can?).with(:sync_apps, organization)
90
+ subject
91
+ end
100
92
  end
101
93
  end
102
94
  end