big_door 0.0.1

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.
Files changed (73) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +72 -0
  3. data/README.rdoc +170 -0
  4. data/Rakefile +32 -0
  5. data/autotest/discover.rb +1 -0
  6. data/big_door.gemspec +56 -0
  7. data/bin/example.rb +93 -0
  8. data/features/resources/attribute.feature +41 -0
  9. data/features/resources/currency_type.feature +12 -0
  10. data/features/resources/end_user.feature +92 -0
  11. data/features/resources/named_award_collection.feature +42 -0
  12. data/features/resources/named_good_collection.feature +40 -0
  13. data/features/resources/named_level_collection.feature +44 -0
  14. data/features/resources/url.feature +41 -0
  15. data/features/step_definitions/resources_steps.rb +370 -0
  16. data/features/support/env.rb +9 -0
  17. data/lib/big_door/attribute.rb +21 -0
  18. data/lib/big_door/award.rb +24 -0
  19. data/lib/big_door/client.rb +281 -0
  20. data/lib/big_door/currency.rb +26 -0
  21. data/lib/big_door/currency_balance.rb +27 -0
  22. data/lib/big_door/currency_type.rb +29 -0
  23. data/lib/big_door/end_user.rb +32 -0
  24. data/lib/big_door/good.rb +32 -0
  25. data/lib/big_door/leaderboard.rb +41 -0
  26. data/lib/big_door/level.rb +25 -0
  27. data/lib/big_door/named_award.rb +24 -0
  28. data/lib/big_door/named_award_collection.rb +21 -0
  29. data/lib/big_door/named_good.rb +24 -0
  30. data/lib/big_door/named_good_collection.rb +22 -0
  31. data/lib/big_door/named_level.rb +26 -0
  32. data/lib/big_door/named_level_collection.rb +23 -0
  33. data/lib/big_door/named_transaction.rb +21 -0
  34. data/lib/big_door/named_transaction_group.rb +74 -0
  35. data/lib/big_door/profile.rb +28 -0
  36. data/lib/big_door/resource.rb +204 -0
  37. data/lib/big_door/resource_end_user.rb +84 -0
  38. data/lib/big_door/resource_with_association.rb +37 -0
  39. data/lib/big_door/resource_with_parent.rb +43 -0
  40. data/lib/big_door/url.rb +21 -0
  41. data/lib/big_door.rb +40 -0
  42. data/script/console +10 -0
  43. data/script/destroy +14 -0
  44. data/script/generate +14 -0
  45. data/spec/big_door/attribute_spec.rb +18 -0
  46. data/spec/big_door/award_spec.rb +19 -0
  47. data/spec/big_door/client_spec.rb +163 -0
  48. data/spec/big_door/currency_balance_spec.rb +14 -0
  49. data/spec/big_door/currency_spec.rb +81 -0
  50. data/spec/big_door/currency_type_spec.rb +21 -0
  51. data/spec/big_door/end_user_spec.rb +23 -0
  52. data/spec/big_door/good_spec.rb +14 -0
  53. data/spec/big_door/leaderboard_spec.rb +15 -0
  54. data/spec/big_door/level_spec.rb +19 -0
  55. data/spec/big_door/named_award_collection_spec.rb +23 -0
  56. data/spec/big_door/named_award_spec.rb +23 -0
  57. data/spec/big_door/named_good_collection_spec.rb +23 -0
  58. data/spec/big_door/named_good_spec.rb +23 -0
  59. data/spec/big_door/named_level_collection_spec.rb +23 -0
  60. data/spec/big_door/named_level_spec.rb +24 -0
  61. data/spec/big_door/named_transaction_group_spec.rb +29 -0
  62. data/spec/big_door/named_transaction_spec.rb +23 -0
  63. data/spec/big_door/profile_spec.rb +19 -0
  64. data/spec/big_door/resource_end_user_spec.rb +22 -0
  65. data/spec/big_door/resource_spec.rb +22 -0
  66. data/spec/big_door/resource_with_association_spec.rb +23 -0
  67. data/spec/big_door/resource_with_parent_spec.rb +22 -0
  68. data/spec/big_door/url_spec.rb +23 -0
  69. data/spec/spec.opts +1 -0
  70. data/spec/spec_helper.rb +17 -0
  71. data/tasks/cucumber.rake +5 -0
  72. data/tasks/rspec.rake +29 -0
  73. metadata +263 -0
