unreliable 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2df9e50dfb3c9ec6d3775fbb8b0b93c14cacd7d713c9a6eca64a680e4bb7efb6
4
- data.tar.gz: 113aaeb8922fb31194e00d1929eb9b6cb6faf1a64890572ff63a343684ad526a
3
+ metadata.gz: '0081b3f189f7e459a112514a5c35d69bd903fbdc771b6eccd22bb53add828671'
4
+ data.tar.gz: 0a5c663105b2f774cb64eb464340e36d8c63d393234e0cb855955487800d501f
5
5
  SHA512:
6
- metadata.gz: 6d436bcdfc0b08cf2dad17b0a5a4c9cda3374eace84ed9c459253f13134d2ffac8450a10fbbad1feed1772b2136ef7046a8293c949a0834e71b2782015f61eb3
7
- data.tar.gz: da71c5004921c9328594558338f99b1d94062036281e95d3c991c608c26b3d8e6cbd0a9a66e4c28d7ddfd1dc375ac1ea8f68e60d54bc7f5764986f842f6a3eed
6
+ metadata.gz: 798bef481aad072fa47730866506a6e040d5b99dea6b71f0af5ca86921380f42713b98182c813f7da2a9a152215e9a2a35a730923f10e3e35c389a5ffa78dd68
7
+ data.tar.gz: 41d0546cf89f4bb0a2c66e98042fb6f27b4a57391ef7e0e25392a1b0a6eaa14064c6f9bd6e12915a05f8425656a62f794d48ab2ab45f08045b2ad3bfa4e79794
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## Unreliable 0.1.3 (August 21, 2022) ##
2
+
3
+ * README and minor gemspec changes.
4
+
5
+ ## Unreliable 0.1.2 (April 27, 2022) ##
6
+
7
+ * README and internal dependency changes.
8
+
9
+ ## Unreliable 0.1.1 (March 2, 2022) ##
10
+
11
+ * Internal dependency changes.
12
+
1
13
  ## Unreliable 0.1.0 (March 1, 2022) ##
2
14
 
3
15
  * Initial release.
data/README.md CHANGED
@@ -1,42 +1,111 @@
1
1
  # Unreliable
2
2
 
