openstax_accounts 6.1.5 → 6.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,5 +16,36 @@ module OpenStax::Accounts
16
16
  expect(group_2.errors[:openstax_uid]).to eq(['has already been taken'])
17
17
  end
18
18
  end
19
+
20
+ context 'no stubbing' do
21
+ before(:all) do
22
+ @stubbing = OpenStax::Accounts.configuration.enable_stubbing?
23
+ OpenStax::Accounts.configuration.enable_stubbing = false
24
+ end
25
+
26
+ after(:all) { OpenStax::Accounts.configuration.enable_stubbing = @stubbing }
27
+
28
+ let!(:requestor) { FactoryGirl.create(:openstax_accounts_account) }
29
+ let!(:group) do
30
+ FactoryGirl.build(:openstax_accounts_group).tap{ |group| group.requestor = requestor }
31
+ end
32
+
33
+ it 'calls OpenStax Accounts when created' do
34
+ expect(OpenStax::Accounts::Api).to receive(:create_group).with(requestor, group)
35
+ group.save!
36
+ end
37
+
38
+ it 'fails to save if the requestor is nil' do
39
+ group.requestor = nil
40
+ expect(OpenStax::Accounts::Api).not_to receive(:create_group)
41
+ expect(group.save).to eq false
42
+ end
43
+
44
+ it 'does not call OpenStax Accounts if the requestor is temp' do
45
+ group.requestor.access_token = nil
46
+ expect(OpenStax::Accounts::Api).not_to receive(:create_group)
47
+ group.save!
48
+ end
49
+ end
19
50
  end
20
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_accounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.5
4
+ version: 6.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails