erector 0.9.0.pre1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/Gemfile +1 -1
- data/README.txt +3 -2
- data/Rakefile +39 -18
- data/VERSION.yml +1 -2
- data/bin/erector +6 -0
- data/lib/erector/abstract_widget.rb +15 -14
- data/lib/erector/caching.rb +2 -2
- data/lib/erector/convenience.rb +33 -1
- data/lib/erector/erect/erect.rb +2 -1
- data/lib/erector/externals.rb +10 -10
- data/lib/erector/html_widget.rb +1 -81
- data/lib/erector/needs.rb +3 -2
- data/lib/erector/rails/railtie.rb +2 -0
- data/lib/erector/rails3.rb +4 -1
- data/lib/erector/sass.rb +13 -2
- data/lib/erector/widget.rb +1 -1
- data/lib/erector/xml_widget.rb +2 -2
- data/spec/erector/convenience_spec.rb +4 -4
- data/spec/erector/needs_spec.rb +32 -13
- data/spec/erector/widget_spec.rb +11 -0
- data/spec/erector/xml_widget_spec.rb +2 -3
- data/spec/rails2/rails_app/Gemfile +2 -1
- data/spec/rails2/rails_app/Gemfile.lock +34 -31
- data/spec/rails2/rails_app/app/helpers/rails_helpers_spec_helper.rb +3 -0
- data/spec/rails2/rails_app/app/helpers/test_helper.rb +3 -0
- data/spec/rails2/rails_app/log/test.log +916 -2176
- data/spec/rails2/rails_app/spec/render_spec.rb +1 -1
- data/spec/rails_root/Gemfile +2 -1
- data/spec/rails_root/Gemfile.lock +126 -0
- data/spec/rails_root/app/views/layouts/widget_as_layout.rb +8 -0
- data/spec/rails_root/app/views/test/render_with_widget_as_layout.rb +5 -0
- data/spec/rails_root/app/views/test/render_with_widget_as_layout_using_content_for.rb +8 -0
- data/spec/rails_root/log/test.log +1974 -2147
- data/spec/rails_root/spec/rails_helpers_spec.rb +8 -0
- data/spec/rails_root/spec/render_spec.rb +29 -1
- data/spec/web/article_spec.rb +234 -0
- metadata +107 -76
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/MIT-LICENSE +0 -20
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/README.markdown +0 -90
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/Rakefile +0 -23
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/init.rb +0 -7
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/lib/rails_xss.rb +0 -3
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/lib/rails_xss/action_view.rb +0 -87
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/lib/rails_xss/erubis.rb +0 -33
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/lib/rails_xss/string_ext.rb +0 -52
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/lib/tasks/rails_xss_tasks.rake +0 -4
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/active_record_helper_test.rb +0 -74
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/asset_tag_helper_test.rb +0 -49
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/caching_test.rb +0 -43
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/date_helper_test.rb +0 -29
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/deprecated_output_safety_test.rb +0 -112
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/erb_util_test.rb +0 -36
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/form_helper_test.rb +0 -1447
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/form_tag_helper_test.rb +0 -354
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/output_safety_test.rb +0 -115
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/rails_xss_test.rb +0 -23
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/test_helper.rb +0 -5
- data/spec/rails2/rails_app/vendor/plugins/rails_xss/test/text_helper_test.rb +0 -17
- data/spec/rails_root/log/development.log +0 -17
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 Koziarski Software Ltd.
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,90 +0,0 @@
|
|
1
|
-
RailsXss
|
2
|
-
========
|
3
|
-
|
4
|
-
This plugin replaces the default ERB template handlers with erubis, and switches the behaviour to escape by default rather than requiring you to escape. This is consistent with the behaviour in Rails 3.0.
|
5
|
-
|
6
|
-
Strings now have a notion of "html safe", which is false by default. Whenever rails copies a string into the response body it checks whether or not the string is safe, safe strings are copied verbatim into the response body, but unsafe strings are escaped first.
|
7
|
-
|
8
|
-
All the XSS-proof helpers like link_to and form_tag now return safe strings, and will continue to work unmodified. If you have your own helpers which return strings you *know* are safe, you will need to explicitly tell rails that they're safe. For an example, take the following helper.
|
9
|
-
|
10
|
-
|
11
|
-
def some_helper
|
12
|
-
(1..5).map do |i|
|
13
|
-
"<li>#{i}</li>"
|
14
|
-
end.join("\n")
|
15
|
-
end
|
16
|
-
|
17
|
-
With this plugin installed, the html will be escaped. So you will need to do one of the following:
|
18
|
-
|
19
|
-
1) Use the raw helper in your template. raw will ensure that your string is copied verbatim into the response body.
|
20
|
-
|
21
|
-
<%= raw some_helper %>
|
22
|
-
|
23
|
-
2) Mark the string as safe in the helper itself:
|
24
|
-
|
25
|
-
def some_helper
|
26
|
-
(1..5).map do |i|
|
27
|
-
"<li>#{i}</li>"
|
28
|
-
end.join("\n").html_safe
|
29
|
-
end
|
30
|
-
|
31
|
-
3) Use the safe_helper meta programming method:
|
32
|
-
|
33
|
-
module ApplicationHelper
|
34
|
-
def some_helper
|
35
|
-
#...
|
36
|
-
end
|
37
|
-
safe_helper :some_helper
|
38
|
-
end
|
39
|
-
|
40
|
-
Example
|
41
|
-
-------
|
42
|
-
|
43
|
-
BEFORE:
|
44
|
-
|
45
|
-
<%= params[:own_me] %> => XSS attack
|
46
|
-
<%=h params[:own_me] %> => No XSS
|
47
|
-
<%= @blog_post.content %> => Displays the HTML
|
48
|
-
|
49
|
-
AFTER:
|
50
|
-
|
51
|
-
<%= params[:own_me] %> => No XSS
|
52
|
-
<%=h params[:own_me] %> => No XSS (same result)
|
53
|
-
<%= @blog_post.content %> => *escapes* the HTML
|
54
|
-
<%= raw @blog_post.content %> => Displays the HTML
|
55
|
-
|
56
|
-
|
57
|
-
Gotchas
|
58
|
-
---
|
59
|
-
|
60
|
-
#### textilize and simple_format do *not* return safe strings
|
61
|
-
|
62
|
-
Both these methods support arbitrary HTML and are *not* safe to embed directly in your document. You'll need to do something like:
|
63
|
-
|
64
|
-
<%= sanitize(textilize(@blog_post.content_textile)) %>
|
65
|
-
|
66
|
-
#### Safe strings aren't magic.
|
67
|
-
|
68
|
-
Once a string has been marked as safe, the only operations which will maintain that HTML safety are String#<<, String#concat and String#+. All other operations are safety ignorant so it's still probably possible to break your app if you're doing something like
|
69
|
-
|
70
|
-
value = something_safe
|
71
|
-
value.gsub!(/a/, params[:own_me])
|
72
|
-
|
73
|
-
Don't do that.
|
74
|
-
|
75
|
-
#### String interpolation won't be safe, even when it 'should' be
|
76
|
-
|
77
|
-
value = "#{something_safe}#{something_else_safe}"
|
78
|
-
value.html_safe? # => false
|
79
|
-
|
80
|
-
This is intended functionality and can't be fixed.
|
81
|
-
|
82
|
-
Getting Started
|
83
|
-
===============
|
84
|
-
|
85
|
-
1. Install rails 2.3.8 or higher, or freeze rails from 2-3-stable.
|
86
|
-
2. Install erubis (gem install erubis)
|
87
|
-
3. Install this plugin (ruby script/plugin install git://github.com/rails/rails_xss.git)
|
88
|
-
4. Report anything that breaks.
|
89
|
-
|
90
|
-
Copyright (c) 2009 Koziarski Software Ltd, released under the MIT license. For full details see MIT-LICENSE included in this distribution.
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
|
5
|
-
desc 'Default: run unit tests.'
|
6
|
-
task :default => :test
|
7
|
-
|
8
|
-
desc 'Test the rails_xss plugin.'
|
9
|
-
Rake::TestTask.new(:test) do |t|
|
10
|
-
t.libs << 'lib'
|
11
|
-
t.libs << 'test'
|
12
|
-
t.pattern = 'test/**/*_test.rb'
|
13
|
-
t.verbose = true
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Generate documentation for the rails_xss plugin.'
|
17
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
-
rdoc.rdoc_dir = 'rdoc'
|
19
|
-
rdoc.title = 'RailsXss'
|
20
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
-
rdoc.rdoc_files.include('README')
|
22
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
module ActionView
|
2
|
-
class Base
|
3
|
-
def self.xss_safe?
|
4
|
-
true
|
5
|
-
end
|
6
|
-
|
7
|
-
module WithSafeOutputBuffer
|
8
|
-
# Rails version of with_output_buffer uses '' as the default buf
|
9
|
-
def with_output_buffer(buf = ActiveSupport::SafeBuffer.new) #:nodoc:
|
10
|
-
super buf
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
include WithSafeOutputBuffer
|
15
|
-
end
|
16
|
-
|
17
|
-
module Helpers
|
18
|
-
module TextHelper
|
19
|
-
def concat(string, unused_binding = nil)
|
20
|
-
if unused_binding
|
21
|
-
ActiveSupport::Deprecation.warn("The binding argument of #concat is no longer needed. Please remove it from your views and helpers.", caller)
|
22
|
-
end
|
23
|
-
|
24
|
-
output_buffer.concat(string)
|
25
|
-
end
|
26
|
-
|
27
|
-
def simple_format_with_escaping(text, html_options = {})
|
28
|
-
simple_format_without_escaping(ERB::Util.h(text), html_options)
|
29
|
-
end
|
30
|
-
alias_method_chain :simple_format, :escaping
|
31
|
-
end
|
32
|
-
|
33
|
-
module TagHelper
|
34
|
-
private
|
35
|
-
def content_tag_string_with_escaping(name, content, options, escape = true)
|
36
|
-
content_tag_string_without_escaping(name, ERB::Util.h(content), options, escape)
|
37
|
-
end
|
38
|
-
alias_method_chain :content_tag_string, :escaping
|
39
|
-
end
|
40
|
-
|
41
|
-
module UrlHelper
|
42
|
-
def link_to(*args, &block)
|
43
|
-
if block_given?
|
44
|
-
options = args.first || {}
|
45
|
-
html_options = args.second
|
46
|
-
concat(link_to(capture(&block), options, html_options))
|
47
|
-
else
|
48
|
-
name = args.first
|
49
|
-
options = args.second || {}
|
50
|
-
html_options = args.third
|
51
|
-
|
52
|
-
url = url_for(options)
|
53
|
-
|
54
|
-
if html_options
|
55
|
-
html_options = html_options.stringify_keys
|
56
|
-
href = html_options['href']
|
57
|
-
convert_options_to_javascript!(html_options, url)
|
58
|
-
tag_options = tag_options(html_options)
|
59
|
-
else
|
60
|
-
tag_options = nil
|
61
|
-
end
|
62
|
-
|
63
|
-
href_attr = "href=\"#{url}\"" unless href
|
64
|
-
"<a #{href_attr}#{tag_options}>#{ERB::Util.h(name || url)}</a>".html_safe
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
module RailsXss
|
72
|
-
module SafeHelpers
|
73
|
-
def safe_helper(*names)
|
74
|
-
names.each do |helper_method_name|
|
75
|
-
aliased_target, punctuation = helper_method_name.to_s.sub(/([?!=])$/, ''), $1
|
76
|
-
module_eval <<-END
|
77
|
-
def #{aliased_target}_with_xss_safety#{punctuation}(*args, &block)
|
78
|
-
raw(#{aliased_target}_without_xss_safety#{punctuation}(*args, &block))
|
79
|
-
end
|
80
|
-
END
|
81
|
-
alias_method_chain helper_method_name, :xss_safety
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
Module.class_eval { include RailsXss::SafeHelpers }
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'erubis/helpers/rails_helper'
|
2
|
-
|
3
|
-
module RailsXss
|
4
|
-
class Erubis < ::Erubis::Eruby
|
5
|
-
def add_preamble(src)
|
6
|
-
src << "@output_buffer = ActiveSupport::SafeBuffer.new;"
|
7
|
-
end
|
8
|
-
|
9
|
-
def add_text(src, text)
|
10
|
-
return if text.empty?
|
11
|
-
src << "@output_buffer.safe_concat('" << escape_text(text) << "');"
|
12
|
-
end
|
13
|
-
|
14
|
-
def add_expr_literal(src, code)
|
15
|
-
if code =~ /\s*raw\s+(.*)/
|
16
|
-
src << "@output_buffer.safe_concat((" << $1 << ").to_s);"
|
17
|
-
else
|
18
|
-
src << '@output_buffer << ((' << code << ').to_s);'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def add_expr_escaped(src, code)
|
23
|
-
src << '@output_buffer << ' << escaped_expr(code) << ';'
|
24
|
-
end
|
25
|
-
|
26
|
-
def add_postamble(src)
|
27
|
-
src << '@output_buffer.to_s'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
Erubis::Helpers::RailsHelper.engine_class = RailsXss::Erubis
|
33
|
-
Erubis::Helpers::RailsHelper.show_src = false
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'active_support/deprecation'
|
2
|
-
|
3
|
-
ActiveSupport::SafeBuffer.class_eval do
|
4
|
-
def concat(value)
|
5
|
-
if value.html_safe?
|
6
|
-
super(value)
|
7
|
-
else
|
8
|
-
super(ERB::Util.h(value))
|
9
|
-
end
|
10
|
-
end
|
11
|
-
alias << concat
|
12
|
-
end
|
13
|
-
|
14
|
-
class String
|
15
|
-
def html_safe?
|
16
|
-
defined?(@_rails_html_safe)
|
17
|
-
end
|
18
|
-
|
19
|
-
def html_safe!
|
20
|
-
ActiveSupport::Deprecation.warn("Use html_safe with your strings instead of html_safe! See http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/ for the full story.", caller)
|
21
|
-
@_rails_html_safe = true
|
22
|
-
self
|
23
|
-
end
|
24
|
-
|
25
|
-
def add_with_safety(other)
|
26
|
-
result = add_without_safety(other)
|
27
|
-
if html_safe? && also_html_safe?(other)
|
28
|
-
result.html_safe!
|
29
|
-
else
|
30
|
-
result
|
31
|
-
end
|
32
|
-
end
|
33
|
-
alias_method :add_without_safety, :+
|
34
|
-
alias_method :+, :add_with_safety
|
35
|
-
|
36
|
-
def concat_with_safety(other_or_fixnum)
|
37
|
-
result = concat_without_safety(other_or_fixnum)
|
38
|
-
unless html_safe? && also_html_safe?(other_or_fixnum)
|
39
|
-
remove_instance_variable(:@_rails_html_safe) if defined?(@_rails_html_safe)
|
40
|
-
end
|
41
|
-
result
|
42
|
-
end
|
43
|
-
|
44
|
-
alias_method_chain :concat, :safety
|
45
|
-
undef_method :<<
|
46
|
-
alias_method :<<, :concat_with_safety
|
47
|
-
|
48
|
-
private
|
49
|
-
def also_html_safe?(other)
|
50
|
-
other.respond_to?(:html_safe?) && other.html_safe?
|
51
|
-
end
|
52
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ActiveRecordHelperTest < ActionView::TestCase
|
4
|
-
silence_warnings do
|
5
|
-
Post = Struct.new("Post", :title, :author_name, :body, :secret, :written_on)
|
6
|
-
Post.class_eval do
|
7
|
-
alias_method :title_before_type_cast, :title unless respond_to?(:title_before_type_cast)
|
8
|
-
alias_method :body_before_type_cast, :body unless respond_to?(:body_before_type_cast)
|
9
|
-
alias_method :author_name_before_type_cast, :author_name unless respond_to?(:author_name_before_type_cast)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def setup_post
|
14
|
-
@post = Post.new
|
15
|
-
def @post.errors
|
16
|
-
Class.new {
|
17
|
-
def on(field)
|
18
|
-
case field.to_s
|
19
|
-
when "author_name"
|
20
|
-
"can't be empty"
|
21
|
-
when "body"
|
22
|
-
true
|
23
|
-
else
|
24
|
-
false
|
25
|
-
end
|
26
|
-
end
|
27
|
-
def empty?() false end
|
28
|
-
def count() 1 end
|
29
|
-
def full_messages() [ "Author name can't be empty" ] end
|
30
|
-
}.new
|
31
|
-
end
|
32
|
-
|
33
|
-
def @post.new_record?() true end
|
34
|
-
def @post.to_param() nil end
|
35
|
-
|
36
|
-
def @post.column_for_attribute(attr_name)
|
37
|
-
Post.content_columns.select { |column| column.name == attr_name }.first
|
38
|
-
end
|
39
|
-
|
40
|
-
silence_warnings do
|
41
|
-
def Post.content_columns() [ Column.new(:string, "title", "Title"), Column.new(:text, "body", "Body") ] end
|
42
|
-
end
|
43
|
-
|
44
|
-
@post.title = "Hello World"
|
45
|
-
@post.author_name = ""
|
46
|
-
@post.body = "Back to the hill and over it again!"
|
47
|
-
@post.secret = 1
|
48
|
-
@post.written_on = Date.new(2004, 6, 15)
|
49
|
-
end
|
50
|
-
|
51
|
-
def setup
|
52
|
-
setup_post
|
53
|
-
|
54
|
-
@response = ActionController::TestResponse.new
|
55
|
-
|
56
|
-
@controller = Object.new
|
57
|
-
def @controller.url_for(options)
|
58
|
-
options = options.symbolize_keys
|
59
|
-
|
60
|
-
[options[:action], options[:id].to_param].compact.join('/')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_text_field_with_errors_is_safe
|
65
|
-
assert text_field("post", "author_name").html_safe?
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_text_field_with_errors
|
69
|
-
assert_dom_equal(
|
70
|
-
%(<div class="fieldWithErrors"><input id="post_author_name" name="post[author_name]" size="30" type="text" value="" /></div>),
|
71
|
-
text_field("post", "author_name")
|
72
|
-
)
|
73
|
-
end
|
74
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class AssetTagHelperTest < ActionView::TestCase
|
4
|
-
def setup
|
5
|
-
@controller = Class.new do
|
6
|
-
attr_accessor :request
|
7
|
-
def url_for(*args) "http://www.example.com" end
|
8
|
-
end.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_auto_discovery_link_tag
|
12
|
-
assert_dom_equal(%(<link href="http://www.example.com" rel="Not so alternate" title="ATOM" type="application/atom+xml" />),
|
13
|
-
auto_discovery_link_tag(:atom, {}, {:rel => "Not so alternate"}))
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_javascript_include_tag_with_blank_asset_id
|
17
|
-
ENV["RAILS_ASSET_ID"] = ""
|
18
|
-
assert_dom_equal(%(<script src="/javascripts/test.js" type="text/javascript"></script>\n<script src="/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/javascripts/effects.js" type="text/javascript"></script>\n<script src="/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/javascripts/controls.js" type="text/javascript"></script>\n<script src="/javascripts/application.js" type="text/javascript"></script>),
|
19
|
-
javascript_include_tag("test", :defaults))
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_javascript_include_tag_with_given_asset_id
|
23
|
-
ENV["RAILS_ASSET_ID"] = "1"
|
24
|
-
assert_dom_equal(%(<script src="/javascripts/prototype.js?1" type="text/javascript"></script>\n<script src="/javascripts/effects.js?1" type="text/javascript"></script>\n<script src="/javascripts/dragdrop.js?1" type="text/javascript"></script>\n<script src="/javascripts/controls.js?1" type="text/javascript"></script>\n<script src="/javascripts/application.js?1" type="text/javascript"></script>),
|
25
|
-
javascript_include_tag(:defaults))
|
26
|
-
ENV["RAILS_ASSET_ID"] = ""
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_javascript_include_tag_is_html_safe
|
30
|
-
assert javascript_include_tag(:defaults).html_safe?
|
31
|
-
assert javascript_include_tag("prototype").html_safe?
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_stylesheet_link_tag
|
35
|
-
assert_dom_equal(%(<link href="http://www.example.com/styles/style.css" media="screen" rel="stylesheet" type="text/css" />),
|
36
|
-
stylesheet_link_tag("http://www.example.com/styles/style"))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_stylesheet_link_tag_is_html_safe
|
40
|
-
assert stylesheet_link_tag('dir/file').html_safe?
|
41
|
-
assert stylesheet_link_tag('dir/other/file', 'dir/file2').html_safe?
|
42
|
-
assert stylesheet_tag('dir/file', {}).html_safe?
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_image_tag
|
46
|
-
assert_dom_equal(%(<img alt="Mouse" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" src="/images/mouse.png" />),
|
47
|
-
image_tag("mouse.png", :mouseover => image_path("mouse_over.png")))
|
48
|
-
end
|
49
|
-
end
|