ammeter 1.1.5 → 1.1.7
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/.ruby-version +1 -1
- data/History.md +6 -0
- data/README.md +1 -4
- data/lib/ammeter/rspec/generator/example/generator_example_group.rb +1 -1
- data/lib/ammeter/rspec/generator/matchers/exist.rb +8 -2
- data/lib/ammeter/version.rb +1 -1
- data/spec/ammeter/rspec/generator/example/generator_example_group_spec.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: 16bfa450ad2ca9fcc35fba61b496085b3b8f51e9fb36cfba39f6c4c207e129a5
|
4
|
+
data.tar.gz: d87b51720a05eafa9340e7b0a93ed41be2736d63582e581dd81a256b875880eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64af70360ee44264d9aaded3f86b8f9845cb3deaaea81cf8a19e220b541b2367fe7e6e40e3c8bda310b858b773a60dd0ad4c42e692ae057deed920f80be3da5b
|
7
|
+
data.tar.gz: a5b9d34365e00de8845bd8943ad1354181a209ecff56117b282babeb0db6f9f1c0d3ddfabc8d4a0c75e6b7ba1d0f8c5ec48b06d49ef81c82d68851ca485e05ef
|
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
@@ -43,7 +43,7 @@ module Ammeter::RSpec::Rails
|
|
43
43
|
FileUtils.mkdir path_to_gem_root_tmp
|
44
44
|
end
|
45
45
|
it 'should use destination to find relative root file' do
|
46
|
-
expect(group.file('app/model/post.rb')).to eq "#{path_to_gem_root_tmp}/app/model/post.rb"
|
46
|
+
expect(group.file('app/model/post.rb').to_path).to eq "#{path_to_gem_root_tmp}/app/model/post.rb"
|
47
47
|
end
|
48
48
|
|
49
49
|
describe 'migrations' do
|
@@ -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.7
|
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: 2024-02-23 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
|