ammeter 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/History.md +6 -0
- data/README.md +1 -4
- data/lib/ammeter/rspec/generator/matchers/exist.rb +8 -2
- data/lib/ammeter/version.rb +1 -1
- data/spec/ammeter/rspec/generator/matchers/exist_spec.rb +8 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a625241c915188a70b534c263a9c38bfb1c0315aedf7d7a31fd27aaec8407f
|
4
|
+
data.tar.gz: 80c902df52f5b7b68af80f680dbc0273c5b42b819d0a19f7de2065ddc3d556e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ce7d82c75dedff9639409713b630ce6ea8e04c11a75536bd2ef4f5200a9901cc111510d643b316b51da78b83f3cf1729ec5a85d296ff755ea9256e2caca8145
|
7
|
+
data.tar.gz: a99410d8eddd86ca0732099a108a9fdcad91674b72e93e7f93d67a8dc6464cde8eb93f860514edaad65c43281304b3c05d8eb9b8035b892bc42f8cb96b0cd704
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
3.2.2
|
data/History.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Ammeter release history
|
2
2
|
|
3
|
+
### 1.1.6 / 2023-11-29
|
4
|
+
|
5
|
+
[full changelog](https://github.com/alexrothenberg/ammeter/compare/v1.1.5...v1.1.6)
|
6
|
+
|
7
|
+
* Deprecate the custom exist matcher (#68)
|
8
|
+
|
3
9
|
### 1.0.0 / 2014-04-07
|
4
10
|
|
5
11
|
[full changelog](https://github.com/alexrothenberg/ammeter/compare/v0.2.9...v1.0.0)
|
data/README.md
CHANGED
@@ -71,8 +71,6 @@ describe Rspec::Generators::ModelGenerator, :type => :generator do
|
|
71
71
|
describe 'the spec' do
|
72
72
|
# file - gives you the absolute path where the generator will create the file
|
73
73
|
subject { file('spec/models/posts_spec.rb') }
|
74
|
-
# is_expected_to exist - verifies the file exists
|
75
|
-
it { is_expected_to exist }
|
76
74
|
|
77
75
|
# is_expected_to contain - verifies the file's contents
|
78
76
|
it { is_expected_to contain /require 'spec_helper'/ }
|
@@ -82,7 +80,7 @@ describe Rspec::Generators::ModelGenerator, :type => :generator do
|
|
82
80
|
subject { migration_file('db/migrate/create_posts.rb') }
|
83
81
|
|
84
82
|
# is_expected_to be_a_migration - verifies the file exists with a migration timestamp as part of the filename
|
85
|
-
it { is_expected_to
|
83
|
+
it { is_expected_to be_a_migration }
|
86
84
|
it { is_expected_to contain /create_table/ }
|
87
85
|
end
|
88
86
|
end
|
@@ -91,7 +89,6 @@ end
|
|
91
89
|
|
92
90
|
# Available matchers
|
93
91
|
|
94
|
-
- `exist` - verifies the file exists
|
95
92
|
- `contain` - verifies the file's contents
|
96
93
|
- `be_a_migration` - verifies the file exists with a migration timestamp as part of the filename
|
97
94
|
- `have_method` - verifies the file (or a class withing it) implements a method
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
1
|
+
# DEPRECATED: use `expect(Pathname.new(path)).to exist` instead
|
2
|
+
RSpec::Matchers.define :exist do |*expected|
|
2
3
|
match do |file_path|
|
3
|
-
|
4
|
+
if !(file_path.respond_to?(:exist?) || file_path.respond_to?(:exists?))
|
5
|
+
ActiveSupport::Deprecation.warn "The `exist` matcher overrides one built-in by RSpec; use `expect(Pathname.new(path)).to exist` instead"
|
6
|
+
File.exist?(file_path)
|
7
|
+
else
|
8
|
+
RSpec::Matchers::BuiltIn::Exist.new(*expected).matches?(file_path)
|
9
|
+
end
|
4
10
|
end
|
5
11
|
end
|
data/lib/ammeter/version.rb
CHANGED
@@ -5,9 +5,17 @@ describe "exist" do
|
|
5
5
|
allow(File).to receive(:exist?).with('/some/file/path').and_return(true)
|
6
6
|
expect('/some/file/path').to exist
|
7
7
|
end
|
8
|
+
|
8
9
|
it 'fails when the file does not exist' do
|
9
10
|
allow(File).to receive(:exist?).with('/some/file/path').and_return(false)
|
10
11
|
expect('/some/file/path').to_not exist
|
11
12
|
end
|
12
13
|
|
14
|
+
it 'maintains default RSpec behavior', :aggregate_failures do
|
15
|
+
path = Pathname.new('/some/file/path')
|
16
|
+
allow(path).to receive(:exist?).and_return(true)
|
17
|
+
expect(path).to exist
|
18
|
+
allow(path).to receive(:exist?).and_return(false)
|
19
|
+
expect(path).not_to exist
|
20
|
+
end
|
13
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ammeter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rothenberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -283,8 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
283
|
- !ruby/object:Gem::Version
|
284
284
|
version: '0'
|
285
285
|
requirements: []
|
286
|
-
|
287
|
-
rubygems_version: 2.7.6.2
|
286
|
+
rubygems_version: 3.4.10
|
288
287
|
signing_key:
|
289
288
|
specification_version: 4
|
290
289
|
summary: Write specs for your Rails 3+ generators
|