rspec-mock 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspec/mock/core.rb +3 -1
- data/lib/rspec/mock/migration_analytics/{cli.rb → printer.rb} +4 -30
- data/lib/rspec/mock/railtie.rb +11 -0
- data/lib/rspec/mock/task.rb +13 -0
- data/lib/rspec/mock/tasks/rspec_mock.rake +16 -0
- data/lib/rspec/mock/version.rb +1 -1
- data/rspec-mock.gemspec +1 -0
- metadata +26 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e883de11242d052f62a1c71561da13eab05e1ab3017b99c0195dc53b018dcf9
|
4
|
+
data.tar.gz: 94a8aa02334ac7ce4f20be787fe7cc55f33fed352681ad8125fc03ac85cde3da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3130160c9fff353aaf325f054bbf573bac8f32201fb2cbf8bd2c1f777deddae6b6bba030e479cc97240f3b967d09598b4a9312b45fa08ad088f9904664615c6
|
7
|
+
data.tar.gz: c9bd824aa0ebfbacb914bcca33f944a5763ca8203f1e07a4c1fb38323e6335be2101e1fe8a1e0ed6fdf599a90fa13ba5c4dda2139bc6b498c31b06f5af8f5dbc
|
data/lib/rspec/mock/core.rb
CHANGED
@@ -13,13 +13,15 @@ module RSpec
|
|
13
13
|
end
|
14
14
|
|
15
15
|
require_relative 'migration_analytics/file_analyzer'
|
16
|
-
require_relative 'migration_analytics/
|
16
|
+
require_relative 'migration_analytics/printer'
|
17
17
|
end
|
18
18
|
|
19
19
|
require_relative 'configuration'
|
20
20
|
require_relative 'context'
|
21
21
|
require_relative 'methods'
|
22
22
|
require_relative 'version'
|
23
|
+
|
24
|
+
require_relative(defined?(::Rails) ? 'railtie' : 'task')
|
23
25
|
end
|
24
26
|
|
25
27
|
module Core
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require 'colorize'
|
@@ -12,39 +11,16 @@ require_relative 'file_analyzer'
|
|
12
11
|
module RSpec
|
13
12
|
module Mock
|
14
13
|
module MigrationAnalytics
|
15
|
-
class
|
14
|
+
class Printer
|
16
15
|
class << self
|
17
|
-
def call
|
18
|
-
if ::
|
19
|
-
print_usage
|
20
|
-
exit 1
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
verify_path(::ARGV[0])
|
25
|
-
rescue => error
|
26
|
-
puts("\n❌ Error: #{error.message}".red)
|
27
|
-
puts(error.backtrace) if ENV['DEBUG']
|
28
|
-
end
|
29
|
-
end
|
16
|
+
def call(path)
|
17
|
+
return verify_directory(path) if ::File.directory?(path)
|
30
18
|
|
31
|
-
|
32
|
-
case
|
33
|
-
when ::File.directory?(path) then verify_directory(path)
|
34
|
-
else verify_file(path)
|
35
|
-
end
|
19
|
+
verify_file(path)
|
36
20
|
end
|
37
21
|
|
38
22
|
private
|
39
23
|
|
40
|
-
def print_usage
|
41
|
-
puts('Usage: ruby cli.rb <path_to_spec_file_or_directory>'.yellow)
|
42
|
-
puts("\nExamples:".blue)
|
43
|
-
puts(' ruby cli.rb spec/models/user_spec.rb')
|
44
|
-
puts(' ruby cli.rb spec/models/')
|
45
|
-
puts(' ruby cli.rb spec/')
|
46
|
-
end
|
47
|
-
|
48
24
|
def verify_directory(dir_path) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
49
25
|
results = []
|
50
26
|
stats = {
|
@@ -188,5 +164,3 @@ module RSpec
|
|
188
164
|
end
|
189
165
|
end
|
190
166
|
end
|
191
|
-
|
192
|
-
RSpec::Mock::MigrationAnalytics::Cli.call if __FILE__.eql?($PROGRAM_NAME)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :rspec_mock do
|
4
|
+
namespace :migration_analytics do
|
5
|
+
desc 'Analyze Flexmock usage and track migration progress to RSpec mocks'
|
6
|
+
# :nocov:
|
7
|
+
task :flexmock do
|
8
|
+
require 'rspec/mock/migration_analytics/printer'
|
9
|
+
|
10
|
+
path = ::ARGV[1] || 'spec'
|
11
|
+
puts("\n🔍 Analyzing Flexmock usage in: #{path}")
|
12
|
+
RSpec::Mock::MigrationAnalytics::Printer.call(path)
|
13
|
+
end
|
14
|
+
# :nocov:
|
15
|
+
end
|
16
|
+
end
|
data/lib/rspec/mock/version.rb
CHANGED
data/rspec-mock.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = %w[lib]
|
28
28
|
|
29
29
|
spec.add_runtime_dependency 'colorize', '>= 0.8.1'
|
30
|
+
spec.add_runtime_dependency 'rake', '~> 13.2', '>= 13.2.1'
|
30
31
|
spec.add_runtime_dependency 'rspec-core', '~> 3.10'
|
31
32
|
spec.add_runtime_dependency 'rspec-mocks', '~> 3.10'
|
32
33
|
spec.add_runtime_dependency 'terminal-table', '~> 3.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-mock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -24,6 +24,26 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.8.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.2'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 13.2.1
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '13.2'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 13.2.1
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: rspec-core
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,11 +118,14 @@ files:
|
|
98
118
|
- lib/rspec/mock/context.rb
|
99
119
|
- lib/rspec/mock/core.rb
|
100
120
|
- lib/rspec/mock/methods.rb
|
101
|
-
- lib/rspec/mock/migration_analytics/cli.rb
|
102
121
|
- lib/rspec/mock/migration_analytics/file_analyzer.rb
|
122
|
+
- lib/rspec/mock/migration_analytics/printer.rb
|
103
123
|
- lib/rspec/mock/migration_analytics/tracker/base.rb
|
104
124
|
- lib/rspec/mock/migration_analytics/tracker/flexmock.rb
|
105
125
|
- lib/rspec/mock/migration_analytics/tracker/rspec.rb
|
126
|
+
- lib/rspec/mock/railtie.rb
|
127
|
+
- lib/rspec/mock/task.rb
|
128
|
+
- lib/rspec/mock/tasks/rspec_mock.rake
|
106
129
|
- lib/rspec/mock/version.rb
|
107
130
|
- rspec-mock.gemspec
|
108
131
|
homepage: https://github.com/mocktools/ruby-rspec-mock
|