defra_ruby_mocks 2.1.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -4
- data/app/controllers/defra_ruby_mocks/company_controller.rb +8 -1
- data/app/controllers/defra_ruby_mocks/worldpay_controller.rb +1 -0
- data/app/services/defra_ruby_mocks/companies_house_service.rb +12 -2
- data/app/services/defra_ruby_mocks/worldpay_resource_service.rb +2 -2
- data/app/services/defra_ruby_mocks/worldpay_response_service.rb +2 -0
- data/app/views/defra_ruby_mocks/company/officers.json.erb +26 -0
- data/app/views/defra_ruby_mocks/company/show.json.erb +10 -1
- data/config/routes.rb +8 -3
- data/lib/defra_ruby_mocks/configuration.rb +1 -2
- data/lib/defra_ruby_mocks/version.rb +1 -1
- data/spec/dummy/log/test.log +812 -430
- data/spec/examples.txt +104 -87
- data/spec/requests/company_spec.rb +13 -2
- data/spec/requests/officers_spec.rb +37 -0
- data/spec/requests/worldpay_spec.rb +3 -3
- data/spec/services/companies_house_service_spec.rb +28 -6
- data/spec/services/worldpay_resource_service_spec.rb +8 -0
- data/spec/services/worldpay_response_service_spec.rb +9 -2
- metadata +9 -6
data/spec/examples.txt
CHANGED
@@ -1,99 +1,116 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
------------------------------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/defra_ruby_mocks_spec.rb[1:1:1] | passed | 0.
|
4
|
-
./spec/defra_ruby_mocks_spec.rb[1:2:1:1] | passed | 0.
|
3
|
+
./spec/defra_ruby_mocks_spec.rb[1:1:1] | passed | 0.00189 seconds |
|
4
|
+
./spec/defra_ruby_mocks_spec.rb[1:2:1:1] | passed | 0.00011 seconds |
|
5
5
|
./spec/defra_ruby_mocks_spec.rb[1:2:2:1] | passed | 0.00012 seconds |
|
6
|
-
./spec/lib/configuration_spec.rb[1:1:1:1] | passed | 0.
|
7
|
-
./spec/lib/configuration_spec.rb[1:1:2:1] | passed | 0.
|
8
|
-
./spec/lib/configuration_spec.rb[1:1:3:1] | passed | 0.
|
6
|
+
./spec/lib/configuration_spec.rb[1:1:1:1] | passed | 0.0001 seconds |
|
7
|
+
./spec/lib/configuration_spec.rb[1:1:2:1] | passed | 0.00009 seconds |
|
8
|
+
./spec/lib/configuration_spec.rb[1:1:3:1] | passed | 0.00008 seconds |
|
9
9
|
./spec/lib/configuration_spec.rb[1:1:4:1] | passed | 0.00008 seconds |
|
10
|
-
./spec/lib/configuration_spec.rb[1:2:1:1] | passed | 0.
|
11
|
-
./spec/lib/configuration_spec.rb[1:2:2:1] | passed | 0.
|
12
|
-
./spec/lib/configuration_spec.rb[1:2:3:1] | passed | 0.
|
13
|
-
./spec/lib/configuration_spec.rb[1:2:4:1] | passed | 0.
|
14
|
-
./spec/requests/company_spec.rb[1:1:1:1] | passed | 0.
|
15
|
-
./spec/requests/company_spec.rb[1:1:2:1] | passed | 0.
|
16
|
-
./spec/requests/company_spec.rb[1:1:3:1:1] | passed | 0.
|
17
|
-
./spec/requests/company_spec.rb[1:1:3:2:1] | passed | 0.
|
18
|
-
./spec/requests/company_spec.rb[1:2:1] | passed | 0.
|
19
|
-
./spec/requests/
|
20
|
-
./spec/requests/
|
21
|
-
./spec/requests/worldpay_spec.rb[1:1:1:
|
22
|
-
./spec/requests/worldpay_spec.rb[1:1:
|
23
|
-
./spec/requests/worldpay_spec.rb[1:1:
|
24
|
-
./spec/requests/worldpay_spec.rb[1:1:2:
|
25
|
-
./spec/requests/worldpay_spec.rb[1:2:1:1]
|
26
|
-
./spec/requests/worldpay_spec.rb[1:2:2:1]
|
27
|
-
./spec/
|
28
|
-
./spec/
|
29
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
30
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
10
|
+
./spec/lib/configuration_spec.rb[1:2:1:1] | passed | 0.00008 seconds |
|
11
|
+
./spec/lib/configuration_spec.rb[1:2:2:1] | passed | 0.00088 seconds |
|
12
|
+
./spec/lib/configuration_spec.rb[1:2:3:1] | passed | 0.00008 seconds |
|
13
|
+
./spec/lib/configuration_spec.rb[1:2:4:1] | passed | 0.00008 seconds |
|
14
|
+
./spec/requests/company_spec.rb[1:1:1:1] | passed | 0.0019 seconds |
|
15
|
+
./spec/requests/company_spec.rb[1:1:2:1] | passed | 0.00201 seconds |
|
16
|
+
./spec/requests/company_spec.rb[1:1:3:1:1] | passed | 0.0046 seconds |
|
17
|
+
./spec/requests/company_spec.rb[1:1:3:2:1] | passed | 0.00526 seconds |
|
18
|
+
./spec/requests/company_spec.rb[1:2:1] | passed | 0.00309 seconds |
|
19
|
+
./spec/requests/officers_spec.rb[1:1:1] | passed | 0.00328 seconds |
|
20
|
+
./spec/requests/officers_spec.rb[1:2:1] | passed | 0.00118 seconds |
|
21
|
+
./spec/requests/worldpay_spec.rb[1:1:1:1:1:1] | passed | 0.01098 seconds |
|
22
|
+
./spec/requests/worldpay_spec.rb[1:1:1:1:2:1] | passed | 0.00331 seconds |
|
23
|
+
./spec/requests/worldpay_spec.rb[1:1:1:2:1:1] | passed | 0.00337 seconds |
|
24
|
+
./spec/requests/worldpay_spec.rb[1:1:2:1:1:1] | passed | 0.00427 seconds |
|
25
|
+
./spec/requests/worldpay_spec.rb[1:1:2:1:2:1] | passed | 0.0222 seconds |
|
26
|
+
./spec/requests/worldpay_spec.rb[1:1:2:2:1:1] | passed | 0.0023 seconds |
|
27
|
+
./spec/requests/worldpay_spec.rb[1:2:1:1] | passed | 0.01006 seconds |
|
28
|
+
./spec/requests/worldpay_spec.rb[1:2:2:1] | passed | 0.00463 seconds |
|
29
|
+
./spec/services/companies_house_service_spec.rb[1:1:1:1] | passed | 0.00011 seconds |
|
30
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:1:1] | passed | 0.00007 seconds |
|
31
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:1:2] | passed | 0.00009 seconds |
|
32
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:2:1] | passed | 0.00008 seconds |
|
33
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:2:2] | passed | 0.00008 seconds |
|
34
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:3:1] | passed | 0.00008 seconds |
|
35
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:3:2] | passed | 0.00007 seconds |
|
31
36
|
./spec/services/companies_house_service_spec.rb[1:1:2:4:1] | passed | 0.00008 seconds |
|
32
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
33
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
37
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:4:2] | passed | 0.00007 seconds |
|
38
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:5:1] | passed | 0.00008 seconds |
|
39
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:5:2] | passed | 0.00007 seconds |
|
40
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:6:1] | passed | 0.00008 seconds |
|
41
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:6:2] | passed | 0.00008 seconds |
|
34
42
|
./spec/services/companies_house_service_spec.rb[1:1:2:7:1] | passed | 0.00008 seconds |
|
35
|
-
./spec/services/companies_house_service_spec.rb[1:1:2:
|
43
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:7:2] | passed | 0.00007 seconds |
|
44
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:8:1] | passed | 0.00008 seconds |
|
45
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:8:2] | passed | 0.00008 seconds |
|
36
46
|
./spec/services/companies_house_service_spec.rb[1:1:2:9:1] | passed | 0.00009 seconds |
|
37
|
-
./spec/services/companies_house_service_spec.rb[1:1:
|
38
|
-
./spec/services/companies_house_service_spec.rb[1:1:3:
|
39
|
-
./spec/services/
|
40
|
-
./spec/services/
|
41
|
-
./spec/services/
|
42
|
-
./spec/services/
|
43
|
-
./spec/services/
|
44
|
-
./spec/services/worldpay_payment_service_spec.rb[1:1:
|
45
|
-
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:
|
46
|
-
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:
|
47
|
-
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:
|
48
|
-
./spec/services/worldpay_payment_service_spec.rb[1:1:
|
49
|
-
./spec/services/
|
50
|
-
./spec/services/
|
51
|
-
./spec/services/
|
47
|
+
./spec/services/companies_house_service_spec.rb[1:1:2:9:2] | passed | 0.00008 seconds |
|
48
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:1] | passed | 0.00009 seconds |
|
49
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:2] | passed | 0.0001 seconds |
|
50
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:3] | passed | 0.00008 seconds |
|
51
|
+
./spec/services/companies_house_service_spec.rb[1:1:3:4] | passed | 0.00008 seconds |
|
52
|
+
./spec/services/companies_house_service_spec.rb[1:1:4:1:1] | passed | 0.00009 seconds |
|
53
|
+
./spec/services/companies_house_service_spec.rb[1:1:4:2:1] | passed | 0.0001 seconds |
|
54
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:1:1] | passed | 0.00011 seconds |
|
55
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:1] | passed | 0.00031 seconds |
|
56
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:2] | passed | 0.00033 seconds |
|
57
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:3] | passed | 0.00033 seconds |
|
58
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:4] | passed | 0.00032 seconds |
|
59
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:5:1] | passed | 0.00031 seconds |
|
60
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:5:2] | passed | 0.00034 seconds |
|
61
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:5:3] | passed | 0.00041 seconds |
|
62
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:2:1:6:1] | passed | 0.00035 seconds |
|
63
|
+
./spec/services/worldpay_payment_service_spec.rb[1:1:3:1] | passed | 0.00029 seconds |
|
64
|
+
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:1] | passed | 0.00169 seconds |
|
65
|
+
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:2] | passed | 0.00205 seconds |
|
66
|
+
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:3] | passed | 0.00047 seconds |
|
52
67
|
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:4] | passed | 0.00034 seconds |
|
53
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:5] | passed | 0.
|
54
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:6] | passed | 0.
|
55
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:7] | passed | 0.
|
56
|
-
./spec/services/worldpay_refund_service_spec.rb[1:1:2:1] | passed | 0.
|
57
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:1:1] | passed | 0.
|
58
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:1:2] | passed | 0.
|
59
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:2:1] | passed | 0.
|
68
|
+
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:5] | passed | 0.00037 seconds |
|
69
|
+
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:6] | passed | 0.00036 seconds |
|
70
|
+
./spec/services/worldpay_refund_service_spec.rb[1:1:1:1:7] | passed | 0.00038 seconds |
|
71
|
+
./spec/services/worldpay_refund_service_spec.rb[1:1:2:1] | passed | 0.00072 seconds |
|
72
|
+
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:1:1] | passed | 0.00074 seconds |
|
73
|
+
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:1:2] | passed | 0.00074 seconds |
|
74
|
+
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:2:1] | passed | 0.00058 seconds |
|
60
75
|
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:2:2] | passed | 0.00074 seconds |
|
61
|
-
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:3:1] | passed | 0.
|
62
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:1] | passed | 0.
|
63
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:2] | passed | 0.
|
64
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:3] | passed | 0.
|
65
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:1:4] | passed | 0.
|
66
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:
|
67
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:2:
|
68
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:2:
|
69
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:2:
|
70
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:
|
71
|
-
./spec/services/worldpay_resource_service_spec.rb[1:1:
|
76
|
+
./spec/services/worldpay_request_handler_service_spec.rb[1:1:1:3:1] | passed | 0.00074 seconds |
|
77
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:1:1] | passed | 0.00056 seconds |
|
78
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:1:2] | passed | 0.00051 seconds |
|
79
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:1:3] | passed | 0.0005 seconds |
|
80
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:1:4] | passed | 0.00047 seconds |
|
81
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:1:5:1] | passed | 0.00048 seconds |
|
82
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:2:1] | passed | 0.00158 seconds |
|
83
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:2:2] | passed | 0.00129 seconds |
|
84
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:2:3] | passed | 0.00057 seconds |
|
85
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:2:4] | passed | 0.00053 seconds |
|
86
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:3:1] | passed | 0.00094 seconds |
|
87
|
+
./spec/services/worldpay_resource_service_spec.rb[1:1:4:1] | passed | 0.1673 seconds |
|
72
88
|
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:1] | passed | 0.00048 seconds |
|
73
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:2] | passed | 0.
|
74
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:3:1] | passed | 0.
|
75
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:3:2] | passed | 0.
|
76
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:
|
77
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:4:
|
89
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:2] | passed | 0.00061 seconds |
|
90
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:3:1] | passed | 0.00048 seconds |
|
91
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:3:2] | passed | 0.00053 seconds |
|
92
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:3:3:1] | passed | 0.00047 seconds |
|
93
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:4:1] | passed | 0.00044 seconds |
|
94
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:4:2] | passed | 0.00046 seconds |
|
78
95
|
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:5:1] | passed | 0.00048 seconds |
|
79
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:5:2] | passed | 0.
|
80
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:6:1] | passed | 0.
|
81
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:6:2] | passed | 0.
|
82
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:7:1] | passed | 0.
|
83
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:7:2] | passed | 0.
|
84
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:8:1] | passed | 0.
|
85
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:8:2] | passed | 0.
|
86
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:1] | passed | 0.
|
87
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:2] | passed | 0.
|
88
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:3:1] | passed | 0.
|
89
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:3:2] | passed | 0.
|
90
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:4:1] | passed | 0.
|
91
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:4:2] | passed | 0.
|
92
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:5:1] | passed | 0.
|
93
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:5:2] | passed | 0.
|
94
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:6:1] | passed | 0.
|
95
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:6:2] | passed | 0.
|
96
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:7:1] | passed | 0.
|
97
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:7:2] | passed | 0.
|
98
|
-
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:8:1] | passed | 0.
|
96
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:5:2] | passed | 0.00042 seconds |
|
97
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:6:1] | passed | 0.00046 seconds |
|
98
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:6:2] | passed | 0.00051 seconds |
|
99
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:7:1] | passed | 0.00044 seconds |
|
100
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:7:2] | passed | 0.00047 seconds |
|
101
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:8:1] | passed | 0.00046 seconds |
|
102
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:1:1:8:2] | passed | 0.00049 seconds |
|
103
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:1] | passed | 0.0005 seconds |
|
104
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:2] | passed | 0.0005 seconds |
|
105
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:3:1] | passed | 0.00046 seconds |
|
106
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:3:2] | passed | 0.0005 seconds |
|
107
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:4:1] | passed | 0.00046 seconds |
|
108
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:4:2] | passed | 0.00046 seconds |
|
109
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:5:1] | passed | 0.00045 seconds |
|
110
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:5:2] | passed | 0.00047 seconds |
|
111
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:6:1] | passed | 0.00048 seconds |
|
112
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:6:2] | passed | 0.00049 seconds |
|
113
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:7:1] | passed | 0.00046 seconds |
|
114
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:7:2] | passed | 0.00047 seconds |
|
115
|
+
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:8:1] | passed | 0.00052 seconds |
|
99
116
|
./spec/services/worldpay_response_service_spec.rb[1:1:2:1:8:2] | passed | 0.00056 seconds |
|
@@ -29,11 +29,20 @@ module DefraRubyMocks
|
|
29
29
|
|
30
30
|
it "returns a JSON response with a 200 code and a status that isn't 'active'" do
|
31
31
|
get "#{path}/#{company_number}"
|
32
|
-
company_status = JSON.parse(response.body)["company_status"]
|
33
32
|
|
34
33
|
expect(response.media_type).to eq("application/json")
|
35
34
|
expect(response.code).to eq("200")
|
36
|
-
expect(
|
35
|
+
expect(JSON.parse(response.body).deep_symbolize_keys).to eq(
|
36
|
+
company_name: "Acme Industries",
|
37
|
+
company_status: "dissolved",
|
38
|
+
type: "ltd",
|
39
|
+
registered_office_address: {
|
40
|
+
address_line_1: "10 Downing St",
|
41
|
+
address_line_2: "Horizon House",
|
42
|
+
locality: "Bristol",
|
43
|
+
postal_code: "BS1 5AH"
|
44
|
+
}
|
45
|
+
)
|
37
46
|
end
|
38
47
|
end
|
39
48
|
|
@@ -44,10 +53,12 @@ module DefraRubyMocks
|
|
44
53
|
it "returns a JSON response with a 200 code and a status of 'active'" do
|
45
54
|
get "#{path}/#{company_number}"
|
46
55
|
company_status = JSON.parse(response.body)["company_status"]
|
56
|
+
company_type = JSON.parse(response.body)["type"]
|
47
57
|
|
48
58
|
expect(response.media_type).to eq("application/json")
|
49
59
|
expect(response.code).to eq("200")
|
50
60
|
expect(company_status).to eq("active")
|
61
|
+
expect(company_type).to eq("ltd")
|
51
62
|
end
|
52
63
|
end
|
53
64
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails_helper"
|
4
|
+
|
5
|
+
module DefraRubyMocks
|
6
|
+
RSpec.describe "Officers", type: :request do
|
7
|
+
after(:all) { Helpers::Configuration.reset_for_tests }
|
8
|
+
|
9
|
+
let(:path) { "/defra_ruby_mocks/company/company-no/officers" }
|
10
|
+
|
11
|
+
context "when mocks are enabled" do
|
12
|
+
before(:each) { Helpers::Configuration.prep_for_tests }
|
13
|
+
|
14
|
+
it "returns a JSON response" do
|
15
|
+
get path
|
16
|
+
|
17
|
+
expect(response.media_type).to eq("application/json")
|
18
|
+
expect(response.code).to eq("200")
|
19
|
+
|
20
|
+
expect(JSON.parse(response.body).deep_symbolize_keys[:items][0]).to eq(
|
21
|
+
{
|
22
|
+
name: "APPLE, Alice",
|
23
|
+
officer_role: "director"
|
24
|
+
}
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when mocks are disabled" do
|
30
|
+
before(:all) { DefraRubyMocks.configuration.enable = false }
|
31
|
+
|
32
|
+
it "cannot load the page" do
|
33
|
+
expect { get path }.to raise_error(ActionController::RoutingError)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -24,7 +24,7 @@ module DefraRubyMocks
|
|
24
24
|
let(:data) { File.read("spec/fixtures/payment_request_valid.xml") }
|
25
25
|
|
26
26
|
it "returns an XML response with a 200 code" do
|
27
|
-
|
27
|
+
post path, headers: { "RAW_POST_DATA" => data }
|
28
28
|
|
29
29
|
expect(response.media_type).to eq("application/xml")
|
30
30
|
expect(response.code).to eq("200")
|
@@ -36,7 +36,7 @@ module DefraRubyMocks
|
|
36
36
|
let(:data) { File.read("spec/fixtures/payment_request_invalid.xml") }
|
37
37
|
|
38
38
|
it "returns a response with a 500 code" do
|
39
|
-
|
39
|
+
post path, headers: { "RAW_POST_DATA" => data }
|
40
40
|
|
41
41
|
expect(response.code).to eq("500")
|
42
42
|
end
|
@@ -48,7 +48,7 @@ module DefraRubyMocks
|
|
48
48
|
let(:data) { File.read("spec/fixtures/refund_request_valid.xml") }
|
49
49
|
|
50
50
|
it "returns an XML response with a 200 code" do
|
51
|
-
|
51
|
+
post path, headers: { "RAW_POST_DATA" => data }
|
52
52
|
|
53
53
|
expect(response.media_type).to eq("application/xml")
|
54
54
|
expect(response.code).to eq("200")
|
@@ -5,11 +5,13 @@ require "rails_helper"
|
|
5
5
|
module DefraRubyMocks
|
6
6
|
RSpec.describe CompaniesHouseService do
|
7
7
|
describe ".run" do
|
8
|
+
subject { described_class.run(company_number) }
|
9
|
+
|
8
10
|
context "when the company number is 99999999 for not found" do
|
9
11
|
let(:company_number) { "99999999" }
|
10
12
|
|
11
13
|
it "raises a NotFoundError" do
|
12
|
-
expect {
|
14
|
+
expect { subject }.to raise_error(NotFoundError)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
@@ -18,19 +20,39 @@ module DefraRubyMocks
|
|
18
20
|
|
19
21
|
specials.each do |company_number, status|
|
20
22
|
context "and the number is #{company_number}" do
|
21
|
-
|
22
|
-
|
23
|
+
let(:company_number) { company_number }
|
24
|
+
|
25
|
+
it "returns a company_status of '#{status}'" do
|
26
|
+
expect(subject.company_status).to eq(status)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns a company_type of 'ltd'" do
|
30
|
+
expect(subject.company_type).to eq("ltd")
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
36
|
+
context "when the company is an LLP" do
|
37
|
+
CompaniesHouseService.llp_company_numbers.each do |company_number|
|
38
|
+
let(:company_number) { company_number }
|
39
|
+
|
40
|
+
it "returns a company_status of 'active'" do
|
41
|
+
expect(subject.company_status).to eq("active")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "returns a company_type of 'llp'" do
|
45
|
+
expect(subject.company_type).to eq("llp")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
28
50
|
context "when the company number is not from the 'specials' list" do
|
29
51
|
context "and it is valid" do
|
30
52
|
let(:company_number) { "SC247974" }
|
31
53
|
|
32
|
-
it "returns a
|
33
|
-
expect(
|
54
|
+
it "returns a company_status of 'active'" do
|
55
|
+
expect(subject.company_status).to eq("active")
|
34
56
|
end
|
35
57
|
end
|
36
58
|
|
@@ -38,7 +60,7 @@ module DefraRubyMocks
|
|
38
60
|
let(:company_number) { "foo" }
|
39
61
|
|
40
62
|
it "raises a NotFoundError" do
|
41
|
-
expect {
|
63
|
+
expect { subject }.to raise_error(NotFoundError)
|
42
64
|
end
|
43
65
|
end
|
44
66
|
end
|
@@ -44,6 +44,14 @@ module DefraRubyMocks
|
|
44
44
|
it "returns an object with the expected company name" do
|
45
45
|
expect(described_class.run(args).company_name).to eq(company_name.downcase)
|
46
46
|
end
|
47
|
+
|
48
|
+
context "when the company name is not populated" do
|
49
|
+
let(:company_name) { nil }
|
50
|
+
|
51
|
+
it "returns the object" do
|
52
|
+
expect(described_class.run(args).resource).to eq(resource)
|
53
|
+
end
|
54
|
+
end
|
47
55
|
end
|
48
56
|
|
49
57
|
context "when the resource is a Registration" do
|
@@ -16,7 +16,7 @@ module DefraRubyMocks
|
|
16
16
|
allow(WorldpayResourceService).to receive(:run) { resource }
|
17
17
|
end
|
18
18
|
|
19
|
-
let(:resource) { double(:resource, order: order, company_name: company_name
|
19
|
+
let(:resource) { double(:resource, order: order, company_name: company_name&.downcase) }
|
20
20
|
|
21
21
|
let(:admin_code) { "admincode1" }
|
22
22
|
let(:merchant_code) { "merchantcode1" }
|
@@ -75,7 +75,6 @@ module DefraRubyMocks
|
|
75
75
|
|
76
76
|
context "and is for a successful payment" do
|
77
77
|
it "can generate a valid mac" do
|
78
|
-
puts "Test data #{mac_data.join}"
|
79
78
|
expect(described_class.run(args).mac).to eq(mac)
|
80
79
|
end
|
81
80
|
|
@@ -84,6 +83,14 @@ module DefraRubyMocks
|
|
84
83
|
|
85
84
|
expect(described_class.run(args).url).to eq(expected_response_url)
|
86
85
|
end
|
86
|
+
|
87
|
+
context "and the company name is blank" do
|
88
|
+
let(:company_name) { nil }
|
89
|
+
|
90
|
+
it "can extract the reference from the `success_url`" do
|
91
|
+
expect(described_class.run(args).reference).to eq(reference)
|
92
|
+
end
|
93
|
+
end
|
87
94
|
end
|
88
95
|
|
89
96
|
context "and is for a rejected payment" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defra_ruby_mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Defra
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- app/services/defra_ruby_mocks/worldpay_resource_service.rb
|
159
159
|
- app/services/defra_ruby_mocks/worldpay_response_service.rb
|
160
160
|
- app/views/defra_ruby_mocks/company/not_found.json.erb
|
161
|
+
- app/views/defra_ruby_mocks/company/officers.json.erb
|
161
162
|
- app/views/defra_ruby_mocks/company/show.json.erb
|
162
163
|
- app/views/defra_ruby_mocks/worldpay/payment_request.xml.erb
|
163
164
|
- app/views/defra_ruby_mocks/worldpay/refund_request.xml.erb
|
@@ -217,6 +218,7 @@ files:
|
|
217
218
|
- spec/lib/configuration_spec.rb
|
218
219
|
- spec/rails_helper.rb
|
219
220
|
- spec/requests/company_spec.rb
|
221
|
+
- spec/requests/officers_spec.rb
|
220
222
|
- spec/requests/worldpay_spec.rb
|
221
223
|
- spec/services/companies_house_service_spec.rb
|
222
224
|
- spec/services/worldpay_payment_service_spec.rb
|
@@ -235,7 +237,7 @@ homepage: https://github.com/DEFRA/defra-ruby-mocks
|
|
235
237
|
licenses:
|
236
238
|
- The Open Government Licence (OGL) Version 3
|
237
239
|
metadata: {}
|
238
|
-
post_install_message:
|
240
|
+
post_install_message:
|
239
241
|
rdoc_options: []
|
240
242
|
require_paths:
|
241
243
|
- lib
|
@@ -243,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
245
|
requirements:
|
244
246
|
- - ">="
|
245
247
|
- !ruby/object:Gem::Version
|
246
|
-
version: '
|
248
|
+
version: '2.4'
|
247
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
250
|
requirements:
|
249
251
|
- - ">="
|
@@ -251,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
253
|
version: '0'
|
252
254
|
requirements: []
|
253
255
|
rubygems_version: 3.1.2
|
254
|
-
signing_key:
|
256
|
+
signing_key:
|
255
257
|
specification_version: 4
|
256
258
|
summary: Defra Ruby on Rails external API mocking engine
|
257
259
|
test_files:
|
@@ -295,6 +297,7 @@ test_files:
|
|
295
297
|
- spec/defra_ruby_mocks_spec.rb
|
296
298
|
- spec/requests/company_spec.rb
|
297
299
|
- spec/requests/worldpay_spec.rb
|
300
|
+
- spec/requests/officers_spec.rb
|
298
301
|
- spec/support/simplecov.rb
|
299
302
|
- spec/support/pry.rb
|
300
303
|
- spec/support/helpers/helpers.rb
|