rspec-sqlimit 0.0.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- metadata +8 -47
- data/.github/gemfiles/rails_4.2.gemfile +0 -16
- data/.github/gemfiles/rails_6.0.gemfile +0 -16
- data/.github/gemfiles/rails_7.1.gemfile +0 -16
- data/.github/workflows/check.yml +0 -64
- data/.github/workflows/release.yml +0 -15
- data/.gitignore +0 -17
- data/.rspec +0 -3
- data/.rubocop.yml +0 -38
- data/Gemfile +0 -16
- data/Rakefile +0 -12
- data/rspec-sqlimit.gemspec +0 -18
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/models/user.rb +0 -3
- data/spec/dummy/config/application.rb +0 -10
- data/spec/dummy/config/database.yml +0 -12
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config.ru +0 -0
- data/spec/dummy/db/migrate/20170211104800_create_users.rb +0 -5
- data/spec/dummy/db/schema.rb +0 -4
- data/spec/rspec/sqlimit/reporter_spec.rb +0 -74
- data/spec/rspec/sqlimit_spec.rb +0 -49
- data/spec/spec_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a12eaeb4ffd02e07ab3b5dbd6b7491a0f0198a49adcd97ce1c710f326f104b57
|
4
|
+
data.tar.gz: 32bc1dc6eeb7fbd854c830a3cebdd3fa297d1e2fd8c7d641e5c9b8fcac93c0af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db1e68306ed17a5dd02786ab19bcfcbd69ceec78bd27b1b116a69a61c9ec21830b86261f9e378bbd27225dd3df140d61704d08e39c19a5c977fe197c2727dcbf
|
7
|
+
data.tar.gz: 9bd174fe74bf0dcba9078d0fe7613900bc86453926a0dcdc6daecca5cf1d9ce7448142285eea5a7c808c2f2e2962ea1e6bac8b841949d12df1a3332e0974b9c9
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
## [1.0.0] - [2025-03-06]
|
9
|
+
- Support Rails 8+. (@palkan)
|
10
|
+
|
8
11
|
## [0.0.6] - [2023-10-06]
|
9
12
|
- Support of Rails 7+ (@terracatta)
|
10
13
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-sqlimit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin (nepalez)
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.2.0
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '8'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +24,6 @@ dependencies:
|
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 4.2.0
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '8'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rspec
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,7 +38,7 @@ dependencies:
|
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: '3.0'
|
47
|
-
description:
|
41
|
+
description:
|
48
42
|
email: andrew.kozin@gmail.com
|
49
43
|
executables: []
|
50
44
|
extensions: []
|
@@ -52,40 +46,18 @@ extra_rdoc_files:
|
|
52
46
|
- README.md
|
53
47
|
- CHANGELOG.md
|
54
48
|
files:
|
55
|
-
- ".github/gemfiles/rails_4.2.gemfile"
|
56
|
-
- ".github/gemfiles/rails_6.0.gemfile"
|
57
|
-
- ".github/gemfiles/rails_7.1.gemfile"
|
58
|
-
- ".github/workflows/check.yml"
|
59
|
-
- ".github/workflows/release.yml"
|
60
|
-
- ".gitignore"
|
61
|
-
- ".rspec"
|
62
|
-
- ".rubocop.yml"
|
63
49
|
- CHANGELOG.md
|
64
|
-
- Gemfile
|
65
50
|
- LICENSE.txt
|
66
51
|
- README.md
|
67
|
-
- Rakefile
|
68
52
|
- lib/rspec-sqlimit.rb
|
69
53
|
- lib/rspec/sqlimit.rb
|
70
54
|
- lib/rspec/sqlimit/counter.rb
|
71
55
|
- lib/rspec/sqlimit/reporter.rb
|
72
|
-
- rspec-sqlimit.gemspec
|
73
|
-
- spec/dummy/Rakefile
|
74
|
-
- spec/dummy/app/models/user.rb
|
75
|
-
- spec/dummy/config.ru
|
76
|
-
- spec/dummy/config/application.rb
|
77
|
-
- spec/dummy/config/database.yml
|
78
|
-
- spec/dummy/config/environment.rb
|
79
|
-
- spec/dummy/db/migrate/20170211104800_create_users.rb
|
80
|
-
- spec/dummy/db/schema.rb
|
81
|
-
- spec/rspec/sqlimit/reporter_spec.rb
|
82
|
-
- spec/rspec/sqlimit_spec.rb
|
83
|
-
- spec/spec_helper.rb
|
84
56
|
homepage: https://github.com/nepalez/rspec-sqlimit
|
85
57
|
licenses:
|
86
58
|
- MIT
|
87
59
|
metadata: {}
|
88
|
-
post_install_message:
|
60
|
+
post_install_message:
|
89
61
|
rdoc_options: []
|
90
62
|
require_paths:
|
91
63
|
- lib
|
@@ -100,19 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
72
|
- !ruby/object:Gem::Version
|
101
73
|
version: '0'
|
102
74
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
-
signing_key:
|
75
|
+
rubygems_version: 3.5.22
|
76
|
+
signing_key:
|
105
77
|
specification_version: 4
|
106
78
|
summary: RSpec matcher to control SQL queries made by block of code
|
107
|
-
test_files:
|
108
|
-
- spec/dummy/Rakefile
|
109
|
-
- spec/dummy/app/models/user.rb
|
110
|
-
- spec/dummy/config.ru
|
111
|
-
- spec/dummy/config/application.rb
|
112
|
-
- spec/dummy/config/database.yml
|
113
|
-
- spec/dummy/config/environment.rb
|
114
|
-
- spec/dummy/db/migrate/20170211104800_create_users.rb
|
115
|
-
- spec/dummy/db/schema.rb
|
116
|
-
- spec/rspec/sqlimit/reporter_spec.rb
|
117
|
-
- spec/rspec/sqlimit_spec.rb
|
118
|
-
- spec/spec_helper.rb
|
79
|
+
test_files: []
|
@@ -1,16 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec path: '../..'
|
4
|
-
|
5
|
-
group :test do
|
6
|
-
gem "database_cleaner", ">= 1.5"
|
7
|
-
end
|
8
|
-
|
9
|
-
group :test, :development do
|
10
|
-
gem "pry"
|
11
|
-
gem "pry-byebug", "3.7.0"
|
12
|
-
gem "rails", "4.2.0"
|
13
|
-
gem "rake", ">= 10"
|
14
|
-
gem "rubocop", "0.81.0"
|
15
|
-
gem "sqlite3", "~> 1.3.6"
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec path: '../..'
|
4
|
-
|
5
|
-
group :test do
|
6
|
-
gem "database_cleaner", ">= 1.5"
|
7
|
-
end
|
8
|
-
|
9
|
-
group :test, :development do
|
10
|
-
gem "pry"
|
11
|
-
gem "pry-byebug"
|
12
|
-
gem "rails", "~> 6.0"
|
13
|
-
gem "rake", ">= 10"
|
14
|
-
gem "rubocop"
|
15
|
-
gem "sqlite3", "~> 1.4.0"
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec path: '../..'
|
4
|
-
|
5
|
-
group :test do
|
6
|
-
gem "database_cleaner", ">= 1.5"
|
7
|
-
end
|
8
|
-
|
9
|
-
group :test, :development do
|
10
|
-
gem "pry"
|
11
|
-
gem "pry-byebug"
|
12
|
-
gem "rails", "~> 7.1.0"
|
13
|
-
gem "rake", ">= 10"
|
14
|
-
gem "rubocop"
|
15
|
-
gem "sqlite3", "~> 1.6"
|
16
|
-
end
|
data/.github/workflows/check.yml
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
name: Check the code
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
branches:
|
5
|
-
- master
|
6
|
-
pull_request:
|
7
|
-
branches:
|
8
|
-
- master
|
9
|
-
concurrency:
|
10
|
-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
11
|
-
cancel-in-progress: true
|
12
|
-
defaults:
|
13
|
-
run:
|
14
|
-
shell: bash
|
15
|
-
jobs:
|
16
|
-
lint:
|
17
|
-
name: lint (ruby 3.2, rails 7.1)
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
env:
|
20
|
-
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/gemfiles/rails_7.1.gemfile
|
21
|
-
BUNDLE_RETRY: 1
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v3
|
24
|
-
- uses: ruby/setup-ruby@v1
|
25
|
-
with:
|
26
|
-
ruby-version: '3.2'
|
27
|
-
bundler-cache: true
|
28
|
-
- run: bundle exec rubocop
|
29
|
-
|
30
|
-
test-legacy:
|
31
|
-
name: test (ruby 2.3, rails 4.2)
|
32
|
-
runs-on: ubuntu-latest
|
33
|
-
env:
|
34
|
-
BUNDLER_VERSION: '1.17.3'
|
35
|
-
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/gemfiles/rails_4.2.gemfile
|
36
|
-
BUNDLE_RETRY: 1
|
37
|
-
steps:
|
38
|
-
- uses: actions/checkout@v3
|
39
|
-
- uses: ruby/setup-ruby@v1
|
40
|
-
with:
|
41
|
-
ruby-version: 2.3
|
42
|
-
rubygems: 3.2.3
|
43
|
-
bundler: 1
|
44
|
-
bundler-cache: true
|
45
|
-
- run: bundle exec rake
|
46
|
-
|
47
|
-
test:
|
48
|
-
name: test (ruby ${{ matrix.ruby }}, rails ${{ matrix.rails }})
|
49
|
-
runs-on: ubuntu-latest
|
50
|
-
strategy:
|
51
|
-
fail-fast: false
|
52
|
-
matrix:
|
53
|
-
ruby: ['3.2']
|
54
|
-
rails: ['6.0', '7.1']
|
55
|
-
env:
|
56
|
-
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/gemfiles/rails_${{ matrix.rails }}.gemfile
|
57
|
-
BUNDLE_RETRY: 1
|
58
|
-
steps:
|
59
|
-
- uses: actions/checkout@v3
|
60
|
-
- uses: ruby/setup-ruby@v1
|
61
|
-
with:
|
62
|
-
ruby-version: ${{ matrix.ruby }}
|
63
|
-
bundler-cache: true
|
64
|
-
- run: bundle exec rake
|
@@ -1,15 +0,0 @@
|
|
1
|
-
name: Release a new version
|
2
|
-
on:
|
3
|
-
release:
|
4
|
-
types: [created]
|
5
|
-
jobs:
|
6
|
-
release:
|
7
|
-
name: Publish new version on RubyGems
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
steps:
|
10
|
-
- uses: actions/checkout@v3
|
11
|
-
- uses: cadwallion/publish-rubygems-action@master
|
12
|
-
env:
|
13
|
-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
14
|
-
RUBYGEMS_API_KEY: ${{secrets.PUSH_RSPEC_SQLIMIT}}
|
15
|
-
RELEASE_COMMAND: rake release
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
---
|
2
|
-
AllCops:
|
3
|
-
DisplayCopNames: true
|
4
|
-
DisplayStyleGuide: true
|
5
|
-
NewCops: enable
|
6
|
-
StyleGuideCopsOnly: true
|
7
|
-
TargetRubyVersion: 2.3
|
8
|
-
Exclude:
|
9
|
-
- spec/dummy/db/schema.rb
|
10
|
-
- vendor/bundle/**/*
|
11
|
-
- gemfiles/vendor/**/*
|
12
|
-
|
13
|
-
Metrics/ParameterLists:
|
14
|
-
Max: 5
|
15
|
-
|
16
|
-
Naming/FileName:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Style/Alias:
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
Style/ClassAndModuleChildren:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Style/FrozenStringLiteralComment:
|
26
|
-
Enabled: false
|
27
|
-
|
28
|
-
Style/ModuleFunction:
|
29
|
-
Enabled: false
|
30
|
-
|
31
|
-
Style/OptionalBooleanParameter:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
Style/StringLiterals:
|
35
|
-
EnforcedStyle: double_quotes
|
36
|
-
|
37
|
-
Style/StringLiteralsInInterpolation:
|
38
|
-
EnforcedStyle: double_quotes
|
data/Gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
group :test do
|
6
|
-
gem "database_cleaner", ">= 1.5"
|
7
|
-
end
|
8
|
-
|
9
|
-
group :test, :development do
|
10
|
-
gem "pry"
|
11
|
-
gem "pry-byebug"
|
12
|
-
gem "rails"
|
13
|
-
gem "rake", ">= 10"
|
14
|
-
gem "rubocop"
|
15
|
-
gem "sqlite3", ">= 1.3"
|
16
|
-
end
|
data/Rakefile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
|
4
|
-
require "rspec/core/rake_task"
|
5
|
-
|
6
|
-
# Adds dummy:db tasks.
|
7
|
-
load "spec/dummy/Rakefile"
|
8
|
-
|
9
|
-
desc "Runs test suite."
|
10
|
-
task default: %w[db:reset db:schema:load] do
|
11
|
-
exec "bundle exec rspec spec"
|
12
|
-
end
|
data/rspec-sqlimit.gemspec
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |gem|
|
2
|
-
gem.name = "rspec-sqlimit"
|
3
|
-
gem.version = "0.0.6"
|
4
|
-
gem.author = "Andrew Kozin (nepalez)"
|
5
|
-
gem.email = "andrew.kozin@gmail.com"
|
6
|
-
gem.homepage = "https://github.com/nepalez/rspec-sqlimit"
|
7
|
-
gem.summary = "RSpec matcher to control SQL queries made by block of code"
|
8
|
-
gem.license = "MIT"
|
9
|
-
|
10
|
-
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
11
|
-
gem.test_files = gem.files.grep(/^spec/)
|
12
|
-
gem.extra_rdoc_files = Dir["README.md", "LICENSE", "CHANGELOG.md"]
|
13
|
-
|
14
|
-
gem.required_ruby_version = ">= 2.3"
|
15
|
-
|
16
|
-
gem.add_runtime_dependency "activerecord", ">= 4.2.0", "< 8"
|
17
|
-
gem.add_runtime_dependency "rspec", "~> 3.0"
|
18
|
-
end
|
data/spec/dummy/Rakefile
DELETED
data/spec/dummy/config.ru
DELETED
File without changes
|
data/spec/dummy/db/schema.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe RSpec::SQLimit::Reporter do
|
4
|
-
subject { described_class.new(counter) }
|
5
|
-
|
6
|
-
context "no params were passed to the query" do
|
7
|
-
let(:counter) { RSpec::SQLimit::Counter[/CREATE/, proc{ User.create }] }
|
8
|
-
|
9
|
-
it "doesn't print binds" do
|
10
|
-
# INSERT INTO "users" DEFAULT VALUES (0.284 ms)
|
11
|
-
expect(subject.call).to include("DEFAULT VALUES")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
context "query contains params" do
|
16
|
-
context "nil was passed as param" do
|
17
|
-
let(:counter) do
|
18
|
-
RSpec::SQLimit::Counter[/CREATE/, proc { User.create(id: nil) }]
|
19
|
-
end
|
20
|
-
|
21
|
-
it "doesn't print binds" do
|
22
|
-
# INSERT INTO "users" DEFAULT VALUES (0.284 ms)
|
23
|
-
expect(subject.call).to include("DEFAULT VALUES")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "single param was passed" do
|
28
|
-
let(:counter) do
|
29
|
-
RSpec::SQLimit::Counter[/CREATE/, proc { User.create(id: 1) }]
|
30
|
-
end
|
31
|
-
|
32
|
-
it "prints param as an array with one element" do
|
33
|
-
# INSERT INTO "users" ("id") VALUES (?); [1] (0.234 ms)
|
34
|
-
# INSERT INTO "users" ("id") VALUES (?) RETURNING "id"; [1] (1.12 ms)
|
35
|
-
expect(subject.call).to match(/VALUES \(\?\).*; \[1\]/)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "array was passed as a param" do
|
40
|
-
let(:counter) do
|
41
|
-
RSpec::SQLimit::Counter[
|
42
|
-
/SELECT/, proc { User.where(id: [1, 2, 3]).to_a }
|
43
|
-
]
|
44
|
-
end
|
45
|
-
|
46
|
-
it "prints all params" do
|
47
|
-
# SELECT "users".* FROM "users" WHERE "users"."id" IN (1, 2, 3) (0.17 ms))
|
48
|
-
# Rails >= 6:
|
49
|
-
# SELECT "users".* FROM "users" WHERE "users"."id" IN (?, ?, ?); [1, 2, 3] (0.121 ms)
|
50
|
-
# rubocop: enable Layout/LineLength
|
51
|
-
expect(subject.call).to include("1, 2, 3")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context "activerecord query caching was enabled" do
|
57
|
-
let(:counter) do
|
58
|
-
RSpec::SQLimit::Counter[/SELECT "users"/, proc { queries }]
|
59
|
-
end
|
60
|
-
|
61
|
-
let(:queries) do
|
62
|
-
User.cache do
|
63
|
-
User.where(id: 1).to_a
|
64
|
-
User.where(id: 1).to_a
|
65
|
-
User.where(id: [2, 3]).to_a
|
66
|
-
User.where(id: [2, 3]).to_a
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
it "ignores cached queries" do
|
71
|
-
expect(subject.call).to include("2 queries were invoked")
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
data/spec/rspec/sqlimit_spec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "exceed_query_limit" do
|
4
|
-
context "without restrictions" do
|
5
|
-
it "works when no queries are made" do
|
6
|
-
expect { User.new }.not_to exceed_query_limit(0)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "works when nil is used as a parameter" do
|
10
|
-
expect { User.create id: nil }.to exceed_query_limit(0)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "works when array is used as a restriction" do
|
14
|
-
expect { (User.where id: [1, 2, 3]).to_a }.to exceed_query_limit(0)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "works when actual number of queries is below the limit" do
|
18
|
-
expect { User.create }.not_to exceed_query_limit(3)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "works when actual number of queries exceeds the limit" do
|
22
|
-
expect { User.create }.to exceed_query_limit(2)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context "with a restriction" do
|
27
|
-
it "works when no queries are made" do
|
28
|
-
expect { User.new }.not_to exceed_query_limit(0).with(/INSERT/)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "works when nil is used as a parameter" do
|
32
|
-
expect { User.create id: nil }.to exceed_query_limit(0).with(/INSERT/)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "works when array is used as a restriction" do
|
36
|
-
expect { (User.where id: [1, 2, 3]).to_a }
|
37
|
-
.to exceed_query_limit(0)
|
38
|
-
.with(/SELECT/)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "works when actual number of queries is below the limit" do
|
42
|
-
expect { User.create }.not_to exceed_query_limit(1).with(/INSERT/)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "works when actual number of queries exceeds the limit" do
|
46
|
-
expect { User.create id: 3 }.to exceed_query_limit(0).with(/INSERT/)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require "pry"
|
2
|
-
require "rspec-sqlimit"
|
3
|
-
require "database_cleaner"
|
4
|
-
|
5
|
-
require_relative "dummy/config/environment"
|
6
|
-
|
7
|
-
DatabaseCleaner.strategy = :truncation
|
8
|
-
|
9
|
-
RSpec.configure do |config|
|
10
|
-
config.order = :random
|
11
|
-
config.filter_run focus: true
|
12
|
-
config.run_all_when_everything_filtered = true
|
13
|
-
|
14
|
-
# Prepare the Test namespace for constants defined in specs
|
15
|
-
config.after(:each) { DatabaseCleaner.clean }
|
16
|
-
end
|