tablesalt 0.16.3 → 0.17.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89d9dfdedfe2cf7c0d30f0cd8b92fe9ff87dbbddaa7deae8c1a38d7dd5629858
|
4
|
+
data.tar.gz: bea38e74fbe8c63ff5d960e48d1e38032b8bc2aa9cb218f31e97c84bf0d88a5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a3858a2ec7eb8d195407f87c6e0f76fddd4a37bf1cfd27bf79e77b3afe9cde278432916cb3d6fa0d36b6e67c12f64fa5bb9e3d5b790d8a64a47ffad59faa586
|
7
|
+
data.tar.gz: 1ff9c1a7db57a515993fa6bd465d354d53e5500f5408656ba794bf09cb7e755c0bd09d7cd36d57c5be7a9b3eede72310bbd13287551cff26ce35cae5de997b2f
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
require "active_support/core_ext/module/delegation"
|
5
|
+
|
6
|
+
module Tablesalt
|
7
|
+
module Isolation
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
delegate :isolate, to: :class
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
# Dupes an item if possible. Classes/modules can have unpredictable effects when duped, so they are not.
|
16
|
+
def isolate(obj)
|
17
|
+
return obj if obj.is_a?(Module)
|
18
|
+
|
19
|
+
obj.clone
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# RSpec matcher that tests usage of `.argument`
|
4
|
+
#
|
5
|
+
# class Example
|
6
|
+
# include Tablesalt::Isolation
|
7
|
+
#
|
8
|
+
# THIS_IS_A_CONSTANT = isolate("this is a string").freeze
|
9
|
+
# ANOTHER_CONSTANT = isolate ThisIsAClass
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# RSpec.describe Example do
|
13
|
+
# describe "THIS_IS_A_CONSTANT" do
|
14
|
+
# subject { described_class::THIS_IS_A_CONSTANT }
|
15
|
+
#
|
16
|
+
# it { is_expected.to isolate "this is a string" }
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# describe "ANOTHER_CONSTANT" do
|
20
|
+
# subject { described_class::ANOTHER_CONSTANT }
|
21
|
+
#
|
22
|
+
# it { is_expected.to isolate ThisIsAClass }
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
RSpec::Matchers.define :isolate do |argument|
|
27
|
+
match do |isolated|
|
28
|
+
expect(isolated.frozen?).to eq argument.frozen?
|
29
|
+
|
30
|
+
if argument.is_a?(Module)
|
31
|
+
expect(argument).to equal isolated
|
32
|
+
else
|
33
|
+
expect(argument).to eq isolated
|
34
|
+
expect(argument).not_to equal isolated
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
description { "isolate argument #{argument}" }
|
39
|
+
failure_message do
|
40
|
+
"expected #{argument} to be isolated"
|
41
|
+
end
|
42
|
+
end
|
data/lib/tablesalt/version.rb
CHANGED
data/lib/tablesalt.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tablesalt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Minneti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -50,6 +50,10 @@ files:
|
|
50
50
|
- README.md
|
51
51
|
- lib/tablesalt.rb
|
52
52
|
- lib/tablesalt/dsl_accessor.rb
|
53
|
+
- lib/tablesalt/isolation.rb
|
54
|
+
- lib/tablesalt/rspec/custom_matchers.rb
|
55
|
+
- lib/tablesalt/rspec/custom_matchers/isolate.rb
|
56
|
+
- lib/tablesalt/spec_helper.rb
|
53
57
|
- lib/tablesalt/stringable_object.rb
|
54
58
|
- lib/tablesalt/uses_hash_for_equality.rb
|
55
59
|
- lib/tablesalt/version.rb
|
@@ -75,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
79
|
- !ruby/object:Gem::Version
|
76
80
|
version: '0'
|
77
81
|
requirements: []
|
78
|
-
rubygems_version: 3.0.
|
82
|
+
rubygems_version: 3.0.6
|
79
83
|
signing_key:
|
80
84
|
specification_version: 4
|
81
85
|
summary: Miscellaneous helper modules, POROs, and more, that standardize common behavior
|