showcase 0.2.0.rc.3 → 0.2.0.rc.4

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: 07623d8209466223ba0fe77ed697c570d44297b6
4
- data.tar.gz: fe4e0c8596aa7224abbd3263ebee03b403b60bbd
3
+ metadata.gz: ea7a961ec1b6c1052fad8382dbac298219823089
4
+ data.tar.gz: 57e69cf51b6380e1f1e400ccfc7476eded417201
5
5
  SHA512:
6
- metadata.gz: b9306cd9390ec58281aba58230281d898f2cbdda548a1b17272cdb3d0de904b07c2ab13e3533bcae904eabd850b8776597b8c04970e9521c83e9921a2ffa708d
7
- data.tar.gz: 9c2859b89fa7f649d7957ef8394d23b0171a53c0383f2b8404eea83c72117b76e9f58a26acfb7f5783074779d1cb815cde9ffb41f7ead0ee42a3af6606fa75f0
6
+ metadata.gz: 230965dd32b8151f9ed5f43c72614ad951825f79e1dedea1717300fbb74374b890ae14536d4d9dace620740482b09c972e62d5fbbcf58cae53b1812510288bfc
7
+ data.tar.gz: 4c07a160bf50ef8ed1cfd512a29c29b6b827722228d3d7ce7469d4766a2de341602ea07bf5af8405f7e4aafc4a1eb9ea15d4a8a7a074ddaf255ce14e2b2b1e35
@@ -21,9 +21,15 @@ module Showcase
21
21
  define_module_method [name, :link] do |*args, &link_block|
22
22
  config = Helpers::ConfigObject.new(self, &block).to_struct
23
23
 
24
+ options = args.extract_options!.symbolize_keys
25
+
26
+ active_class = if options[:active_class]
27
+ options.delete(:active_class)
28
+ end
29
+
24
30
  html_options = HtmlOptions.new(config.html_options)
25
- html_options.merge_attrs!(args.extract_options!)
26
- html_options.add_class!(config.active_class || 'active') if config.active
31
+ html_options.merge_attrs!(options)
32
+ html_options.add_class!(active_class || config.active_class || 'active') if config.active
27
33
 
28
34
  args = Array(config.label) if args.empty? && !link_block
29
35
  h.link_to *args, config.url, html_options.to_h, &link_block
@@ -1,4 +1,4 @@
1
1
  module Showcase
2
- VERSION = "0.2.0.rc.3"
2
+ VERSION = "0.2.0.rc.4"
3
3
  end
4
4
 
@@ -81,11 +81,17 @@ module Showcase::Traits
81
81
  end
82
82
  end
83
83
 
84
- context 'if a different CSS class was specified' do
84
+ context 'if a different CSS class was specified at DSL level' do
85
85
  it 'adds it to the link' do
86
86
  expect(subject.foo_link('label')).to have_tag(:a, with: { class: 'current' })
87
87
  end
88
88
  end
89
+
90
+ context 'if a different CSS class was specified at method-call level' do
91
+ it 'adds it to the link' do
92
+ expect(subject.link('label', active_class: 'current')).to have_tag(:a, with: { class: 'current' })
93
+ end
94
+ end
89
95
  end
90
96
  end
91
97
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showcase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.rc.3
4
+ version: 0.2.0.rc.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna