decorator_dryer 0.1.2 → 0.1.3
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/lib/decorator_dryer/rspec/matchers.rb +7 -7
- data/lib/decorator_dryer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b2b5ffec7f0a9d0ed8372f6a8ab3433a2daab3ea6fc1068ad79b1ba36061e990
|
|
4
|
+
data.tar.gz: 2cebca175fc5e36be748707c2bae014d20678df21d1d6add37762e58acfef3f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 769b19aedb2d3d7b617bbbd7b1bd473c5b371a8fb0afb520134c20b5af9b926d1130441e008697e4072ad5fb535bfca2392503215959c2ac194792f02f896c96
|
|
7
|
+
data.tar.gz: fc53714bc8a1c60a28adc349e5f2afe6d9989aeb9750b29271cb8da83980e3fb91e18c7741557f7ab4da5699fdeaff47380c22a93e19255061a72d42f4ccb4a3
|
|
@@ -8,7 +8,7 @@ module DecoratorDryer
|
|
|
8
8
|
#
|
|
9
9
|
# @example
|
|
10
10
|
# expect(user).to format_field_to_name(:role)
|
|
11
|
-
RSpec::Matchers.define :format_field_to_name do |field|
|
|
11
|
+
::RSpec::Matchers.define :format_field_to_name do |field|
|
|
12
12
|
match do |subject|
|
|
13
13
|
subject.decorate.send("#{field}_name") == subject.send(field).try(:name)
|
|
14
14
|
end
|
|
@@ -24,7 +24,7 @@ module DecoratorDryer
|
|
|
24
24
|
#
|
|
25
25
|
# @example
|
|
26
26
|
# expect(post).to format_field_to_datetime(:published_at)
|
|
27
|
-
RSpec::Matchers.define :format_field_to_datetime do |field|
|
|
27
|
+
::RSpec::Matchers.define :format_field_to_datetime do |field|
|
|
28
28
|
match do |subject|
|
|
29
29
|
subject.decorate.send(field) == subject.send(field).try(:strftime, '%Y-%m-%d %H:%M')
|
|
30
30
|
end
|
|
@@ -40,7 +40,7 @@ module DecoratorDryer
|
|
|
40
40
|
#
|
|
41
41
|
# @example
|
|
42
42
|
# expect(event).to format_field_to_date(:start_date)
|
|
43
|
-
RSpec::Matchers.define :format_field_to_date do |field|
|
|
43
|
+
::RSpec::Matchers.define :format_field_to_date do |field|
|
|
44
44
|
match do |subject|
|
|
45
45
|
subject.decorate.send(field) == subject.send(field).try(:strftime, '%Y-%m-%d')
|
|
46
46
|
end
|
|
@@ -56,7 +56,7 @@ module DecoratorDryer
|
|
|
56
56
|
#
|
|
57
57
|
# @example
|
|
58
58
|
# expect(schedule).to format_field_to_time(:start_time)
|
|
59
|
-
RSpec::Matchers.define :format_field_to_time do |field|
|
|
59
|
+
::RSpec::Matchers.define :format_field_to_time do |field|
|
|
60
60
|
match do |subject|
|
|
61
61
|
subject.decorate.send(field) == subject.send(field).try(:strftime, '%H:%M')
|
|
62
62
|
end
|
|
@@ -72,7 +72,7 @@ module DecoratorDryer
|
|
|
72
72
|
#
|
|
73
73
|
# @example
|
|
74
74
|
# expect(product).to format_field_to_precision_number(:price, 2)
|
|
75
|
-
RSpec::Matchers.define :format_field_to_precision_number do |field, precision|
|
|
75
|
+
::RSpec::Matchers.define :format_field_to_precision_number do |field, precision|
|
|
76
76
|
match do |subject|
|
|
77
77
|
subject.decorate.send(field) == number_with_precision(subject.send(field), precision: precision)
|
|
78
78
|
end
|
|
@@ -88,7 +88,7 @@ module DecoratorDryer
|
|
|
88
88
|
#
|
|
89
89
|
# @example
|
|
90
90
|
# expect(order).to delegate_field(:email, :customer)
|
|
91
|
-
RSpec::Matchers.define :delegate_field do |field, association|
|
|
91
|
+
::RSpec::Matchers.define :delegate_field do |field, association|
|
|
92
92
|
match do |subject|
|
|
93
93
|
subject.decorate.send(field) == subject.send(association).decorate.send(field)
|
|
94
94
|
end
|
|
@@ -105,7 +105,7 @@ module DecoratorDryer
|
|
|
105
105
|
#
|
|
106
106
|
# @example
|
|
107
107
|
# expect(order).to delegate_field_with_prefix(:email, :customer)
|
|
108
|
-
RSpec::Matchers.define :delegate_field_with_prefix do |field, association|
|
|
108
|
+
::RSpec::Matchers.define :delegate_field_with_prefix do |field, association|
|
|
109
109
|
match do |subject|
|
|
110
110
|
subject.decorate.send("#{association}_#{field}") ==
|
|
111
111
|
subject.send(association).decorate.send(field)
|