mocktail 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +5 -1
- data/bin/m +29 -0
- data/lib/mocktail/simulates_argument_error/transforms_params.rb +14 -0
- data/lib/mocktail/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2944636158dbc47b6da4246d28303f274e2740b7d61ccf3359ff1ce668ab40
|
4
|
+
data.tar.gz: ea0aa33b02f8f9dac5be81bf6a5a394d181f078127a7b9e22fb55d5c30c85808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15456b62e2fe1157c17b694c9c8d83d1fa42fa64f4cc3a3aa998a3d21ccf8ae13320694ed3ed1ac500a1636210ae9b153b1070fa427ed9dfd04e5a43b29d56b6
|
7
|
+
data.tar.gz: 193f8fca67cfb78fc2eefc21b0c70cf5f9ddb9028b0ff948472c119ea0350dda587a4a150e7b8cc283ed9cfe4f8e451a323f9517517d73dbfd84a20cedfce2ed
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mocktail (1.2.
|
4
|
+
mocktail (1.2.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -10,6 +10,9 @@ GEM
|
|
10
10
|
coderay (1.1.3)
|
11
11
|
docile (1.4.0)
|
12
12
|
json (2.6.2)
|
13
|
+
m (1.6.1)
|
14
|
+
method_source (>= 0.6.7)
|
15
|
+
rake (>= 0.9.2.2)
|
13
16
|
method_source (1.0.0)
|
14
17
|
minitest (5.16.3)
|
15
18
|
parallel (1.22.1)
|
@@ -54,6 +57,7 @@ PLATFORMS
|
|
54
57
|
ruby
|
55
58
|
|
56
59
|
DEPENDENCIES
|
60
|
+
m
|
57
61
|
minitest
|
58
62
|
mocktail!
|
59
63
|
pry
|
data/bin/m
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'm' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("m", "m")
|
@@ -3,6 +3,8 @@ require_relative "../share/bind"
|
|
3
3
|
module Mocktail
|
4
4
|
class TransformsParams
|
5
5
|
def transform(dry_call, params: dry_call.original_method.parameters)
|
6
|
+
params = name_unnamed_params(params)
|
7
|
+
|
6
8
|
Signature.new(
|
7
9
|
positional_params: Params.new(
|
8
10
|
all: params.select { |t, _|
|
@@ -28,5 +30,17 @@ module Mocktail
|
|
28
30
|
block_arg: dry_call.block
|
29
31
|
)
|
30
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def name_unnamed_params(params)
|
37
|
+
params.map.with_index { |param, i|
|
38
|
+
if param.size == 1
|
39
|
+
param + ["unnamed_arg_#{i + 1}"]
|
40
|
+
else
|
41
|
+
param
|
42
|
+
end
|
43
|
+
}
|
44
|
+
end
|
31
45
|
end
|
32
46
|
end
|
data/lib/mocktail/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mocktail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -27,6 +27,7 @@ files:
|
|
27
27
|
- README.md
|
28
28
|
- Rakefile
|
29
29
|
- bin/console
|
30
|
+
- bin/m
|
30
31
|
- bin/rake
|
31
32
|
- bin/setup
|
32
33
|
- lib/mocktail.rb
|