@@ -0,0 +1,163 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe Client do
5
+ context "fresh client object" do
6
+ subject { BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY ) }
7
+ it { should be }
8
+ it { should be_a_instance_of( BigDoor::Client )}
9
+ it { should respond_to(:app_key).with(0).arguments }
10
+ it "Should return app_key assigned" do
11
+ subject.app_key.should == TEST_APP_KEY
12
+ end
13
+
14
+ it { should respond_to(:app_secret).with(0).arguments }
15
+ it "Should return app_secret assigned" do
16
+ subject.app_secret.should == TEST_APP_SECRET
17
+ end
18
+
19
+ it { should respond_to(:app_host).with(0).arguments }
20
+ it "Should return default app_host" do
21
+ subject.app_host.should == 'http://api.bigdoor.com'
22
+ end
23
+
24
+ describe "#get" do
25
+ it { should respond_to(:get).with(1).arguments }
26
+ it { should respond_to(:get).with(2).arguments }
27
+ it "should return 9 predefined currency_type objects" do
28
+ response = subject.get('currency_type')
29
+ response.should be
30
+ response.should be_a_instance_of( Array )
31
+ response.length.should == 9
32
+ end
33
+ end
34
+
35
+ describe "#post" do
36
+ it { should respond_to(:post).with(3).arguments }
37
+ it "should create currency object" do
38
+ currency = {
39
+ 'pub_title' => 'Coins ',
40
+ 'pub_description' => 'an example of the Purchase currency type',
41
+ 'end_user_title' => 'Coins',
42
+ 'end_user_description' => 'can only be purchased',
43
+ 'currency_type_id' => '1',
44
+ 'currency_type_title' => 'Purchase',
45
+ 'exchange_rate' => 900.00,
46
+ 'relative_weight' => 2,
47
+ }
48
+ response = subject.post('currency', { 'format' => 'json' }, currency )
49
+ response.should be
50
+ response.should be_a_instance_of( Hash )
51
+ response['pub_title'].should == 'Coins '
52
+ response['pub_description'].should == 'an example of the Purchase currency type'
53
+ response['id'].should be
54
+ currency_id = response['id'].to_s
55
+ currency_id.should =~ /[0-9]+/
56
+
57
+ subject.delete('currency/%s' % currency_id )
58
+ end
59
+ end
60
+ describe "#put" do
61
+ it { should respond_to(:put).with(3).arguments }
62
+ it "should create and update currency object" do
63
+ currency = {
64
+ 'pub_title' => 'Coins ',
65
+ 'pub_description' => 'an example of the Purchase currency type',
66
+ 'end_user_title' => 'Coins',
67
+ 'end_user_description' => 'can only be purchased',
68
+ 'currency_type_id' => '1',
69
+ 'currency_type_title' => 'Purchase',
70
+ 'exchange_rate' => 900.00,
71
+ 'relative_weight' => 2,
72
+ }
73
+ response = subject.post('currency', { 'format' => 'json' }, currency )
74
+ response.should be
75
+ response.should be_a_instance_of( Hash )
76
+ response['id'].should be
77
+ currency_id = response['id'].to_s
78
+ currency_id.should =~ /[0-9]+/
79
+
80
+ currency['pub_title'] = 'Coins'
81
+ currency.delete('token')
82
+ response = subject.put('currency/%s' % currency_id, { 'format' => 'json' }, currency )
83
+ response.should be
84
+ response.should be_a_instance_of( Hash )
85
+ response['pub_title'].should == 'Coins'
86
+ response['pub_description'].should == 'an example of the Purchase currency type'
87
+ subject.delete('currency/%s' % currency_id )
88
+ end
89
+ end
90
+ describe "#delete" do
91
+ it { should respond_to(:delete).with(2).arguments }
92
+ it "should create and delete currency object" do
93
+ currency = {
94
+ 'pub_title' => 'Coins ',
95
+ 'pub_description' => 'an example of the Purchase currency type',
96
+ 'end_user_title' => 'Coins',
97
+ 'end_user_description' => 'can only be purchased',
98
+ 'currency_type_id' => '1',
99
+ 'currency_type_title' => 'Purchase',
100
+ 'exchange_rate' => 900.00,
101
+ 'relative_weight' => 2,
102
+ }
103
+ response = subject.post('currency', { 'format' => 'json' }, currency )
104
+ response.should be
105
+ response.should be_a_instance_of( Hash )
106
+ response['id'].should be
107
+ currency_id = response['id'].to_s
108
+ currency_id.should =~ /[0-9]+/
109
+
110
+
111
+ # FIXME check for exception
112
+ response = subject.delete('currency/%s' % currency_id )
113
+ # check that zero objects left
114
+ end
115
+ end
116
+
117
+ end
118
+ describe "fresh client object with app_host set explictly" do
119
+ subject { BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY, 'http://localhost/') }
120
+ it "Should return app_host assigned" do
121
+ subject.app_host.should == 'http://localhost/'
122
+ end
123
+ end
124
+
125
+ context "fresh client object with fake keys" do
126
+ subject { BigDoor::Client.new( FAKE_APP_SECRET , FAKE_APP_KEY ) }
127
+ it { should respond_to(:generate_signature).with(2).arguments }
128
+ it "Should generate matching signature for 2 arguments" do
129
+ params = { 'time' => 1270503018.33 }
130
+ url = "/api/publisher/#{FAKE_APP_KEY}/transaction_summary"
131
+ signature = subject.generate_signature( url, params )
132
+ signature.should == '9d1550bb516ee2cc47d163b4b99f00e15c84b3cd32a82df9fd808aa0eb505f04'
133
+ end
134
+ it { should respond_to(:generate_signature).with(1).arguments }
135
+ it "Should generate matching signature for 1 argument" do
136
+ url = "/api/publisher/#{FAKE_APP_KEY}/transaction_summary"
137
+ signature = subject.generate_signature( url )
138
+ signature.should == 'fa5ae4f36a4d90abae0cbbe5fd3d59b73bae6638ff517e9c26be64569c696bcc'
139
+ end
140
+ it { should respond_to(:generate_signature).with(2).arguments }
141
+ it "Should generate matching signature for 2 argument and whitelisted param" do
142
+ url = "/api/publisher/#{FAKE_APP_KEY}/transaction_summary"
143
+ params = { 'format' => 'json', 'sig' => 'this_sig_is_fake!' }
144
+ signature = subject.generate_signature( url, params )
145
+ signature.should == 'fa5ae4f36a4d90abae0cbbe5fd3d59b73bae6638ff517e9c26be64569c696bcc'
146
+ end
147
+ it { should respond_to(:generate_signature).with(3).arguments }
148
+ it "Should generate matching signature for 3 argument and whitelisted param" do
149
+
150
+ url = "/api/publisher/#{FAKE_APP_KEY}/currency/1"
151
+
152
+ params = { 'format' => 'json', 'time' => '1270517162.52'};
153
+ payload = {
154
+ 'end_user_description' => 'Testing signature generation.',
155
+ 'time' => '1270517162.52',
156
+ 'token' => 'bd323c0ca7c64277ba2b0cd9f93fe463'
157
+ }
158
+ signature = subject.generate_signature( url, params, payload )
159
+ signature.should == 'cd073723c4901b57466694f63a2b7746caf1836c9bcdd4f98d55357334c2de64'
160
+ end
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe CurrencyBalance do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "fresh CurrencyBalance object" do
9
+ subject { BigDoor::CurrencyBalance.new }
10
+ it { should be }
11
+ it { should be_a_instance_of( BigDoor::CurrencyBalance )}
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,81 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe Currency do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "Currency class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::Currency.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of Currencies at the beginning" do
13
+ currencies = BigDoor::Currency.all( @client )
14
+ currencies.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh Currency object" do
18
+ subject { BigDoor::Currency.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::Currency )}
21
+ it { should respond_to(:save).with(1).arguments }
22
+ it "Should save object successfully" do
23
+
24
+ subject.pub_title = 'Coins'
25
+ subject.pub_description = 'an example of the Purchase currency type'
26
+ subject.end_user_title = 'Coins'
27
+ subject.end_user_description = 'can only be purchased'
28
+ subject.currency_type_id = 1
29
+ subject.currency_type_title = 'Purchase'
30
+ subject.exchange_rate = 900
31
+ subject.relative_weight = 2
32
+
33
+ subject.save( @client )
34
+
35
+ should respond_to('resource_id').with(0).arguments
36
+ subject.resource_id.to_s.should =~ /\d+/
37
+ save_resource_id = subject.resource_id
38
+
39
+ should respond_to('resource_name').with(0).arguments
40
+ subject.resource_name.should == 'currency'
41
+
42
+ subject.pub_title = 'Banknotes'
43
+ subject.save( @client )
44
+ subject.resource_id.should == save_resource_id
45
+ subject.pub_title.should == 'Banknotes'
46
+
47
+ subject.resource_id = nil
48
+ subject.pub_title = nil
49
+
50
+ should respond_to('load').with(2).arguments
51
+ subject.load( @client, save_resource_id )
52
+
53
+ subject.resource_id.should == save_resource_id
54
+ subject.pub_title.should == 'Banknotes'
55
+
56
+ subject.pub_title = nil
57
+
58
+ should respond_to('load').with(1).arguments
59
+ subject.load( @client )
60
+
61
+ subject.resource_id.should == save_resource_id
62
+ subject.pub_title.should == 'Banknotes'
63
+
64
+ currencies = BigDoor::Currency.all( @client )
65
+ currencies.should be_a_instance_of( Array )
66
+ currencies.should_not be_empty
67
+
68
+ currencies[0].should be_a_instance_of( Currency )
69
+
70
+ should respond_to(:delete).with(1).arguments
71
+ subject.delete( @client )
72
+ end
73
+ it { should respond_to(:load).with(2).arguments }
74
+ it { should respond_to(:delete).with(2).arguments }
75
+ it "Should load Array of Currencies at the end" do
76
+ currencies = BigDoor::Currency.all( @client )
77
+ currencies.should be_a_instance_of( Array )
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe CurrencyType do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "CurrencyType class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::CurrencyType.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of Currency types at the beginning" do
13
+ currency_types = BigDoor::CurrencyType.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ # currency_types.should have(9).items
16
+ currency_types[0].should respond_to(:title).with(0).arguments
17
+ currency_types[0].should respond_to(:description).with(0).arguments
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe EndUser do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "EndUser class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::EndUser.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of end_users at the beginning" do
13
+ currency_types = BigDoor::EndUser.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh EndUser object" do
18
+ subject { BigDoor::EndUser.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::EndUser )}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe Good do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "fresh Good object" do
9
+ subject { BigDoor::Good.new }
10
+ it { should be }
11
+ it { should be_a_instance_of( BigDoor::Good )}
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe Leaderboard do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "fresh Leaderboard object" do
9
+ subject { BigDoor::Leaderboard.new }
10
+ it { should be }
11
+ it { should be_a_instance_of( BigDoor::Leaderboard )}
12
+ it { should respond_to(:execute).with(2).arguments}
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe Level do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "fresh Level object" do
9
+ subject { BigDoor::Level.new }
10
+ it { should be }
11
+ it { should be_a_instance_of( BigDoor::Level )}
12
+ end
13
+ context "Level class" do
14
+ it "Should respond to :all" do
15
+ BigDoor::Level.should respond_to(:all).with(2).arguments
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedAwardCollection do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedAwardCollection class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedAwardCollection.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of named award collections at the beginning" do
13
+ currency_types = BigDoor::NamedAwardCollection.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh NamedAwardCollection object" do
18
+ subject { BigDoor::NamedAwardCollection.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::NamedAwardCollection )}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedAward do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedAward class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedAward.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of named awards at the beginning" do
13
+ currency_types = BigDoor::NamedAward.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh NamedAward object" do
18
+ subject { BigDoor::NamedAward.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::NamedAward )}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedGoodCollection do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedGoodCollection class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedGoodCollection.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of named good collections at the beginning" do
13
+ currency_types = BigDoor::NamedGoodCollection.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh NamedGoodCollection object" do
18
+ subject { BigDoor::NamedGoodCollection.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::NamedGoodCollection )}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedGood do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedGood class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedGood.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of named goods at the beginning" do
13
+ currency_types = BigDoor::NamedGood.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh NamedGood object" do
18
+ subject { BigDoor::NamedGood.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::NamedGood )}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedLevelCollection do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedLevelCollection class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedLevelCollection.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of named level collections at the beginning" do
13
+ currency_types = BigDoor::NamedLevelCollection.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh NamedLevelCollection object" do
18
+ subject { BigDoor::NamedLevelCollection.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::NamedLevelCollection )}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedLevel do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedLevel class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedLevel.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of named levels at the beginning" do
13
+ currency_types = BigDoor::NamedLevel.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ # currency_types.should be_empty
16
+ end
17
+ end
18
+ context "fresh NamedLevel object" do
19
+ subject { BigDoor::NamedLevel.new }
20
+ it { should be }
21
+ it { should be_a_instance_of( BigDoor::NamedLevel )}
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedTransactionGroup do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedTransactionGroup class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedTransactionGroup.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load array of named transaction groups at the beginning" do
13
+ currency_types = BigDoor::NamedTransactionGroup.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ subject { BigDoor::NamedTransactionGroup.new( {} ) }
17
+ it { should be }
18
+ it { should be_instance_of BigDoor::NamedTransactionGroup}
19
+ it { should respond_to(:save).with(1).arguments}
20
+ it { should respond_to(:load).with(1).arguments}
21
+ it { should respond_to(:load).with(2).arguments}
22
+ it { should respond_to(:delete).with(1).arguments}
23
+ it { should respond_to(:delete).with(2).arguments}
24
+ it { should respond_to(:execute).with(3).arguments}
25
+ it { should respond_to(:associate_with).with(2).arguments}
26
+ it { should respond_to(:associate_with).with(3).arguments}
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe NamedTransaction do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "NamedTransaction class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::NamedTransaction.should respond_to(:all).with(1).arguments
11
+ end
12
+ it "Should load Array of named transactions at the beginning" do
13
+ currency_types = BigDoor::NamedTransaction.all( @client )
14
+ currency_types.should be_a_instance_of( Array )
15
+ end
16
+ end
17
+ context "fresh NamedTransaction object" do
18
+ subject { BigDoor::NamedTransaction.new }
19
+ it { should be }
20
+ it { should be_a_instance_of( BigDoor::NamedTransaction )}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe Profile do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "fresh Profile object" do
9
+ subject { BigDoor::Profile.new }
10
+ it { should be }
11
+ it { should be_a_instance_of( BigDoor::Profile )}
12
+ end
13
+ context "Profile class" do
14
+ it "Should respond to :all" do
15
+ BigDoor::Profile.should respond_to(:all).with(2).arguments
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe ResourceEndUser do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "ResourceEndUser class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::ResourceEndUser.should respond_to(:all).with(2).arguments
11
+ end
12
+ subject { BigDoor::ResourceEndUser.new( {} ) }
13
+ it { should be }
14
+ it { should be_instance_of BigDoor::ResourceEndUser}
15
+ it { should respond_to(:save).with(1).arguments}
16
+ it { should respond_to(:load).with(1).arguments}
17
+ it { should respond_to(:load).with(2).arguments}
18
+ it { should respond_to(:delete).with(1).arguments}
19
+ it { should respond_to(:delete).with(2).arguments}
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe Resource do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "Resource class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::Resource.should respond_to(:all).with(1).arguments
11
+ end
12
+ subject { BigDoor::Resource.new( {} ) }
13
+ it { should be }
14
+ it { should be_instance_of BigDoor::Resource}
15
+ it { should respond_to(:save).with(1).arguments}
16
+ it { should respond_to(:load).with(1).arguments}
17
+ it { should respond_to(:load).with(2).arguments}
18
+ it { should respond_to(:delete).with(1).arguments}
19
+ it { should respond_to(:delete).with(2).arguments}
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module BigDoor
4
+ describe ResourceWithAssociation do
5
+ before(:each) do
6
+ @client = BigDoor::Client.new( TEST_APP_SECRET, TEST_APP_KEY )
7
+ end
8
+ context "ResourceWithAssociation class" do
9
+ it "Should respond to :all" do
10
+ BigDoor::ResourceWithAssociation.should respond_to(:all).with(1).arguments
11
+ end
12
+ subject { BigDoor::ResourceWithAssociation.new( {} ) }
13
+ it { should be }
14
+ it { should be_instance_of BigDoor::ResourceWithAssociation}
15
+ it { should respond_to(:associate_with).with(2).arguments}
16
+ it { should respond_to(:save).with(1).arguments}
17
+ it { should respond_to(:load).with(1).arguments}
18
+ it { should respond_to(:load).with(2).arguments}
19
+ it { should respond_to(:delete).with(1).arguments}
20
+ it { should respond_to(:delete).with(2).arguments}
21
+ end
22
+ end
23
+ end