item 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6a29edf2decf5e240573a835bd1453dba1ffe1d
4
- data.tar.gz: f9e17c350d0d096a29b1269b7047df2c377de879
3
+ metadata.gz: 7d5bff2b3b8741143f52dde7c47f23c9d2243b5a
4
+ data.tar.gz: 947c18bb986760d1bdda67119d148f46b0efda65
5
5
  SHA512:
6
- metadata.gz: f5e327e78c8d51fd1ff2e3c72911aeb59770b7ed2b0409ddcc89bae22136f4b39671615edb5e30a2b0ac7571049d83a355e6170b09ba28781958bc083e624014
7
- data.tar.gz: 6ffca681458ce4ff45e9042260dba859073f45d7febad10798ac1d85aebbe32f4c0ac02668732a6627c0bab086214bc8c643980663865b53a1d661108274f909
6
+ metadata.gz: 87700a0384d477e26500e0b67eac4d724312c4443f423ac034e20abb9f9a9c58fe1d9f80ddf6a8a7340b727efe1bf8cef48f99c4cdede90e4890b31e091c2a52
7
+ data.tar.gz: 62442db6af25325ec2cb7b68b2de0d0d6fb5f4347db6da5c921c16a1d5f001a9c570d6a889a916e4dbdab70675b53e23639d447920c1e3ea01437df231621e03
@@ -1,3 +1,3 @@
1
1
  module Item
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -23,8 +23,8 @@ module Item
23
23
  options, value = value, nil if value.is_a?(Hash)
24
24
  itemprop = Util.itemprop(key)
25
25
 
26
- @_item_enabled_old = @_item_enabled
27
- @_item_enabled = @_item_enabled_old && options.fetch(:if, !options.fetch(:unless, false))
26
+ item_enabled_old = @_item_enabled
27
+ @_item_enabled = item_enabled_old && options.fetch(:if, !options.fetch(:unless, false))
28
28
 
29
29
  options.delete(:if)
30
30
  options.delete(:unless)
@@ -40,7 +40,7 @@ module Item
40
40
  content_tag(tag, value, options)
41
41
  end
42
42
 
43
- @_item_enabled = @_item_enabled_old
43
+ @_item_enabled = item_enabled_old
44
44
 
45
45
  content
46
46
  end
@@ -100,14 +100,17 @@ class ViewHelpersTest < ActionView::TestCase
100
100
 
101
101
  test "prop with falsey if" do
102
102
  content = scope :product do
103
- prop :offers, type: :offer, tag: :custom1, class: "offers-container", if: nil do
104
- [prop(:price, 123.5, tag: :custom2, class: "price-container"),
105
- prop(availability: :in_stock, price_currency: "DKK"),
106
- prop(:other_key, :other_value)].join.html_safe
107
- end
103
+ "".tap do |content|
104
+ content << prop(:offers, type: :offer, tag: :custom1, class: "offers-container", if: nil) do
105
+ [prop(:price, 123.5, tag: :custom2, class: "price-container"),
106
+ prop(availability: :in_stock, price_currency: "DKK"),
107
+ prop(:other_key, :other_value)].join.html_safe
108
+ end
109
+ content << prop(:name, "Product Name")
110
+ end.html_safe
108
111
  end
109
112
 
110
- assert_equal %{<div itemscope="itemscope" itemtype="http://schema.org/Product"><custom1 class="offers-container"><custom2 class="price-container">123.5</custom2></custom1></div>},
113
+ assert_equal %{<div itemscope=\"itemscope\" itemtype=\"http://schema.org/Product\"><custom1 class=\"offers-container\"><custom2 class=\"price-container\">123.5</custom2></custom1><span itemprop=\"name\">Product Name</span></div>},
111
114
  content
112
115
  end
113
116
 
@@ -126,14 +129,17 @@ class ViewHelpersTest < ActionView::TestCase
126
129
 
127
130
  test "prop with trueish unless" do
128
131
  content = scope :product do
129
- prop :offers, type: :offer, tag: :custom1, class: "offers-container", unless: "trueish" do
130
- [prop(:price, 123.5, tag: :custom2, class: "price-container"),
131
- prop(availability: :in_stock, price_currency: "DKK"),
132
- prop(:other_key, :other_value)].join.html_safe
133
- end
132
+ "".tap do |content|
133
+ content << prop(:offers, type: :offer, tag: :custom1, class: "offers-container", if: nil) do
134
+ [prop(:price, 123.5, tag: :custom2, class: "price-container"),
135
+ prop(availability: :in_stock, price_currency: "DKK"),
136
+ prop(:other_key, :other_value)].join.html_safe
137
+ end
138
+ content << prop(:name, "Product Name")
139
+ end.html_safe
134
140
  end
135
141
 
136
- assert_equal %{<div itemscope="itemscope" itemtype="http://schema.org/Product"><custom1 class="offers-container"><custom2 class="price-container">123.5</custom2></custom1></div>},
142
+ assert_equal %{<div itemscope=\"itemscope\" itemtype=\"http://schema.org/Product\"><custom1 class=\"offers-container\"><custom2 class=\"price-container\">123.5</custom2></custom1><span itemprop=\"name\">Product Name</span></div>},
137
143
  content
138
144
  end
139
145
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: item
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Bunk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-29 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails