Commit graph

30 commits

Author SHA1 Message Date
Andy Allan
1700c23dd1 Prefer find_by() instead of where().first
These are very similar, differing only if we would expect multiple
results and the sorting is important. However, in all our cases
we're only expecting one result to be returned, and so find_by is
easier to read.
2023-10-04 17:53:58 +01:00
Andy Allan
0100cfe304 Use factory_bot to build new model objects 2022-01-06 10:46:38 +00:00
Tom Hughes
582402ba8f Prefer keyword arguments when method has optional boolean arguments 2020-11-13 10:22:55 +00:00
Tom Hughes
ea59d95f4a Fix some new rubocop warnings 2020-08-06 22:27:30 +01:00
Tom Hughes
7a1615bc55 Fix rubocop-minitest warnings 2020-04-15 19:07:13 +01:00
Andy Allan
ae5c364e97 Move the format tests to test the output from the controller 2019-11-13 15:21:41 +01:00
Tom Hughes
135ec35a91 Fix numericality validation to use correct integer only constraint
Fixes #2355
2019-08-22 12:14:06 +01:00
Tom Hughes
f7694a94c1 Update tests for changes in FactoryBot 5.x 2019-02-07 20:21:40 +00:00
Wil
a182820139 Resolve 96 Rubocop Lint/AmbiguousRegexpLiteral conflicts 2018-09-10 11:28:16 +08:00
Tom Hughes
b00b9ce626 Remove arguments from assert_nothing_raised
It has never done anything with the argument and rails 5.0 warns
that rails 5.1 will remove the argument.
2017-06-02 16:33:34 +01:00
Andy Allan
5d0ea28796 Remove the api_fixtures helper
This is no longer required, as the tests no longer use fixtures.
2017-06-01 10:59:48 +01:00
Andy Allan
b375050e6c Use node and relation_member factories for testing containing_relations and containing_relation_members 2017-04-05 11:33:33 +01:00
Andy Allan
4fb775d6d5 Format latitudes and longitudes as %7f in XML output
This matches the double formatting in XML from cgimap. Fixes #341.
2017-03-30 14:30:54 +01:00
Tom Hughes
8a565061e3 Add explicit tests for lat/lon methods on node models 2017-03-22 20:43:39 +00:00
Tom Hughes
b78bb9f631 Merge remote-tracking branch 'openstreetmap/pull/1496' 2017-03-22 19:19:59 +00:00
Andy Allan
1a3130ec61 Create a node factory, and use it for most node model tests 2017-03-22 17:50:10 +00:00
Andy Allan
56752ac02a Create a changeset factory, and use it for model tests. 2017-03-22 10:47:24 +00:00
Andy Allan
c6c514fce7 Take the user from the node or changeset, rather than referring to the fixture. 2017-03-09 11:29:43 +00:00
Tom Hughes
0da97d2d3c Get rid of hardwired counts in assertions 2016-12-18 16:43:58 +00:00
Andy Allan
3026af170a Replace fixtures with factory for node_tags 2016-10-30 18:28:01 +01:00
Simon Legner
6f144e8b7d Show ref of object when no name is present 2016-03-09 18:47:54 +00:00
Tom Hughes
2af0840ff3 Fix style issues found by new rubocop version 2015-04-14 09:38:24 +01:00
Tom Hughes
dc2a2c8ebd Standardise on double quoted strings 2015-02-20 19:47:26 +00:00
Tom Hughes
ef7f3d800c Fix most auto-correctable rubocop issues 2015-02-20 08:56:16 +00:00
Tom Hughes
34e3e51456 Cleanup trailing whitespace 2015-02-20 08:56:16 +00:00
Tom Hughes
316ebb7570 Don't pass ActiveRecord objects to find and exists? 2015-01-10 12:41:16 +00:00
Tom Hughes
c72940684e Fix error resolving relation parents
It's not entirely clear why specifying the foreign key explicitly
fixes this - the value given is what it should default to - but
without this it finds the child relation instead when looking at
the parents of a relation.

Fixes #789
2014-07-24 00:23:45 +01:00
Tom Hughes
a5b296a298 Qualify SCALE in tests 2014-04-27 19:19:16 +01:00
Tom Hughes
0de7fdb4df Add more tests for BrowseHelper 2014-03-01 16:02:06 +00:00
Tom Hughes
98184dfb9c Reorganise tests to match modern rails test layout 2014-02-26 00:13:19 +00:00
Renamed from test/unit/node_test.rb (Browse further)