Commit Graph

23653 Commits

Author SHA1 Message Date
Maikel Linke
b89715149c Sanitise pagination input for new API 2022-03-02 11:59:35 +11:00
Maikel Linke
75fc35574e Make json_response test helper deal with error response
It raised an error:

     NoMethodError:
       undefined method `map' for nil:NilClass
2022-03-02 11:59:35 +11:00
Maikel Linke
414bf5d074 Don't list guest customer records to guest users 2022-03-02 11:59:35 +11:00
Matt-Yorkley
bd9bed7323 Update schemas for relationships 2022-03-02 11:59:35 +11:00
Matt-Yorkley
2e59812bc1 Refactor to make more use of schema refs, and regenerate swagger file 2022-03-02 11:59:33 +11:00
Matt-Yorkley
d87e1805af Add relationships to resource serializers 2022-03-02 11:58:04 +11:00
Matt-Yorkley
d66d6d6bd6 Update use of links on relationships 2022-03-02 11:58:04 +11:00
Matt-Yorkley
3dbf00f302 Add pagination with Pagy using structure from JSON:API specification
https://jsonapi.org/examples/#pagination

Update schema for collections rendered with pagination data
2022-03-02 11:58:04 +11:00
Matt-Yorkley
c102ce8e7e Add RequestTimeout concern 2022-03-02 11:58:04 +11:00
Matt-Yorkley
8e61428cce Add 401 Unauthorized response test 2022-03-02 11:58:04 +11:00
Matt-Yorkley
a222b507fb Update and document authentication methods 2022-03-02 11:58:04 +11:00
Matt-Yorkley
56bc554f29 Regenerate swagger docs with rails rswag 2022-03-02 11:57:57 +11:00
Matt-Yorkley
028d02ccca Test serialized relationship data 2022-03-02 11:55:46 +11:00
Matt-Yorkley
46f9d3ef81 Test permissions combined with Ransack searches 2022-03-02 11:55:46 +11:00
Matt-Yorkley
76f14a03c6 Add specs and JSON schemas
Include test helpers
2022-03-02 11:55:46 +11:00
Matt-Yorkley
39f4feed4a Generate docs with rails rswag 2022-03-02 11:55:46 +11:00
Matt-Yorkley
cc4192047e Fill out customers controller
Add customer serializer
2022-03-02 11:55:46 +11:00
Matt-Yorkley
3128232d7e Create customers controller
And add new customers routes.

Disable them in production for now.
2022-03-02 11:55:46 +11:00
Matt-Yorkley
c4e2c8cb4c Tidy up error handling and update response formats for JSON:API standard
Update translation key namespacing
2022-03-02 11:55:46 +11:00
Matt-Yorkley
7d8ded5ab8 Bring simplified / cleaned up base controller into V1
- Inherits from ActionController::API
- Lots of superfluous junk removed
2022-03-02 11:55:46 +11:00
Maikel
9a8082e35c Merge pull request #8947 from openfoodfoundation/dependabot/npm_and_yarn/karma-6.3.17
Bump karma from 6.3.16 to 6.3.17
2022-03-02 11:27:28 +11:00
dependabot[bot]
f573423d3a Bump karma from 6.3.16 to 6.3.17
Bumps [karma](https://github.com/karma-runner/karma) from 6.3.16 to 6.3.17.
- [Release notes](https://github.com/karma-runner/karma/releases)
- [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma/compare/v6.3.16...v6.3.17)

---
updated-dependencies:
- dependency-name: karma
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 09:05:25 +00:00
Filipe
d052c4f8a4 Merge pull request #8869 from filipefurtad0/remove_signup_string
Removes signup string from private shop login screen
2022-03-01 08:20:06 +00:00
Maikel
c44de8dbb3 Merge pull request #8937 from openfoodfoundation/dependabot/npm_and_yarn/url-parse-1.5.10
Bump url-parse from 1.5.7 to 1.5.10
2022-03-01 11:26:43 +11:00
Filipe
1338bcbf57 Merge pull request #8939 from filipefurtad0/stock_spec_checkout_split
Checks stock restrictions on checkout split (system spec)
2022-02-28 16:42:58 +00:00
Filipe
d84b6ce2ad Merge pull request #8772 from filipefurtad0/add_specs_split_checkout_payment
[Split Checkout] Adds tests on payments
2022-02-28 16:42:12 +00:00
jibees
eeae67e2d0 Merge pull request #8935 from mkllnk/clean-rubocop
Relax our style guide
2022-02-28 15:16:46 +01:00
Filipe
499ad982c3 Merge pull request #8938 from filipefurtad0/controller_spec_checkout_split
Adds controller coverage for stock restrictions on split checkout
2022-02-28 10:32:46 +00:00
filipefurtad0
f6304892c2 Adds controller coverage for stock restrictions 2022-02-27 22:01:48 +00:00
filipefurtad0
7a6f3d67e2 Implements shared example; Checks stock restriction on payment step 2022-02-27 21:51:03 +00:00
filipefurtad0
eb56027505 Moves out-of-stock block within correct context 2022-02-27 19:56:45 +00:00
dependabot[bot]
f0cd9de1c3 Bump url-parse from 1.5.7 to 1.5.10
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.7 to 1.5.10.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.7...1.5.10)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-26 14:40:40 +00:00
Matt-Yorkley
50ab0731d7 Bump nokogiri to 1.13.2 v4.1.20 2022-02-26 14:39:56 +00:00
filipefurtad0
82b6d39191 Re-names payment; addresses style issues 2022-02-25 16:06:26 +00:00
filipefurtad0
daffe333c5 Adds coverage on order completition for Cash/Paypal 2022-02-25 16:06:26 +00:00
filipefurtad0
c4bf36d402 Adds Stripe SCA to shared examples block 2022-02-25 16:06:26 +00:00
filipefurtad0
d336ab52a1 Adds Paypal to shared examples block 2022-02-25 16:06:26 +00:00
filipefurtad0
ae3eb90668 Adds shared examples block, with cash 2022-02-25 16:06:26 +00:00
filipefurtad0
09cd9b8462 Adds a test on payment method requirement 2022-02-25 16:06:26 +00:00
filipefurtad0
9449c7c919 Adds a context for existing test case 2022-02-25 16:06:26 +00:00
filipefurtad0
9dceda7e20 Creates a details test block; moves respective tests inside 2022-02-25 16:06:26 +00:00
Maikel Linke
e6b4f462ef Revert "Add rubocop config to allow specs to be 300 lines long"
This reverts commit 0b51d8b297.

I think that this config was complicated in the setup and potentially
confusing to have different rules in different places.

It's better to fix those spec files by either making them smaller or
removing the `module` block in the spec. We can reference the modules
explicitely where needed.
2022-02-25 12:05:04 +11:00
Maikel Linke
cee6a0f17f Declare blocklength rules as agreed upon
The acceptance of this pull request will be the "agree" part. :-)
2022-02-25 11:57:43 +11:00
Maikel Linke
7acae6522b Relax cyclomatic complexity to community default
Why should we be more strict than the rest of the world?
2022-02-25 11:56:33 +11:00
Maikel Linke
2d1e746c64 Remove default values from contested settings
We can just use what the Rubocop community uses as default and we don't
need to spell it out again.
2022-02-25 11:51:35 +11:00
Maikel Linke
3382c1d0bb Relax some contested metrics rules
Rubocop often complains while we think that the code is totally fine. I
would like to achieve the default values one day but there are more
important issues at the moment.
2022-02-25 11:45:15 +11:00
Maikel Linke
0c89479de4 Update rubocop todo list 2022-02-25 11:05:36 +11:00
Maikel Linke
b999673dfc Remove old version of relaxed styled guide
We had an old version under "contested settings" and it looks like some
of them were modified. I hope that our new, separate file will
discourage manual tweaks.

We can include the relaxed rules from a gem as well. Let's see if we
need that complexity one day.
2022-02-25 10:51:54 +11:00
Maikel Linke
1d15f35522 Remove now unnecessary inline rubocop config 2022-02-25 10:46:51 +11:00
Maikel Linke
decab911bd Use relaxed Rubocop styleguide as basis
We then refine it with our own rules.
2022-02-25 10:44:32 +11:00