actionview-link_to_blank 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: d94df4b22bc97e22f3f7bf4481a8a6da7f46b74e
4
- data.tar.gz: db5845fcd712e90a911633b6aed88698a80b89c3
3
+ metadata.gz: 0837a75705362f414dcb9dd238aea537af4eabd1
4
+ data.tar.gz: 3d620166ab6a1ab7c0621835627cc8943f30fda4
5
5
  SHA512:
6
- metadata.gz: d98dcb095120c4a4425b6a390143cb8f2273673105f708bb1a676623a68cd156485a32b6c8dd9f79e9f960b42e27236f20d8815a195508cba2c682be1f244412
7
- data.tar.gz: 16d233161d4c60b986303c855253be0f92458eb9da6afce71043572d1a94c7dcb5023bb38f64a1dcc361b185b92558d2c32f8cdc95ff7bd1ca166aa864113a9e
6
+ metadata.gz: 37c1f11a79b91925f569596f5d0abff9f5bb6428b2a5a109cf163779827cfb8d8487571d07c352b7d1fe7ea9d728146948b90214b3c1511e848648197c2c0c98
7
+ data.tar.gz: 1f769ba6546238ea40ea7407f8e115a824bf15d4bff76a16650a7026d4d25288f81c3667c5ab852c1dcc0f6cf0f0ef94a60fc378c0ceff384befaef95378be01
@@ -2,11 +2,16 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.1
6
+ before_install:
7
+ - gem update bundler
5
8
  gemfile:
6
9
  - gemfiles/rails_3_2.gemfile
7
10
  - gemfiles/rails_3_2_stable.gemfile
8
11
  - gemfiles/rails_4_0.gemfile
9
12
  - gemfiles/rails_4_0_stable.gemfile
13
+ - gemfiles/rails_4_1.gemfile
14
+ - gemfiles/rails_4_1_stable.gemfile
10
15
  - gemfiles/rails_master.gemfile
11
16
  branches:
12
17
  only:
data/Appraisals CHANGED
@@ -5,12 +5,19 @@ appraise "rails_3_2" do
5
5
  end
6
6
 
7
7
  appraise "rails_4_0" do
8
- version = '~> 4.0.0.beta'
8
+ version = '~> 4.0.0'
9
+ gem 'actionpack', version
10
+ gem 'activesupport', version
11
+ end
12
+
13
+ appraise "rails_4_1" do
14
+ version = '~> 4.1.0'
9
15
  gem 'actionpack', version
10
16
  gem 'activesupport', version
11
17
  end
12
18
 
13
19
  appraise "rails_master" do
20
+ gem 'actionview', github: 'rails/rails', branch: 'master'
14
21
  gem 'actionpack', github: 'rails/rails', branch: 'master'
15
22
  gem 'activesupport', github: 'rails/rails', branch: 'master'
16
23
  end
@@ -24,3 +31,8 @@ appraise "rails_4_0_stable" do
24
31
  gem 'actionpack', github: 'rails/rails', branch: '4-0-stable'
25
32
  gem 'activesupport', github: 'rails/rails', branch: '4-0-stable'
26
33
  end
34
+
35
+ appraise "rails_4_1_stable" do
36
+ gem 'actionpack', github: 'rails/rails', branch: '4-1-stable'
37
+ gem 'activesupport', github: 'rails/rails', branch: '4-1-stable'
38
+ end
data/README.md CHANGED
@@ -73,17 +73,18 @@ Use the `link_to_blank` helper method, equal `link_to('foo', target: '_blank')`
73
73
 
74
74
  $ bundle exec rake
75
75
 
76
- If you want to run against actionpack v3 and v4, run below:
76
+ If you want to run against actionpack v3.2, v4.0, v4.1, and v4.2 run below:
77
77
 
78
- $ bundle exec rake appraisal:install
79
- $ bundle exec rake appraisal
78
+ $ bundle exec appraisal install
79
+ $ bundle exec appraisal rake
80
80
 
81
81
  Test for specific version:
82
82
 
83
- $ bundle exec rake appraisal:install
84
- $ bundle exec rake appraisal:rails4_0
83
+ $ bundle exec appraisal install
84
+ $ bundle exec appraisal rails_4_0 rake
85
85
 
86
- Prepare rails4_0 and rails3_2
86
+ Prepare rails_3_2(gem), rails_3_2_stable(github), rails_4_0(gem), rails_4_0_stable(github), rails_4_1(gem),
87
+ rails_4_1_stable(github), rails_master(github)
87
88
 
88
89
  ## Contributing
89
90
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "bundler", '>= 1.3'
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency 'minitest'
24
24
 
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
  gem "coveralls", :require=>false
6
6
  gem "pry"
7
7
  gem "appraisal", :github=>"thoughtbot/appraisal"
8
- gem "actionpack", "~> 4.0.0.beta"
9
- gem "activesupport", "~> 4.0.0.beta"
8
+ gem "actionpack", "~> 4.0.0"
9
+ gem "activesupport", "~> 4.0.0"
10
10
 
11
11
  gemspec :path=>".././"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "coveralls", :require=>false
6
+ gem "pry"
7
+ gem "appraisal", :github=>"thoughtbot/appraisal"
8
+ gem "actionpack", "~> 4.1.0"
9
+ gem "activesupport", "~> 4.1.0"
10
+
11
+ gemspec :path=>".././"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "coveralls", :require=>false
6
+ gem "pry"
7
+ gem "appraisal", :github=>"thoughtbot/appraisal"
8
+ gem "actionpack", :github=>"rails/rails", :branch=>"4-1-stable"
9
+ gem "activesupport", :github=>"rails/rails", :branch=>"4-1-stable"
10
+
11
+ gemspec :path=>".././"
@@ -5,6 +5,7 @@ source "https://rubygems.org"
5
5
  gem "coveralls", :require=>false
6
6
  gem "pry"
7
7
  gem "appraisal", :github=>"thoughtbot/appraisal"
8
+ gem "actionview", :github=>"rails/rails", :branch=>"master"
8
9
  gem "actionpack", :github=>"rails/rails", :branch=>"master"
9
10
  gem "activesupport", :github=>"rails/rails", :branch=>"master"
10
11
 
@@ -24,7 +24,7 @@ module LinkToBlank
24
24
  if block_given?
25
25
  block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block)
26
26
  else
27
- name
27
+ ERB::Util.html_escape(name)
28
28
  end
29
29
  else
30
30
  link_to_blank(name, options, html_options)
@@ -1,5 +1,5 @@
1
1
  module ActionView
2
2
  module LinkToBlank
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -4,6 +4,7 @@ Coveralls.wear!
4
4
 
5
5
  require 'minitest/autorun'
6
6
  require 'active_support/concern'
7
+ require 'active_support/deprecation'
7
8
  require 'active_support/core_ext'
8
9
  require 'active_support/testing/deprecation'
9
10
  require 'action_view'
@@ -25,7 +26,14 @@ module RenderERBUtils
25
26
  end
26
27
  end
27
28
 
28
- class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
29
+ # Rails4.1, this code is here:
30
+ # actionview/test/template/url_helper_test.rb
31
+ # and base class is ActiveSupport::TestCase
32
+
33
+ # Ensure backward compatibility with Minitest 4
34
+ Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
35
+
36
+ class TestActionViewLinkToBlank < MiniTest::Test
29
37
 
30
38
  # In a few cases, the helper proxies to 'controller'
31
39
  # or request.
@@ -33,6 +41,9 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
33
41
  # In those cases, we'll set up a simple mock
34
42
  attr_accessor :controller, :request
35
43
 
44
+ cattr_accessor :request_forgery
45
+ self.request_forgery = false
46
+
36
47
  routes = ActionDispatch::Routing::RouteSet.new
37
48
  routes.draw do
38
49
  get "/" => "foo#bar"
@@ -109,6 +120,7 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
109
120
 
110
121
  def test_link_tag_with_custom_onclick
111
122
  link = link_to_blank("Hello", "http://www.example.com", onclick: "alert('yay!')")