3
3
  ![CI workflow](https://github.com/jamiemccarthy/unreliable/actions/workflows/ci.yml/badge.svg)
4
- [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
4
+ ![Gem version](https://img.shields.io/gem/v/unreliable)
5
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
6
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa)](CODE_OF_CONDUCT.md)
5
7
 
6
- Relational databases do not guarantee the order results are returned in, unless an ORDER BY clause makes it unambiguous. However, in practice, they often happen to return the same order most of the time.
8
+ **The `unreliable` gem forces your ActiveRecord tests not to rely on ambiguous ordering. This makes your app and its tests more robust.**
7
9
 
8
- If your Rails code relies on that accidental ordering, that's a bug. And it's a bug that test suites often don't catch. Your tests may be passing accidentally.
10
+ ## Installation
9
11
 
10
- In a Rails test environment, Unreliable patches ActiveRecord to always have a final ORDER BY clause that returns results in a random order.
12
+ Add `unreliable` to your `Gemfile`'s `test` group:
11
13
 
12
- With Unreliable installed, every ActiveRecord relation invoked by the test suite will have any ambiguity replaced with randomness. Thus, tests that rely on the ordering of at least two records will typically break at least half the time.
14
+ ```ruby
15
+ # Gemfile
13
16
 
14
- If you install Unreliable and your test suite starts failing, but only sometimes, that's your cue to check which relations and scopes your tests are using that you believe to be unambiguously ordered, but actually aren't.
17
+ group :test do
18
+ gem "unreliable", "~> 0.1"
19
+ end
20
+ ```
15
21
 
16
- Unreliable does nothing outside of test environments, and there is intentionally no way to enable Unreliable in any other environment.
22
+ The next time your test suite runs, it may emit new errors and failures. If so, great!
17
23
 
18
- # Implementation
24
+ ## The problem with orders
19
25
 
20
- Unreliable patches `ActiveRecord::QueryMethods#build_arel`, the point where an Arel is converted for use, to append an order to the existing order chain. (The patch is applied after ActiveRecord loads, using `ActiveSupport.on_load`, the standard interface since Rails 4.0.)
26
+ Here's an [open secret](#references): **relational databases do not guarantee the order results are returned in, without a thorough `ORDER BY` clause.**
21
27
 
22
- This means that the ORDER BY applies to not just SELECTs but e.g. delete_all and update_all. It also applies within subqueries.
28
+ If all your ActiveRecord ordering is already unambiguous, congratulations! `unreliable` will have no effect.
23
29
 
24
- By always appending the random order, we ensure unreliable ordering for relations that have no order at all, and also for relations with an ambiguous order. For example, ordering by a non-unique column, or a combination of multiple columns which together remain non-unique.
30
+ But sometimes we think we specified an unambiguous order, but didn't. Maybe we ordered on timestamps, which are usually unique but sometimes not. And the test suite will stay silent as long as our database just happens to return the same order.
25
31
 
26
- The patch is only applied when `Rails.env.test?`, and that boolean is also checked on every invocation to make certain it has no effect in any other environment.
32
+ If ambiguous ordering is fine for your app's purposes, but your tests rely on a specific order, that's a bug in your tests. Your tests are incorrectly failing -- rarely -- which can be confusing and annoying.
27
33
 
28
- `Unreliable::Config.disable do ... end` will turn it off for a block.
34
+ Or, if your Rails code relies on that accidental ordering, that's a bug in your app. Your tests are passing when they should be failing.
29
35
 
30
- # Fun trivia
36
+ In both cases, `unreliable` exposes the problem by making those tests fail most of the time.
31
37
 
32
- There are other ways you can order a relation but still have your query be ambiguous!
38
+ ## Fixing the new failures
33
39
 
34
- * ORDER BY a column with values that differ only by [character case](https://dev.mysql.com/doc/refman/8.0/en/sorting-rows.html),
35
- * ORDER BY values that are identical within the [prefix length limit](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_sort_length) examined for sorting
40
+ When `unreliable` turns up a new test failure, you fix it in one of two ways. Either relax your test so it stops relying on order, or tighten up your app to specify order rigorously. (In my company's app, it was about 50/50.)
36
41
 
37
- `unreliable` correctly tests these because the random order is always appended.
42
+ ### Relax a test
43
+
44
+ Take a look at what your test is checking. If you're testing a method or an endpoint that returns a list whose order doesn't matter, you may have written it to expect the order that was returned the first time you ran it. This often happens with fixtures. You might:
45
+
46
+ * Make your test accept all correct answers. For example, sort an array in the method's response before comparing.
47
+
48
+ * Help your test suite focus on what you're testing. If your fixtures' "latest" element could change because they don't specify a timestamp, that might be a distraction that's not relevant to how your app works, so you could assign timestamps to the fixtures.
49
+
50
+ This makes your test suite more robust.
51
+
52
+ If your test suite is checking generated `.to_sql` against known-good SQL text, `unreliable` isn't helpful. It's easiest to use `Unreliable::Config.disable { ... }` to turn it off for a block.
53
+
54
+ ### Tighten the app
55
+
56
+ If your app should be returning results in a particular order, and now with `unreliable` it sometimes does not, your test is correct and your app is wrong. Specify order rigorously in your app.
57
+
58
+ Maybe you're testing `Book.reverse_chron.first`, and you've defined that ordering this way:
59
+
60
+ ```
61
+ class Book
62
+ scope :reverse_chron, -> { order(year_published: :desc) }
63
+ end
64
+ ```
65
+
66
+ When you meant to define it unambiguously:
67
+
68
+ ```
69
+ scope :reverse_chron, -> { order(year_published: :desc, title: :desc) }
70
+ ```
71
+
72
+ Or, if `title` is not unique:
73
+
74
+ ```
75
+ scope :reverse_chron, -> { order(year_published: :desc, title: :desc, id: :desc) }
76
+ ```
77
+
78
+ The problem in this example is easy to see because many books are published each year. But this error can occur at any time granularity.
79
+
80
+ ## Requirements
81
+
82
+ `unreliable` is tested to support Ruby 2.6 through 3.1, and Rails 5.0 through 7.0.
38
83
 
39
- # Testing
84
+ As of August 2022, this is all released versions of both that are currently supported, plus several older releases.
85
+
86
+ `unreliable` depends only on ActiveRecord and Railties. If you have a non-Rails app that uses ActiveRecord, you can still use it.
87
+
88
+ ## Implementation
89
+
90
+ `unreliable` does exactly nothing outside of test environments. There is intentionally no way to enable `unreliable` in production, and there never will be.
91
+
92
+ In a Rails test environment, `unreliable` patches ActiveRecord to always append a final `ORDER BY` clause that returns results in a random order.
93
+
94
+ Because it's appended, the existing ordering is not affected unless it is ambiguous.
95
+
96
+ With `unreliable` installed, every ActiveRecord relation invoked by the test suite will have any ambiguity replaced with randomness. Tests that rely on the ordering of two records will break half the time. Tests with three or more break most of the time.
97
+
98
+ `unreliable` patches `ActiveRecord::QueryMethods#build_arel`, the point where an Arel is converted for use, to append an order to the existing order chain. (The patch is applied after ActiveRecord loads, using `ActiveSupport.on_load`, the standard interface since Rails 4.0.) It works with MySQL, Postgres, and SQLite.
99
+
100
+ This means that the `ORDER BY` applies to not just `SELECT` but e.g. `delete_all` and `update_all`. It also applies within subqueries.
101
+
102
+ The patch is only applied when `Rails.env.test?`, and that boolean is also checked on every invocation, just to make certain it has no effect in any other environment.
103
+
104
+ ## Contributing
105
+
106
+ Thoughts and suggestions are welcome. Please read the code of conduct, then create an issue or pull request on GitHub. If you just have questions, go ahead and open an issue, I'm pretty friendly.
107
+
108
+ ### Run the gem's tests
40
109
 
41
110
  To test locally, against the different versions of ActiveRecord, use Ruby 2.7, the only version currently compatible with all the ActiveRecord versions supported. Install the required gems with:
42
111
 
@@ -46,7 +115,13 @@ bundle install
46
115
  bundle exec appraisal install
47
116
  ```
48
117
 
49
- Then you can run the tests with:
118
+ Run `unreliable`'s linter with:
119
+
120
+ ```
121
+ bundle exec standardrb
122
+ ```
123
+
124
+ Then you can run `unreliable`'s tests with:
50
125
 
51
126
  ```
52
127
  bundle exec appraisal rake
@@ -54,44 +129,62 @@ bundle exec appraisal rake
54
129
 
55
130
  Appraisal ensures the tests run against every compatible minor version of ActiveRecord.
56
131
 
57
- The GitHub CI workflow in `.github/` ensures those tests are also run against against every compatible minor version of Ruby.
132
+ The GitHub CI workflow in `.github/` ensures those tests are also run against against every compatible minor version of Ruby. Your PR won't trigger my GitHub project's workflow, but you're welcome to run your own, or ask me to run mine manually.
58
133
 
59
- Testing against ActiveRecord is done with [Combustion](https://github.com/pat/combustion), which stands up a local single-table SQLite database and an ActiveRecord-based model for it. This gives us more reliable coverage than mocking unit tests within ActiveRecord itself.
134
+ Testing against ActiveRecord is done with [Combustion](https://github.com/pat/combustion), which stands up a local single-table SQLite database and an ActiveRecord-based model for it. This gives more reliable coverage than mocking unit tests within ActiveRecord itself.
60
135
 
61
- Some initial testing was done against a small but real Rails app locally, which looked like this (I mention this for historical interest only):
136
+ ### Experiment
62
137
 
138
+ If you'd like to see `unreliable` in action on a small but real Rails app locally, you can do this:
139
+
140
+ 1. In a directory next to your `unreliable` working directory, create a `.ruby-version` of `2.7.6` and a 2-line `Gemfile`: `source "https://rubygems.org"`, `gem "rails", "~> 7.0"`
141
+ 2. `bundle install && bundle exec rails new . --force`
142
+ 3. `echo 'gem "unreliable", path: "../unreliable"' >> Gemfile`
143
+ 4. `bundle install && bundle exec rails generate model post title:string body:text`
144
+ 5. `RAILS_ENV=test bundle exec rails db:migrate`
145
+ 6. `RAILS_ENV=test bundle exec rails c`
146
+ 7. You should see SQLite's `ORDER BY RANDOM()` in ActiveRecord queries:
147
+
148
+ ```
149
+ irb(main):001:0> Post.where(title: "abc")
150
+ (2.1ms) SELECT sqlite_version(*)
151
+ Post Load (0.3ms) SELECT "posts".* FROM "posts" WHERE "posts"."title" = ? ORDER BY RANDOM() [["title", "abc"]]
152
+ => []
153
+ irb(main):002:0> Post.limit(5).delete_all
154
+ Post Delete All (0.2ms) DELETE FROM "posts" WHERE "posts"."id" IN (SELECT "posts"."id" FROM "posts" ORDER BY RANDOM() LIMIT ?) [["LIMIT", 5]]
155
+ => 0
63
156
  ```
64
- Start with 1-line Gemfile `gem "rails", "~> x.y"`, bundle install, then
65
157
 
66
- $ bundle exec rails new . --skip-javascript --skip-webpack-install --skip-sprockets --skip-turbolinks --skip-jbuilder --skip-spring
158
+ ## Ordering trivia
67
159
 
68
- Add to Gemfile test block: gem "unreliable", path: "../unreliable", bundle install again
160
+ The most common ambiguous ordering is an ORDER BY one column that is not unique, like a timestamp.
69
161
 
70
- $ bundle exec rails generate model post title:string body:text
71
- $ RAILS_ENV=test bundle exec rails db:migrate
72
- $ RAILS_ENV=test bundle exec rails c
73
- Loading test environment (Rails 7.0.1)
74
- 3.0.1 :001 > puts Post.where(title: "abc").to_sql
75
- (0.7ms) SELECT sqlite_version(*)
76
- SELECT "posts".* FROM "posts" WHERE "posts"."title" = 'abc' ORDER BY RAND()
77
- ```
162
+ But there are other ways you can order a relation but still have your query be ambiguous:
163
+
164
+ * ORDER BY multiple columns, but with no subset which is unique
165
+ * ORDER BY a column with values that differ only by [character case](https://dev.mysql.com/doc/refman/8.0/en/sorting-rows.html)
166
+ * ORDER BY values that are identical within the [prefix length limit](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_sort_length) examined for sorting
167
+
168
+ `unreliable` correctly tests these because the random order is always appended.
169
+
170
+ ## References
78
171
 
79
- # Development
172
+ SQL standard ([SQL-92](https://web.archive.org/web/20220730144627/https://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt)):
80
173
 
81
- When it's necessary to add new minor versions of ActiveRecord or Ruby, update the Appraisals file and run `bundle exec appraisal update` as well as the install, and update the matrix in the ci.yml workflow.
174
+ > When the ordering of a cursor is partially determined by an _order by clause_, then the relative positions of two rows are determined only by the _order by clause_; if the two rows have equal values for the purpose of evaluating the _order by clause_, then their relative positions are implementation-dependent.
82
175
 
83
- # Contributing
176
+ MySQL ([5.6](https://dev.mysql.com/doc/refman/5.6/en/limit-optimization.html), [5.7](https://dev.mysql.com/doc/refman/5.7/en/limit-optimization.html), [8.0](https://dev.mysql.com/doc/refman/8.0/en/limit-optimization.html)):
84
177
 
85
- Thoughts and suggestions are welcome. Please read the code of conduct, then create an issue or pull request on GitHub.
178
+ > If multiple rows have identical values in the `ORDER BY` columns, the server is free to return those rows in any order, and may do so differently depending on the overall execution plan. In other words, the sort order of those rows is nondeterministic with respect to the nonordered columns.
86
179
 
87
- Future work I'd like to see done includes:
180
+ Postgres ([12](https://www.postgresql.org/docs/12/sql-select.html#SQL-ORDERBY), [13](https://www.postgresql.org/docs/13/sql-select.html#SQL-ORDERBY), [14](https://www.postgresql.org/docs/14/sql-select.html#SQL-ORDERBY)):
88
181
 
89
- * Moving to containerized testing, so the test suite can cover MySQL and Postgres.
182
+ > If two rows are equal according to the leftmost expression, they are compared according to the next expression and so on. If they are equal according to all specified expressions, they are returned in an implementation-dependent order.
90
183
 
91
- * Addressing the deprecation warnings in the test suite for ActiveRecord 5.x. There are two: SQLite 1.3 warning of incompatibility with Ruby 3.2 (which is irrelevant since Rails 5 won't run on Ruby 3.2 and Rails 6 requires SQLite 1.4). And: `DEPRECATION WARNING: Leaving ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer set to false is deprecated.`
184
+ SQLite ([3.39](https://www.sqlite.org/lang_select.html#the_order_by_clause)):
92
185
 
93
- * I'd love to see if there is a way to patch test blocks to run them multiple times with different orders (pk asc, desc, rand). It's hard to see a clean way to do this with a BEGIN/ROLLBACK but maybe it's possible. I doubt there is one simple bottleneck for this in RSpec but I haven't looked into it. By nature this gem makes testing nondeterministic, and if there's a way to actually run queries multiple ways, that would be slower but more comprehensive. On the other hand, if a test suite only defines one fixture item, neither this improvement nor the current state of this gem can catch ordering issues.
186
+ > The order in which two rows for which all ORDER BY expressions evaluate to equal values are returned is undefined.
94
187
 
95
- # See also
188
+ ## See also
96
189
 
97
190
  [chaotic_order](https://rubygems.org/gems/chaotic_order)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unreliable
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.3"
5
5
  end
data/spec/examples.txt CHANGED
@@ -1,14 +1,14 @@
1
1
  example_id | status | run_time |
2
2
  ---------------------------------- | ------ | --------------- |
3
- ./spec/env_spec.rb[1:1] | passed | 0.00296 seconds |
4
- ./spec/env_spec.rb[1:2] | passed | 0.00045 seconds |
5
- ./spec/model_select_spec.rb[1:1] | passed | 0.00056 seconds |
6
- ./spec/model_select_spec.rb[1:2] | passed | 0.00084 seconds |
7
- ./spec/model_select_spec.rb[1:3] | passed | 0.00077 seconds |
8
- ./spec/model_select_spec.rb[1:4] | passed | 0.00077 seconds |
9
- ./spec/model_subquery_spec.rb[1:1] | passed | 0.00145 seconds |
10
- ./spec/model_update_spec.rb[1:1] | passed | 0.00013 seconds |
11
- ./spec/railtie_spec.rb[1:1] | passed | 0.00073 seconds |
12
- ./spec/railtie_spec.rb[1:2] | passed | 0.00019 seconds |
13
- ./spec/version_spec.rb[1:1] | passed | 0.00128 seconds |
14
- ./spec/version_spec.rb[1:2] | passed | 0.00015 seconds |
3
+ ./spec/env_spec.rb[1:1] | passed | 0.00261 seconds |
4
+ ./spec/env_spec.rb[1:2] | passed | 0.00042 seconds |
5
+ ./spec/model_select_spec.rb[1:1] | passed | 0.00033 seconds |
6
+ ./spec/model_select_spec.rb[1:2] | passed | 0.0005 seconds |
7
+ ./spec/model_select_spec.rb[1:3] | passed | 0.00042 seconds |
8
+ ./spec/model_select_spec.rb[1:4] | passed | 0.00064 seconds |
9
+ ./spec/model_subquery_spec.rb[1:1] | passed | 0.00135 seconds |
10
+ ./spec/model_update_spec.rb[1:1] | passed | 0.00011 seconds |
11
+ ./spec/railtie_spec.rb[1:1] | passed | 0.00064 seconds |
12
+ ./spec/railtie_spec.rb[1:2] | passed | 0.00014 seconds |
13
+ ./spec/version_spec.rb[1:1] | passed | 0.00116 seconds |
14
+ ./spec/version_spec.rb[1:2] | passed | 0.00016 seconds |
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unreliable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James McCarthy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-02 00:00:00.000000000 Z
11
+ date: 2022-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: railties
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +37,9 @@ dependencies:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: '5.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '8.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +47,9 @@ dependencies:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
49
  version: '5.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '8.0'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: appraisal
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -96,46 +108,18 @@ dependencies:
96
108
  version: '13.0'
97
109
  - !ruby/object:Gem::Dependency
98
110
  name: rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.25'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.25'
125
- - !ruby/object:Gem::Dependency
126
- name: simplecov
127
111
  requirement: !ruby/object:Gem::Requirement
128
112
  requirements:
129
113
  - - "~>"
130
114
  - !ruby/object:Gem::Version
131
- version: '0.21'
115
+ version: '3.0'
132
116
  type: :development
133
117
  prerelease: false
134
118
  version_requirements: !ruby/object:Gem::Requirement
135
119
  requirements:
136
120
  - - "~>"
137
121
  - !ruby/object:Gem::Version
138
- version: '0.21'
122
+ version: '3.0'
139
123
  - !ruby/object:Gem::Dependency
140
124
  name: sqlite3
141
125
  requirement: !ruby/object:Gem::Requirement
@@ -156,41 +140,28 @@ dependencies:
156
140
  requirements:
157
141
  - - "~>"
158
142
  - !ruby/object:Gem::Version
159
- version: '1.7'
143
+ version: '1.11'
160
144
  type: :development
161
145
  prerelease: false
162
146
  version_requirements: !ruby/object:Gem::Requirement
163
147
  requirements:
164
148
  - - "~>"
165
149
  - !ruby/object:Gem::Version
166
- version: '1.7'
150
+ version: '1.11'
167
151
  description: |
168
152
  Unreliable helps uncover bugs in Rails apps that rely on ambiguous database ordering.
169
- With it installed, a test suite is less likely to accidentally succeed.
153
+ Installing it makes both your app and your test suite more robust.
170
154
  email: jamie@mccarthy.vg
171
155
  executables: []
172
156
  extensions: []
173
157
  extra_rdoc_files: []
174
158
  files:
175
- - Appraisals
176
159
  - CHANGELOG.md
177
160
  - CODE_OF_CONDUCT.md
178
161
  - Gemfile
179
162
  - LICENSE
180
163
  - README.md
181
164
  - Rakefile
182
- - gemfiles/activerecord_5.0.gemfile
183
- - gemfiles/activerecord_5.0.gemfile.lock
184
- - gemfiles/activerecord_5.1.gemfile
185
- - gemfiles/activerecord_5.1.gemfile.lock
186
- - gemfiles/activerecord_5.2.gemfile
187
- - gemfiles/activerecord_5.2.gemfile.lock
188
- - gemfiles/activerecord_6.0.gemfile
189
- - gemfiles/activerecord_6.0.gemfile.lock
190
- - gemfiles/activerecord_6.1.gemfile
191
- - gemfiles/activerecord_6.1.gemfile.lock
192
- - gemfiles/activerecord_7.0.gemfile
193
- - gemfiles/activerecord_7.0.gemfile.lock
194
165
  - lib/unreliable.rb
195
166
  - lib/unreliable/build_order.rb
196
167
  - lib/unreliable/config.rb
@@ -228,5 +199,5 @@ requirements: []
228
199
  rubygems_version: 3.1.6
229
200
  signing_key:
230
201
  specification_version: 4
231
- summary: Randomize relation final order for tests
202
+ summary: For ActiveRecord tests, surface ambiguous-ordering bugs
232
203
  test_files: []
data/Appraisals DELETED
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # The appraisal gem seems to be a convenient way to use this small config file to
4
- # build the gemfiles/* for the GitHub CI matrix.
5
- # Any `bundle update/install` should be accompanied by `bundle exec appraisal update/install`
6
-
7
- appraise "activerecord-5.0" do
8
- gem "activerecord", "~> 5.0.0"
9
- gem "sqlite3", "~> 1.3.6"
10
- end
11
-
12
- appraise "activerecord-5.1" do
13
- gem "activerecord", "~> 5.1.0"
14
- gem "sqlite3", "~> 1.3.6"
15
- end
16
-
17
- appraise "activerecord-5.2" do
18
- gem "activerecord", "~> 5.2.0"
19
- gem "sqlite3", "~> 1.3.6"
20
- end
21
-
22
- appraise "activerecord-6.0" do
23
- gem "activerecord", "~> 6.0.0"
24
- end
25
-
26
- appraise "activerecord-6.1" do
27
- gem "activerecord", "~> 6.1.0"
28
- end
29
-
30
- appraise "activerecord-7.0" do
31
- gem "activerecord", "~> 7.0.0"
32
- end
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.0.0"
6
- gem "sqlite3", "~> 1.3.6"
7
-
8
- gemspec path: "../"
@@ -1,143 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- unreliable (0.1.0)
5
- activerecord (>= 5.0)
6
- railties (>= 5.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionpack (5.0.7.2)
12
- actionview (= 5.0.7.2)
13
- activesupport (= 5.0.7.2)
14
- rack (~> 2.0)
15
- rack-test (~> 0.6.3)
16
- rails-dom-testing (~> 2.0)
17
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
- actionview (5.0.7.2)
19
- activesupport (= 5.0.7.2)
20
- builder (~> 3.1)
21
- erubis (~> 2.7.0)
22
- rails-dom-testing (~> 2.0)
23
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
- activemodel (5.0.7.2)
25
- activesupport (= 5.0.7.2)
26
- activerecord (5.0.7.2)
27
- activemodel (= 5.0.7.2)
28
- activesupport (= 5.0.7.2)
29
- arel (~> 7.0)
30
- activesupport (5.0.7.2)
31
- concurrent-ruby (~> 1.0, >= 1.0.2)
32
- i18n (>= 0.7, < 2)
33
- minitest (~> 5.1)
34
- tzinfo (~> 1.1)
35
- appraisal (2.4.1)
36
- bundler
37
- rake
38
- thor (>= 0.14.0)
39
- arel (7.1.4)
40
- ast (2.4.2)
41
- builder (3.2.4)
42
- combustion (1.3.5)
43
- activesupport (>= 3.0.0)
44
- railties (>= 3.0.0)
45
- thor (>= 0.14.6)
46
- concurrent-ruby (1.1.9)
47
- crass (1.0.6)
48
- diff-lcs (1.5.0)
49
- docile (1.4.0)
50
- erubis (2.7.0)
51
- i18n (1.10.0)
52
- concurrent-ruby (~> 1.0)
53
- loofah (2.14.0)
54
- crass (~> 1.0.2)
55
- nokogiri (>= 1.5.9)
56
- method_source (1.0.0)
57
- minitest (5.15.0)
58
- nokogiri (1.13.3-x86_64-linux)
59
- racc (~> 1.4)
60
- parallel (1.21.0)
61
- parser (3.1.1.0)
62
- ast (~> 2.4.1)
63
- racc (1.6.0)
64
- rack (2.2.3)
65
- rack-test (0.6.3)
66
- rack (>= 1.0)
67
- rails-dom-testing (2.0.3)
68
- activesupport (>= 4.2.0)
69
- nokogiri (>= 1.6)
70
- rails-html-sanitizer (1.4.2)
71
- loofah (~> 2.3)
72
- railties (5.0.7.2)
73
- actionpack (= 5.0.7.2)
74
- activesupport (= 5.0.7.2)
75
- method_source
76
- rake (>= 0.8.7)
77
- thor (>= 0.18.1, < 2.0)
78
- rainbow (3.1.1)
79
- rake (13.0.6)
80
- regexp_parser (2.2.1)
81
- rexml (3.2.5)
82
- rspec (3.11.0)
83
- rspec-core (~> 3.11.0)
84
- rspec-expectations (~> 3.11.0)
85
- rspec-mocks (~> 3.11.0)
86
- rspec-core (3.11.0)
87
- rspec-support (~> 3.11.0)
88
- rspec-expectations (3.11.0)
89
- diff-lcs (>= 1.2.0, < 2.0)
90
- rspec-support (~> 3.11.0)
91
- rspec-mocks (3.11.0)
92
- diff-lcs (>= 1.2.0, < 2.0)
93
- rspec-support (~> 3.11.0)
94
- rspec-support (3.11.0)
95
- rubocop (1.25.1)
96
- parallel (~> 1.10)
97
- parser (>= 3.1.0.0)
98
- rainbow (>= 2.2.2, < 4.0)
99
- regexp_parser (>= 1.8, < 3.0)
100
- rexml
101
- rubocop-ast (>= 1.15.1, < 2.0)
102
- ruby-progressbar (~> 1.7)
103
- unicode-display_width (>= 1.4.0, < 3.0)
104
- rubocop-ast (1.16.0)
105
- parser (>= 3.1.1.0)
106
- rubocop-performance (1.13.2)
107
- rubocop (>= 1.7.0, < 2.0)
108
- rubocop-ast (>= 0.4.0)
109
- ruby-progressbar (1.11.0)
110
- simplecov (0.21.2)
111
- docile (~> 1.1)
112
- simplecov-html (~> 0.11)
113
- simplecov_json_formatter (~> 0.1)
114
- simplecov-html (0.12.3)
115
- simplecov_json_formatter (0.1.4)
116
- sqlite3 (1.3.13)
117
- standard (1.7.2)
118
- rubocop (= 1.25.1)
119
- rubocop-performance (= 1.13.2)
120
- thor (1.2.1)
121
- thread_safe (0.3.6)
122
- tzinfo (1.2.9)
123
- thread_safe (~> 0.1)
124
- unicode-display_width (2.1.0)
125
-
126
- PLATFORMS
127
- x86_64-linux
128
-
129
- DEPENDENCIES
130
- activerecord (~> 5.0.0)
131
- appraisal (~> 2.4)
132
- bundler (~> 2.1)
133
- combustion (~> 1.3)
134
- rake (~> 13.0)
135
- rspec
136
- rubocop (~> 1.25)
137
- simplecov (~> 0.21)
138
- sqlite3 (~> 1.3.6)
139
- standard (~> 1.7)
140
- unreliable!
141
-
142
- BUNDLED WITH
143
- 2.3.8
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.1.0"
6
- gem "sqlite3", "~> 1.3.6"
7
-
8
- gemspec path: "../"