padrino-helpers 0.1.4 → 0.1.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -16,14 +16,15 @@ module Padrino
16
16
  # link_to('/dashboard', :class => 'blocky') do ... end
17
17
  # parameters: name, url='javascript:void(0)', options={}, &block
18
18
  def link_to(*args, &block)
19
+ options = args.extract_options!
19
20
  if block_given?
20
- url, options = (args[0] || 'javascript:void(0);'), (args[1] || {})
21
+ url = args[0] || 'javascript:void(0);'
21
22
  options.reverse_merge!(:href => url)
22
23
  link_content = capture_html(&block)
23
24
  result_link = content_tag(:a, link_content, options)
24
25
  block_is_template?(block) ? concat_content(result_link) : result_link
25
26
  else
26
- name, url, options = args.first, (args[1] || 'javascript:void(0);'), (args[2] || {})
27
+ name, url = args[0], (args[1] || 'javascript:void(0);')
27
28
  options.reverse_merge!(:href => url)
28
29
  content_tag(:a, name, options)
29
30
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{padrino-helpers}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
data/test/helper.rb CHANGED
@@ -8,7 +8,7 @@ require 'webrat'
8
8
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
9
  $LOAD_PATH.unshift(File.dirname(__FILE__))
10
10
  require 'support_helpers'
11
- require 'padrino-helpers'
11
+ require File.dirname(__FILE__) + '/../lib/padrino-helpers'
12
12
 
13
13
  class Test::Unit::TestCase
14
14
  include Padrino::Helpers::OutputHelpers
@@ -30,6 +30,10 @@ class TestAssetTagHelpers < Test::Unit::TestCase
30
30
  actual_html = link_to('Sign up', '/register', :class => 'first', :id => 'linky')
31
31
  assert_has_tag('a#linky.first', :content => "Sign up", :href => '/register') { actual_html }
32
32
  end
33
+ should "display link element with void url and options" do
34
+ actual_link = link_to('Sign up', :class => "test")
35
+ assert_has_tag('a', :content => "Sign up", :href => 'javascript:void(0);', :class => 'test') { actual_link }
36
+ end
33
37
  should "display link element with ruby block" do
34
38
  actual_link = link_to('/register', :class => 'first', :id => 'binky') { "Sign up" }
35
39
  assert_has_tag('a#binky.first', :content => "Sign up", :href => '/register') { actual_link }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team