ammeter 1.1.5 → 1.1.7

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: 15c215e3ca3e6612c3a575d4867460591978e772edc6b25af049887adcab428f
4
- data.tar.gz: 94c066d9357c99d88fb78ea07ddc4a0387248bd5eafc8992d49b81a5bc5fa007
3
+ metadata.gz: 16bfa450ad2ca9fcc35fba61b496085b3b8f51e9fb36cfba39f6c4c207e129a5
4
+ data.tar.gz: d87b51720a05eafa9340e7b0a93ed41be2736d63582e581dd81a256b875880eb
5
5
  SHA512:
6
- metadata.gz: 490b1a299c1916d6e42fb88409ba9c65e8343c6b9696dcbf686b81a08054a5a042737ee993c163f9802c0ea513735238e8deb032af72a7be35b646d138399043
7
- data.tar.gz: 3aefd4e01fb7e0fd75caefd5ed5b4b70d531176e83221d881fb088f42f7bfc787221527b6f0cab9e7c31ece610bf7fa75d023c7fb5f10f7f7aaeb3d8cd3b070a
6
+ metadata.gz: 64af70360ee44264d9aaded3f86b8f9845cb3deaaea81cf8a19e220b541b2367fe7e6e40e3c8bda310b858b773a60dd0ad4c42e692ae057deed920f80be3da5b
7
+ data.tar.gz: a5b9d34365e00de8845bd8943ad1354181a209ecff56117b282babeb0db6f9f1c0d3ddfabc8d4a0c75e6b7ba1d0f8c5ec48b06d49ef81c82d68851ca485e05ef
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.8
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 exist }
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
@@ -74,7 +74,7 @@ module Ammeter
74
74
  end
75
75
 
76
76
  def file relative
77
- File.expand_path(relative, destination_root)
77
+ Pathname.new(File.expand_path(relative, destination_root))
78
78
  end
79
79
  def migration_file relative
80
80
  file_path = file(relative)
@@ -1,5 +1,11 @@
1
- RSpec::Matchers.define :exist do
1
+ # DEPRECATED: use `expect(Pathname.new(path)).to exist` instead
2
+ RSpec::Matchers.define :exist do |*expected|
2
3
  match do |file_path|
3
- File.exist?(file_path)
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
@@ -1,3 +1,3 @@
1
1
  module Ammeter
2
- VERSION = "1.1.5"
2
+ VERSION = "1.1.7"
3
3
  end
@@ -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.5
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: 2021-02-24 00:00:00.000000000 Z
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
- rubyforge_project:
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