bill_forward 1.2014.296 → 1.2015.183
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +29 -27
- data/.idea/compiler.xml +23 -23
- data/.idea/copyright/profiles_settings.xml +2 -2
- data/.idea/encodings.xml +5 -5
- data/.idea/inspectionProfiles/Project_Default.xml +10 -10
- data/.idea/inspectionProfiles/profiles_settings.xml +6 -6
- data/.idea/misc.xml +23 -23
- data/.idea/modules.xml +9 -9
- data/.idea/scopes/scope_settings.xml +4 -4
- data/.idea/vcs.xml +7 -7
- data/.rspec +1 -1
- data/Gemfile +13 -9
- data/LICENSE.md +22 -22
- data/README.md +285 -227
- data/Rakefile +73 -73
- data/bill_forward.gemspec +28 -29
- data/bill_forward.iml +28 -28
- data/lib/bill_forward/billing_entity.rb +295 -262
- data/lib/bill_forward/client.rb +350 -355
- data/lib/bill_forward/entities/account.rb +18 -18
- data/lib/bill_forward/entities/amendments/issue_invoice_amendment.rb +10 -0
- data/lib/bill_forward/entities/amendments/product_rate_plan_migration_amendment.rb +18 -0
- data/lib/bill_forward/entities/api_configuration.rb +12 -0
- data/lib/bill_forward/entities/invoice.rb +29 -3
- data/lib/bill_forward/entities/invoice_parts/taxation_link.rb +5 -5
- data/lib/bill_forward/entities/organisation.rb +36 -36
- data/lib/bill_forward/entities/payment_method.rb +4 -4
- data/lib/bill_forward/entities/payment_method_subscription_link.rb +5 -5
- data/lib/bill_forward/entities/pricing_component.rb +21 -21
- data/lib/bill_forward/entities/pricing_component_tier.rb +5 -5
- data/lib/bill_forward/entities/pricing_component_value.rb +5 -5
- data/lib/bill_forward/entities/pricing_component_value_migration_amendment_mapping.rb +31 -0
- data/lib/bill_forward/entities/product.rb +5 -5
- data/lib/bill_forward/entities/product_rate_plan.rb +43 -19
- data/lib/bill_forward/entities/profile.rb +14 -14
- data/lib/bill_forward/entities/refund.rb +5 -0
- data/lib/bill_forward/entities/role.rb +3 -3
- data/lib/bill_forward/entities/stripe_ach_token.rb +9 -0
- data/lib/bill_forward/entities/subscription.rb +83 -53
- data/lib/bill_forward/entities/subscription_charge.rb +14 -0
- data/lib/bill_forward/insertable_entity.rb +21 -31
- data/lib/bill_forward/mutable_entity.rb +26 -46
- data/lib/bill_forward/resource_path.rb +10 -10
- data/lib/bill_forward/type_check.rb +20 -20
- data/lib/bill_forward/version.rb +4 -4
- data/lib/bill_forward.rb +17 -17
- data/scratch/Gemfile +9 -0
- data/scratch/scratch.example.rb +8 -0
- data/spec/component/account_spec.rb +199 -199
- data/spec/component/billing_entity_spec.rb +152 -152
- data/spec/functional/account_spec.rb +24 -24
- data/spec/functional/bad_citizen/account_spec.rb +102 -102
- data/spec/functional/bad_citizen/credit_note_spec.rb +14 -13
- data/spec/functional/bad_citizen/payment_method_spec.rb +1 -1
- data/spec/functional/bad_citizen/product_rate_plan_migration_amendment_spec.rb +379 -0
- data/spec/functional/bad_citizen/product_rate_plan_spec.rb +103 -47
- data/spec/functional/bad_citizen/product_spec.rb +16 -9
- data/spec/functional/bad_citizen/situational/authorize_net_token_spec.rb +4 -0
- data/spec/functional/bad_citizen/situational/malordered_entity_spec.rb +1 -1
- data/spec/functional/bad_citizen/situational/payment_method_spec.rb +6 -1
- data/spec/functional/bad_citizen/situational/subscription_chargeable_spec.rb +96 -65
- data/spec/functional/bad_citizen/subscription_spec.rb +99 -60
- data/spec/functional/bad_citizen/subscription_with_credit_spec.rb +121 -91
- data/spec/functional/bad_citizen/unit_of_measure_spec.rb +14 -7
- data/spec/functional/client_spec.rb +23 -23
- data/spec/functional/organisation_spec.rb +27 -27
- data/spec/setup_test_constants.rb +72 -72
- data/spec/spec_helper.rb +10 -10
- data/spec/syntax/account_spec.rb +23 -23
- data/spec/syntax/billing_entity_spec.rb +92 -92
- data/tools/RSpec hardcoded.sublime-build +16 -0
- data/tools/RSpec.sublime-build +13 -0
- data/tools/Ruby legacy.sublime-build +7 -0
- data/tools/local_bundle_build.sh +8 -0
- data/tools/local_bundle_install.sh +9 -0
- metadata +30 -85
data/README.md
CHANGED
@@ -1,227 +1,285 @@
|
|
1
|
-
# BillForwardApiClient
|
2
|
-
|
3
|
-
This client library provides (via Ruby) easy access to the BillForward API.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
gem
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
###
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
```
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
#####
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
```ruby
|
65
|
-
|
66
|
-
puts subscription
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
puts
|
129
|
-
```
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
###
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
```
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
```
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
1
|
+
# BillForwardApiClient
|
2
|
+
|
3
|
+
This client library provides (via Ruby) easy access to the BillForward API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
### From Git
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile and run `bundle`:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'bill_forward', :git => 'git@github.com:billforward/bf-ruby.git', :branch => 'master'
|
12
|
+
```
|
13
|
+
|
14
|
+
Or install this source as a local gem using:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
bundle
|
18
|
+
gem build bill_forward.gemspec
|
19
|
+
gem install bill_forward
|
20
|
+
```
|
21
|
+
|
22
|
+
### From RubyGems mirror
|
23
|
+
|
24
|
+
Add the `bill_forward` gem to your application's Gemfile and run `bundle`:
|
25
|
+
```ruby
|
26
|
+
source 'https://rubygems.org'
|
27
|
+
gem 'bill_forward'
|
28
|
+
```
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
### Including the Gem
|
32
|
+
|
33
|
+
Once installed, require the BillForward gem:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require 'bill_forward'
|
37
|
+
```
|
38
|
+
|
39
|
+
### Getting Credentials
|
40
|
+
You will need an API token. First log into your [Sandbox account](https://app-sandbox.billforward.net/login/#/) ([register](https://app-sandbox.billforward.net/register/#/) if necessary).
|
41
|
+
|
42
|
+
Then [generate an API token](https://app-sandbox.billforward.net/setup/#/personal/api-keys).
|
43
|
+
|
44
|
+
We support also client-id and client-secret authentication. For details, please [contact BillForward support](http://www.billforward.net/contact-us/).
|
45
|
+
|
46
|
+
### Connecting
|
47
|
+
|
48
|
+
Create a default Client. Requests will be sent using its credentials:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
my_client = BillForward::Client.new(
|
52
|
+
:host => "API URL goes here",
|
53
|
+
:api_token => "API token goes here"
|
54
|
+
)
|
55
|
+
BillForward::Client.default_client = my_client
|
56
|
+
```
|
57
|
+
|
58
|
+
### Invocation
|
59
|
+
|
60
|
+
##### Getting single entities:
|
61
|
+
|
62
|
+
e.g. Get Subscription by ID:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
subscription = BillForward::Subscription.get_by_id '3C39A79F-777E-4BDF-BDDC-221652F74E9D'
|
66
|
+
puts subscription
|
67
|
+
```
|
68
|
+
|
69
|
+
##### Accessing entity variables:
|
70
|
+
|
71
|
+
The entity can be accessed as a HashWithIndifferentAccess, or as an array.
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
# The following are equivalent:
|
75
|
+
puts subscription.id
|
76
|
+
puts subscription['id']
|
77
|
+
puts subscription[:id]
|
78
|
+
```
|
79
|
+
|
80
|
+
##### Getting a list of entities:
|
81
|
+
|
82
|
+
e.g. List Accounts
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
query_params = {
|
86
|
+
'records' => 3,
|
87
|
+
'order_by' => 'created',
|
88
|
+
'order' => 'ASC'
|
89
|
+
}
|
90
|
+
accounts = BillForward::Account.get_all query_params
|
91
|
+
puts accounts
|
92
|
+
```
|
93
|
+
|
94
|
+
##### Creating an entity:
|
95
|
+
|
96
|
+
e.g. Create simple Account
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
created_account = BillForward::Account.create
|
100
|
+
```
|
101
|
+
|
102
|
+
e.g. Create complex Account
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
# Create an account with a profile (where the profile has addresses)
|
106
|
+
addresses = Array.new
|
107
|
+
addresses.push(
|
108
|
+
BillForward::Address.new({
|
109
|
+
'addressLine1' => 'address line 1',
|
110
|
+
'addressLine2' => 'address line 2',
|
111
|
+
'addressLine3' => 'address line 3',
|
112
|
+
'city' => 'London',
|
113
|
+
'province' => 'London',
|
114
|
+
'country' => 'United Kingdom',
|
115
|
+
'postcode' => 'SW1 1AS',
|
116
|
+
'landline' => '02000000000',
|
117
|
+
'primaryAddress' => true
|
118
|
+
}))
|
119
|
+
profile = BillForward::Profile.new({
|
120
|
+
'email' => 'always@testing.is.moe',
|
121
|
+
'firstName' => 'Test',
|
122
|
+
'addresses' => addresses
|
123
|
+
})
|
124
|
+
account = BillForward::Account.new({
|
125
|
+
'profile' => profile
|
126
|
+
})
|
127
|
+
created_account = BillForward::Account.create account
|
128
|
+
puts created_account
|
129
|
+
```
|
130
|
+
|
131
|
+
##### Updating an entity
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
gotten_account = BillForward::Account.get_by_id '908AF77A-0E5D-4D80-9B91-31EDE9962BF6'
|
135
|
+
gotten_account.profile.email = 'sometimes@testing.is.moe'
|
136
|
+
updated_account = gotten_account.save() # or: gotten_account.profile.save()
|
137
|
+
puts updated_account
|
138
|
+
```
|
139
|
+
|
140
|
+
## Documentation
|
141
|
+
|
142
|
+
View our [API Documentation](https://app-sandbox.billforward.net/#/api/method/accounts/POST?api=Ruby&path=%2Faccounts).
|
143
|
+
|
144
|
+
## Development
|
145
|
+
### Building
|
146
|
+
Clone the source, then run `bundle`.
|
147
|
+
```bash
|
148
|
+
bundle
|
149
|
+
```
|
150
|
+
If ever you add a new dependency, you will need to run this again.
|
151
|
+
|
152
|
+
To install the gem, run:
|
153
|
+
```ruby
|
154
|
+
gem build bill_forward.gemspec
|
155
|
+
gem install bill_forward
|
156
|
+
```
|
157
|
+
|
158
|
+
Maybe you find yourself running the above two snippets very often.
|
159
|
+
You can invoke them more simply by running `tools/local_bundle_install.sh`.
|
160
|
+
|
161
|
+
### Invoking unpacked gem
|
162
|
+
The `scratch/` directory contains a Gemfile that includes this repo's gem, without having to repeatedly bundle and gem build & install upon changes.
|
163
|
+
|
164
|
+
Run `bundle` once in the `scratch/` directory to pull in its dependent gems.
|
165
|
+
|
166
|
+
You can recruit this Gemfile using a file like as `scratch/scratch.example.rb`.
|
167
|
+
Make your own `scratch/scratch.rb` (this particular path is exempt from version control), or any file ending in `.scratch.rb` to play around with this gem locally.
|
168
|
+
|
169
|
+
In Sublime I use such a build system to run `.rb` scratch files:
|
170
|
+
|
171
|
+
```json
|
172
|
+
{
|
173
|
+
"env": {
|
174
|
+
"PATH":"${HOME}/.rvm/bin:${PATH}"
|
175
|
+
},
|
176
|
+
"cmd": ["rvm-auto-ruby", "-rubygems", "${file}" ],
|
177
|
+
"selector": "source.ruby"
|
178
|
+
}
|
179
|
+
```
|
180
|
+
|
181
|
+
You'll find this build system in `tools/Ruby\ legacy.sublime-build`.
|
182
|
+
|
183
|
+
### Running tests
|
184
|
+
Development is decidedly test-driven.
|
185
|
+
|
186
|
+
We use RSpec for testing.
|
187
|
+
|
188
|
+
Run offline tests with:
|
189
|
+
```bash
|
190
|
+
rake
|
191
|
+
```
|
192
|
+
|
193
|
+
If you wish to run online tests also, you will need to declare some test constants. Create a file `test_constants.rb` in the directory `spec/`, containing the following declarations:
|
194
|
+
|
195
|
+
```ruby
|
196
|
+
module BillForwardTest
|
197
|
+
BILLFORWARD_API_HOST='insert-API-URL-here'
|
198
|
+
BILLFORWARD_API_TOKEN="insert-access-token-here OR leave-blank-for-OAUTH"
|
199
|
+
|
200
|
+
### alternatively:
|
201
|
+
# (these values are used if you leave API token blank)
|
202
|
+
# authenticate using OAUTH:
|
203
|
+
BILLFORWARD_USERNAME="insert-username"
|
204
|
+
BILLFORWARD_PASSWORD="insert-password"
|
205
|
+
BILLFORWARD_CLIENT_ID="insert-client-id"
|
206
|
+
BILLFORWARD_CLIENT_SECRET="insert-client-secret"
|
207
|
+
|
208
|
+
|
209
|
+
# ---- Enable logging if you want (shows request and response bodies)
|
210
|
+
USE_LOGGING=false
|
211
|
+
|
212
|
+
|
213
|
+
# ---- Enable proxy if you want (for example to see requests in Fiddler)
|
214
|
+
CLIENT_PROXY_ENABLED=false
|
215
|
+
CLIENT_PROXY_URL="http://127.0.0.1:8888"
|
216
|
+
end
|
217
|
+
```
|
218
|
+
|
219
|
+
In Sublime I use such a build system to run individual `_spec.rb` specs:
|
220
|
+
|
221
|
+
```json
|
222
|
+
{
|
223
|
+
"env": {
|
224
|
+
"PATH":"${HOME}/.rvm/bin:${PATH}"
|
225
|
+
},
|
226
|
+
"cmd": ["rvm-auto-ruby","-S", "bundle", "exec", "rspec", "-I ${file_path}", "$file"],
|
227
|
+
"working_dir": "${project_path}",
|
228
|
+
"selector": "source.ruby",
|
229
|
+
|
230
|
+
"windows":
|
231
|
+
{
|
232
|
+
"cmd": ["rspec.bat", "-I ${file_path}", "$file"]
|
233
|
+
}
|
234
|
+
}
|
235
|
+
```
|
236
|
+
|
237
|
+
You'll find this build system in `tools/RSpec.sublime-build`.
|
238
|
+
|
239
|
+
Run main functional tests + offline tests with:
|
240
|
+
```bash
|
241
|
+
rake spec_main
|
242
|
+
```
|
243
|
+
|
244
|
+
There are further tests still that can be run, but these are situational -- for example, they require an invoice to exist already, or require credentials to be declared for a payment gateway.
|
245
|
+
|
246
|
+
You can specify constants for use in situational tests in the usual test constants file, as before:
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
module BillForwardTest
|
250
|
+
BILLFORWARD_API_HOST='insert-API-URL-here'
|
251
|
+
BILLFORWARD_API_TOKEN="insert-access-token-here OR leave-blank-for-OAUTH"
|
252
|
+
|
253
|
+
### alternatively:
|
254
|
+
# (these values are used if you leave API token blank)
|
255
|
+
# authenticate using OAUTH:
|
256
|
+
BILLFORWARD_USERNAME="insert-username"
|
257
|
+
BILLFORWARD_PASSWORD="insert-password"
|
258
|
+
BILLFORWARD_CLIENT_ID="insert-client-id"
|
259
|
+
BILLFORWARD_CLIENT_SECRET="insert-client-secret"
|
260
|
+
|
261
|
+
|
262
|
+
# ---- Enable logging if you want (shows request and response bodies)
|
263
|
+
USE_LOGGING=false
|
264
|
+
|
265
|
+
|
266
|
+
# ---- Enable proxy if you want (for example to see requests in Fiddler)
|
267
|
+
CLIENT_PROXY_ENABLED=false
|
268
|
+
CLIENT_PROXY_URL="http://127.0.0.1:8888"
|
269
|
+
|
270
|
+
|
271
|
+
## These constants are required only for running situational tests (not in the main run):
|
272
|
+
# ---- Required for Authorize.Net gateway tests only
|
273
|
+
AUTHORIZE_NET_LOGIN_ID = 'FILL IN WITH AUTHORIZE NET LOGIN ID'
|
274
|
+
AUTHORIZE_NET_TRANSACTION_KEY = 'FILL IN WITH AUTHORIZE NET TRANSACTION KEY'
|
275
|
+
# ---- Required for Authorize.Net tokenization tests only
|
276
|
+
AUTHORIZE_NET_CUSTOMER_PROFILE_ID = 12345678 # FILL IN WITH AUTHORIZE NET CUSTOMER PROFILE ID
|
277
|
+
AUTHORIZE_NET_CUSTOMER_PAYMENT_PROFILE_ID = 12345678 # FILL IN WITH AUTHORIZE NET CUSTOMER PAYMENT PROFILE ID
|
278
|
+
AUTHORIZE_NET_CARD_LAST_4_DIGITS = 1234
|
279
|
+
end
|
280
|
+
```
|
281
|
+
|
282
|
+
Run main functional tests + offline tests + situational tests with:
|
283
|
+
```bash
|
284
|
+
rake spec_all
|
285
|
+
```
|
data/Rakefile
CHANGED
@@ -1,73 +1,73 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
# these specs test syntax and language features
|
7
|
-
syntax_specs = FileList['spec/syntax/*_spec.rb']
|
8
|
-
# these specs use mocking to test entities without calling a real API
|
9
|
-
component_specs = FileList['spec/component/*_spec.rb']
|
10
|
-
# these specs call the API, but in a read-only manner
|
11
|
-
functional_good_citizen_specs = FileList['spec/functional/*_spec.rb']
|
12
|
-
# these specs call the API, leaving lasting side-effects
|
13
|
-
functional_bad_citizen_specs = FileList['spec/functional/bad_citizen/*_spec.rb']
|
14
|
-
# these specs call the API, and also require prior setup (for example, ensure an invoice exists beforehand)
|
15
|
-
# we do not consider these part of the main run, as they're particularly bad citizens
|
16
|
-
functional_situational_specs = FileList['spec/functional/bad_citizen/situational/*_spec.rb']
|
17
|
-
|
18
|
-
# offline tests
|
19
|
-
fast_specs = FileList[]
|
20
|
-
fast_specs.concat(syntax_specs)
|
21
|
-
fast_specs.concat(component_specs)
|
22
|
-
|
23
|
-
# offline tests + main functional run
|
24
|
-
main_specs = FileList[]
|
25
|
-
main_specs.concat(fast_specs)
|
26
|
-
puts functional_good_citizen_specs
|
27
|
-
main_specs.concat(functional_good_citizen_specs)
|
28
|
-
main_specs.concat(functional_bad_citizen_specs)
|
29
|
-
|
30
|
-
# offline tests + main functional run + situational functional
|
31
|
-
all_specs = FileList[]
|
32
|
-
all_specs.concat(main_specs)
|
33
|
-
all_specs.concat(functional_situational_specs)
|
34
|
-
|
35
|
-
|
36
|
-
RSpec::Core::RakeTask.new(:spec_offline) do |t|
|
37
|
-
spec_files = FileList[]
|
38
|
-
spec_files.concat(fast_specs)
|
39
|
-
|
40
|
-
# trick t.pattern into accepting a list of files (otherwise deprecated)
|
41
|
-
# otherwise globbing does not work on Windows (only first file is matched)
|
42
|
-
t.pattern = spec_files
|
43
|
-
|
44
|
-
t.rspec_opts = "--color --format documentation"
|
45
|
-
end
|
46
|
-
|
47
|
-
RSpec::Core::RakeTask.new(:spec_main) do |t|
|
48
|
-
spec_files = FileList[]
|
49
|
-
spec_files.concat(main_specs)
|
50
|
-
|
51
|
-
# trick t.pattern into accepting a list of files (otherwise deprecated)
|
52
|
-
# otherwise globbing does not work on Windows (only first file is matched)
|
53
|
-
t.pattern = spec_files
|
54
|
-
|
55
|
-
t.rspec_opts = "--color --format documentation"
|
56
|
-
end
|
57
|
-
|
58
|
-
RSpec::Core::RakeTask.new(:spec_all) do |t|
|
59
|
-
spec_files = FileList[]
|
60
|
-
spec_files.concat(all_specs)
|
61
|
-
|
62
|
-
# trick t.pattern into accepting a list of files (otherwise deprecated)
|
63
|
-
# otherwise globbing does not work on Windows (only first file is matched)
|
64
|
-
t.pattern = spec_files
|
65
|
-
|
66
|
-
t.rspec_opts = "--color --format documentation"
|
67
|
-
end
|
68
|
-
|
69
|
-
# Make 'Rspec test run' the default task
|
70
|
-
task :default => :spec_offline
|
71
|
-
rescue LoadError
|
72
|
-
# no rspec available
|
73
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
# these specs test syntax and language features
|
7
|
+
syntax_specs = FileList['spec/syntax/*_spec.rb']
|
8
|
+
# these specs use mocking to test entities without calling a real API
|
9
|
+
component_specs = FileList['spec/component/*_spec.rb']
|
10
|
+
# these specs call the API, but in a read-only manner
|
11
|
+
functional_good_citizen_specs = FileList['spec/functional/*_spec.rb']
|
12
|
+
# these specs call the API, leaving lasting side-effects
|
13
|
+
functional_bad_citizen_specs = FileList['spec/functional/bad_citizen/*_spec.rb']
|
14
|
+
# these specs call the API, and also require prior setup (for example, ensure an invoice exists beforehand)
|
15
|
+
# we do not consider these part of the main run, as they're particularly bad citizens
|
16
|
+
functional_situational_specs = FileList['spec/functional/bad_citizen/situational/*_spec.rb']
|
17
|
+
|
18
|
+
# offline tests
|
19
|
+
fast_specs = FileList[]
|
20
|
+
fast_specs.concat(syntax_specs)
|
21
|
+
fast_specs.concat(component_specs)
|
22
|
+
|
23
|
+
# offline tests + main functional run
|
24
|
+
main_specs = FileList[]
|
25
|
+
main_specs.concat(fast_specs)
|
26
|
+
puts functional_good_citizen_specs
|
27
|
+
main_specs.concat(functional_good_citizen_specs)
|
28
|
+
main_specs.concat(functional_bad_citizen_specs)
|
29
|
+
|
30
|
+
# offline tests + main functional run + situational functional
|
31
|
+
all_specs = FileList[]
|
32
|
+
all_specs.concat(main_specs)
|
33
|
+
all_specs.concat(functional_situational_specs)
|
34
|
+
|
35
|
+
|
36
|
+
RSpec::Core::RakeTask.new(:spec_offline) do |t|
|
37
|
+
spec_files = FileList[]
|
38
|
+
spec_files.concat(fast_specs)
|
39
|
+
|
40
|
+
# trick t.pattern into accepting a list of files (otherwise deprecated)
|
41
|
+
# otherwise globbing does not work on Windows (only first file is matched)
|
42
|
+
t.pattern = spec_files
|
43
|
+
|
44
|
+
t.rspec_opts = "--color --format documentation"
|
45
|
+
end
|
46
|
+
|
47
|
+
RSpec::Core::RakeTask.new(:spec_main) do |t|
|
48
|
+
spec_files = FileList[]
|
49
|
+
spec_files.concat(main_specs)
|
50
|
+
|
51
|
+
# trick t.pattern into accepting a list of files (otherwise deprecated)
|
52
|
+
# otherwise globbing does not work on Windows (only first file is matched)
|
53
|
+
t.pattern = spec_files
|
54
|
+
|
55
|
+
t.rspec_opts = "--color --format documentation"
|
56
|
+
end
|
57
|
+
|
58
|
+
RSpec::Core::RakeTask.new(:spec_all) do |t|
|
59
|
+
spec_files = FileList[]
|
60
|
+
spec_files.concat(all_specs)
|
61
|
+
|
62
|
+
# trick t.pattern into accepting a list of files (otherwise deprecated)
|
63
|
+
# otherwise globbing does not work on Windows (only first file is matched)
|
64
|
+
t.pattern = spec_files
|
65
|
+
|
66
|
+
t.rspec_opts = "--color --format documentation"
|
67
|
+
end
|
68
|
+
|
69
|
+
# Make 'Rspec test run' the default task
|
70
|
+
task :default => :spec_offline
|
71
|
+
rescue LoadError
|
72
|
+
# no rspec available
|
73
|
+
end
|