123
+ # NOTE: differences between AP v3 and v4
112
124
  escaped_onclick = ActionPack::VERSION::MAJOR == 3 ? %{alert(&#x27;yay!&#x27;)} : %{alert(&#39;yay!&#39;)}
113
125
  expected = %{<a href="http://www.example.com" onclick="#{escaped_onclick}" target="_blank">Hello</a>}
114
126
  assert_dom_equal expected, link
@@ -131,7 +143,7 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
131
143
 
132
144
  def test_link_tag_with_deprecated_confirm
133
145
  skip('Not deprecate in Rails3.2') if ActionPack::VERSION::MAJOR == 3
134
- skip('Remove in Rails4.1') if ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR >= 1
146
+ skip('Remove in Rails4.1') if ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1
135
147
  assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
136
148
  assert_dom_equal(
137
149
  %{<a href="http://www.example.com" data-confirm="Are you sure?" target="_blank">Hello</a>},
@@ -217,7 +229,7 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
217
229
 
218
230
  def test_link_tag_using_post_javascript_and_with_deprecated_confirm
219
231
  skip('Not deprecate in Rails3.2') if ActionPack::VERSION::MAJOR == 3
220
- skip('Remove in Rails4.1') if ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR >= 1
232
+ skip('Remove in Rails4.1') if ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1
221
233
  assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
222
234
  assert_dom_equal(
223
235
  %{<a href="http://www.example.com" data-method="post" rel="nofollow" data-confirm="Are you serious?" target="_blank">Hello</a>},
@@ -235,7 +247,7 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
235
247
 
236
248
  def test_link_tag_using_delete_javascript_and_href_and_with_deprecated_confirm
237
249
  skip('Not deprecate in Rails3.2') if ActionPack::VERSION::MAJOR == 3
238
- skip('Remove in Rails4.1') if ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR >= 1
250
+ skip('Remove in Rails4.1') if ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1
239
251
  assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
240
252
  assert_dom_equal(
241
253
  %{<a href="\#" rel="nofollow" data-confirm="Are you serious?" data-method="delete" target="_blank">Destroy</a>},
@@ -254,6 +266,13 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
254
266
  link_to_blank('/', class: "special") { content_tag(:span, 'Example site') }
255
267
  end
256
268
 
269
+ def test_link_tag_using_block_and_hash
270
+ assert_dom_equal(
271
+ %{<a href="/" target="_blank"><span>Example site</span></a>},
272
+ link_to_blank(url_hash) { content_tag(:span, 'Example site') }
273
+ )
274
+ end
275
+
257
276
  def test_link_tag_using_block_in_erb
258
277
  out = render_erb %{<%= link_to_blank('/') do %>Example site<% end %>}
259
278
  assert_equal '<a href="/" target="_blank">Example site</a>', out
@@ -297,12 +316,17 @@ class TestActionViewLinkToBlank < MiniTest::Unit::TestCase
297
316
  link_to_blank_unless(true, "Showing", url_hash) {
298
317
  "test"
299
318
  }
319
+
320
+ # FIXME
321
+ assert_equal %{&lt;b&gt;Showing&lt;/b&gt;}, link_to_blank_unless(true, "<b>Showing</b>", url_hash)
322
+ assert_equal %{<a href="/">&lt;b&gt;Showing&lt;/b&gt;</a>}, link_to_unless(false, "<b>Showing</b>", url_hash)
323
+ assert_equal %{<b>Showing</b>}, link_to_unless(true, "<b>Showing</b>".html_safe, url_hash)
324
+ assert_equal %{<a href="/"><b>Showing</b></a>}, link_to_unless(false, "<b>Showing</b>".html_safe, url_hash)
300
325
  end
301
326
 
302
327
  def test_link_to_if
303
328
  assert_equal "Showing", link_to_blank_if(false, "Showing", url_hash)
304
329
  assert_dom_equal %{<a href="/" target="_blank">Listing</a>}, link_to_blank_if(true, "Listing", url_hash)
305
- assert_equal "Showing", link_to_blank_if(false, "Showing", url_hash)
306
330
  end
307
331
 
308
332
  def request_for_url(url, opts = {})
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview-link_to_blank
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sanemat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-16 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: actionpack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Alias link_to with target _blank
@@ -87,8 +87,8 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
92
  - Appraisals
93
93
  - Gemfile
94
94
  - LICENSE.txt
@@ -99,6 +99,8 @@ files:
99
99
  - gemfiles/rails_3_2_stable.gemfile
100
100
  - gemfiles/rails_4_0.gemfile
101
101
  - gemfiles/rails_4_0_stable.gemfile
102
+ - gemfiles/rails_4_1.gemfile
103
+ - gemfiles/rails_4_1_stable.gemfile
102
104
  - gemfiles/rails_master.gemfile
103
105
  - lib/action_view/link_to_blank/link_to_blank.rb
104
106
  - lib/action_view/link_to_blank/railtie.rb
@@ -115,17 +117,17 @@ require_paths:
115
117
  - lib
116
118
  required_ruby_version: !ruby/object:Gem::Requirement
117
119
  requirements:
118
- - - '>='
120
+ - - ">="
119
121
  - !ruby/object:Gem::Version
120
122
  version: '0'
121
123
  required_rubygems_version: !ruby/object:Gem::Requirement
122
124
  requirements:
123
- - - '>='
125
+ - - ">="
124
126
  - !ruby/object:Gem::Version
125
127
  version: '0'
126
128
  requirements: []
127
129
  rubyforge_project:
128
- rubygems_version: 2.0.2
130
+ rubygems_version: 2.2.2
129
131
  signing_key:
130
132
  specification_version: 4
131
133
  summary: Alias link_to with target _blank