Skip to content
Browse files

Remove trailing whitespace

  • Loading branch information...
1 parent 4664459 commit acb563e2331e9434de18a4e7fdba24ff24ad8259 @smtlaissezfaire smtlaissezfaire committed
Showing with 151 additions and 151 deletions.
  1. +4 −4 README.rdoc
  2. +3 −3 Rakefile
  3. +2 −2 garlic.rb
  4. +1 −1 init.rb
  5. +1 −1 lib/markaby.rb
  6. +18 −18 lib/markaby/builder.rb
  7. +4 −4 lib/markaby/builder_tags.rb
  8. +7 −7 lib/markaby/cssproxy.rb
  9. +1 −1 lib/markaby/kernel_method.rb
  10. +4 −4 lib/markaby/rails.rb
  11. +3 −3 lib/markaby/rails/current.rb
  12. +5 −5 lib/markaby/rails/deprecated.rb
  13. +1 −1 lib/markaby/rails/rails_builder.rb
  14. +5 −5 lib/markaby/tags.rb
  15. +17 −17 spec/markaby/builder_spec.rb
  16. +1 −1 spec/markaby/markaby_other_static.mab
  17. +20 −20 spec/markaby/markaby_spec.rb
  18. +1 −1 spec/markaby/rails/spec_helper.rb
  19. +1 −1 spec/markaby/rails/views/markaby/_a_partial.mab
  20. +1 −1 spec/markaby/rails/views/markaby/_partial_child_with_locals.mab
  21. +1 −1 spec/markaby/rails/views/markaby/access_to_helpers.mab
  22. +1 −1 spec/markaby/rails/views/markaby/broken.mab
  23. +1 −1 spec/markaby/rails/views/markaby/correct_template_values.mab
  24. +1 −1 spec/markaby/rails/views/markaby/form_for.mab
  25. +1 −1 spec/markaby/rails/views/markaby/form_for_with_fields.mab
  26. +1 −1 spec/markaby/rails/views/markaby/form_for_with_multiple_fields.mab
  27. +1 −1 spec/markaby/rails/views/markaby/no_values_passed.mab
  28. +1 −1 spec/markaby/rails/views/markaby/partial_parent.mab
  29. +2 −2 spec/markaby/rails/views/markaby/partial_parent_with_locals.mab
  30. +1 −1 spec/markaby/rails/views/markaby/render_erb_without_explicit_render_call.erb
  31. +1 −1 spec/markaby/rails/views/markaby/render_mab_without_explicit_render_call.mab
  32. +1 −1 spec/markaby/rails/views/markaby/render_with_ivar.mab
  33. +1 −1 spec/markaby/rails/views/markaby/renders_erb.rhtml
  34. +25 −25 spec/markaby/rails_spec.rb
  35. +6 −6 spec/markaby/rails_version_spec.rb
  36. +1 −1 spec/markaby/tilt/locals.mab
  37. +1 −1 spec/markaby/tilt/markaby.mab
  38. +1 −1 spec/markaby/tilt/markaby_other_static.mab
  39. +1 −1 spec/markaby/tilt/render_twice.mab
  40. +1 −1 spec/markaby/tilt/scope.mab
  41. +1 −1 spec/spec.opts
View
8 README.rdoc
@@ -14,10 +14,10 @@ Write Rails templates in pure Ruby. Example layout:
title 'Products: ' + action_name
stylesheet_link_tag 'scaffold'
end
-
+
body do
p flash[:notice], :style => "color: green"
-
+
self << content_for_layout
end
end
@@ -121,7 +121,7 @@ Which results in:
</div>
</div>
-== 3. Validate Your XHTML 1.0 Output
+== 3. Validate Your XHTML 1.0 Output
If you'd like Markaby to help you assemble valid XHTML documents,
you can use the <tt>xhtml_transitional</tt> or <tt>xhtml_strict</tt>
@@ -215,7 +215,7 @@ won't work with this technique.
= A Note About Rails Helpers
-When used in Rails templates, the Rails helper object is passed into
+When used in Rails templates, the Rails helper object is passed into
Markaby::Builder. When you call helper methods inside Markaby, the output
from those methods will be output to the stream. This is incredibly
handy, since most Rails helpers output HTML tags.
View
6 Rakefile
@@ -4,7 +4,7 @@ require 'rake/clean'
begin
require 'hanna/rdoctask'
-
+
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.options << '--line-numbers'
@@ -24,7 +24,7 @@ end
begin
require 'jeweler'
-
+
Jeweler::Tasks.new do |gemspec|
gemspec.name = "Markaby"
gemspec.summary = "Markup as Ruby, write HTML in your native Ruby tongue"
@@ -61,7 +61,7 @@ end
namespace :release do
task :patch => [:spec, "version:bump:patch", :update_gemspec, :rerdoc, :tag_release, :build, :push_tags]
-
+
task :update_gemspec => ["gemspec:generate", "gemspec:validate", "gemspec:commit"]
task :tag_release do
require File.dirname(__FILE__) + "/lib/markaby"
View
4 garlic.rb
@@ -3,7 +3,7 @@
garlic do
# this plugin
repo "markaby", :path => '.'
-
+
# other repos
repo "rails", :url => "git://github.com/rails/rails"
@@ -18,7 +18,7 @@
prepare do
plugin "markaby", :clone => true # so we can work in targets
end
-
+
run do
cd "vendor/plugins/markaby" do
sh "rake"
View
2 init.rb
@@ -3,4 +3,4 @@
require 'markaby'
require 'markaby/rails'
-Markaby::Rails.load
+Markaby::Rails.load
View
2 lib/markaby.rb
@@ -8,7 +8,7 @@
# Markaby is a module containing all of the great Markaby classes that
# do such an excellent job.
-#
+#
# * Markaby::Builder: the class for actually calling the Ruby methods
# which write the HTML.
# * Markaby::CSSProxy: a class which adds element classes and IDs to
View
36 lib/markaby/builder.rb
@@ -21,7 +21,7 @@ module Markaby
#
class Builder
include Markaby::BuilderTags
-
+
DEFAULT_OPTIONS = {
:indent => 0,
:output_helpers => true,
@@ -35,28 +35,28 @@ class Builder
:lang => 'en'
}
}
-
+
@@options = DEFAULT_OPTIONS.dup
-
+
def self.restore_defaults!
@@options = DEFAULT_OPTIONS.dup
end
-
+
def self.set(option, value)
@@options[option] = value
end
-
+
def self.get(option)
@@options[option]
end
def self.ignored_helpers
- @@ignored_helpers ||= []
- end
-
- def self.ignore_helpers(*helpers)
- ignored_helpers.concat helpers
- end
+ @@ignored_helpers ||= []
+ end
+
+ def self.ignore_helpers(*helpers)
+ ignored_helpers.concat helpers
+ end
attr_accessor :output_helpers, :tagset
@@ -84,7 +84,7 @@ def initialize(assigns = {}, helper = nil, &block)
@@options.each do |k, v|
instance_variable_set("@#{k}", @assigns.delete(k) || v)
end
-
+
@assigns.each do |k, v|
instance_variable_set("@#{k}", v)
end
@@ -158,7 +158,7 @@ def tag!(tag, *args, &block)
if @tagset.forms.include?(tag) && attrs[:id]
attrs[:name] ||= attrs[:id]
end
-
+
attrs.each do |k, v|
atname = k.to_s.downcase.intern
unless k =~ /:/ or @tagset.tagset[tag].include? atname
@@ -173,7 +173,7 @@ def tag!(tag, *args, &block)
end
end
end
-
+
if block
str = capture(&block)
block = proc { text(str) }
@@ -245,23 +245,23 @@ def initialize(*args)
@stream, @start, @length = args
@transformed_stream = false
end
-
+
private
def method_missing(*args, &block)
transform_stream unless transformed_stream?
@str.__send__(*args, &block)
end
-
+
def transform_stream
@transformed_stream = true
-
+
# We can't do @stream.slice!(@start, @length),
# as it would invalidate the @starts and @lengths of other Fragment instances.
@str = @stream[@start, @length].to_s
@stream[@start, @length] = [nil] * @length
end
-
+
def transformed_stream?
@transformed_stream
end
View
8 lib/markaby/builder_tags.rb
@@ -7,7 +7,7 @@ def #{k}(*args, &block)
end
CODE
end
-
+
# Every HTML tag method goes through an html_tag call. So, calling <tt>div</tt> is equivalent
# to calling <tt>html_tag(:div)</tt>. All HTML tags in Markaby's list are given generated wrappers
# for this method.
@@ -52,13 +52,13 @@ def xhtml_frameset(attrs = {}, &block)
self.tagset = Markaby::XHTMLFrameset
xhtml_html(attrs, &block)
end
-
+
private
-
+
def xhtml_html(attrs = {}, &block)
instruct! if @output_xml_instruction
declare!(:DOCTYPE, :html, :PUBLIC, *tagset.doctype)
tag!(:html, @root_attributes.merge(attrs), &block)
end
end
-end
+end
View
14 lib/markaby/cssproxy.rb
@@ -9,12 +9,12 @@ def initialize(builder, stream, sym)
@stream = stream
@sym = sym
@attrs = {}
-
+
@original_stream_length = @stream.length
-
+
@builder.tag! sym
end
-
+
def respond_to?(sym, include_private = false)
include_private || !private_methods.include?(sym.to_s) ? true : false
end
@@ -36,19 +36,19 @@ def method_missing(id_or_class, *args, &block)
@attrs.merge! args.pop.to_hash
end
end
-
+
args.push(@attrs)
-
+
while @stream.length > @original_stream_length
@stream.pop
end
-
+
if block
@builder.tag! @sym, *args, &block
else
@builder.tag! @sym, *args
end
-
+
self
end
end
View
2 lib/markaby/kernel_method.rb
@@ -4,4 +4,4 @@ module Kernel
def mab(*args, &block)
Markaby::Builder.new(*args, &block).to_s
end
-end
+end
View
8 lib/markaby/rails.rb
@@ -12,7 +12,7 @@ module Rails
"2.1.2",
"2.3.0"
]
-
+
DEPRECATED_RAILS_VERSIONS = [
"1.2.2",
"1.2.3",
@@ -20,7 +20,7 @@ module Rails
"1.2.5",
"1.2.6"
]
-
+
FULLY_SUPPORTED_RAILS_VERSIONS = [
"2.2.0",
"2.2.1",
@@ -35,7 +35,7 @@ module Rails
]
SUPPORTED_RAILS_VERSIONS = DEPRECATED_RAILS_VERSIONS + FULLY_SUPPORTED_RAILS_VERSIONS
-
+
class << self
def load
check_rails_version
@@ -46,7 +46,7 @@ def load
require File.dirname(__FILE__) + "/rails/current"
end
end
-
+
def deprecated_rails_version?
DEPRECATED_RAILS_VERSIONS.include?(detected_rails_version)
end
View
6 lib/markaby/rails/current.rb
@@ -4,7 +4,7 @@ module Markaby
module Rails
class TemplateHandler < ::ActionView::TemplateHandler
include ActionView::TemplateHandlers::Compilable
-
+
def compile(template, local_assigns={})
<<-CODE
handler = Markaby::Rails::TemplateHandler.new
@@ -16,7 +16,7 @@ def compile(template, local_assigns={})
def render(template, local_assigns = (template.respond_to?(:locals) ? template.locals : {}))
builder = RailsBuilder.new(instance_variables.merge(local_assigns), @view)
@view.output_buffer = builder
-
+
template.is_a?(Proc) ?
builder.instance_eval(&template) :
builder.instance_eval(template.source)
@@ -43,4 +43,4 @@ def instance_variable_hash(object)
end
end
-ActionView::Template.register_template_handler(:mab, Markaby::Rails::TemplateHandler)
+ActionView::Template.register_template_handler(:mab, Markaby::Rails::TemplateHandler)
View
10 lib/markaby/rails/deprecated.rb
@@ -43,7 +43,7 @@ def render(*args)
output.to_s
end
end
-
+
# Markaby helpers for Rails.
module ActionControllerHelpers
# Returns a string of HTML built from the attached +block+. Any +options+ are
@@ -82,10 +82,10 @@ def _erbout
@_erbout ||= FauxErbout.new(self)
end
- # Content_for will store the given block in an instance variable for later use
+ # Content_for will store the given block in an instance variable for later use
# in another template or in the layout.
#
- # The name of the instance variable is content_for_<name> to stay consistent
+ # The name of the instance variable is content_for_<name> to stay consistent
# with @content_for_layout which is used by ActionView's layouts.
#
# Example:
@@ -115,10 +115,10 @@ def method_missing(*args, &block)
end
end
end
-
+
if defined? ActionView::Template and ActionView::Template.respond_to? :register_template_handler
ActionView::Template
else
ActionView::Base
end.register_template_handler(:mab, Markaby::Rails::ActionViewTemplateHandler)
-end
+end
View
2 lib/markaby/rails/rails_builder.rb
@@ -47,4 +47,4 @@ def method_missing(sym, *args, &block)
end
end
end
-end
+end
View
10 lib/markaby/tags.rb
@@ -25,7 +25,7 @@ class XHTMLStrict
class << self
attr_accessor :tags, :tagset, :forms, :self_closing, :doctype
end
-
+
@doctype = ['-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd']
@tagset = {
:html => AttrI18n + [:id, :xmlns],
@@ -117,14 +117,14 @@ class XHTMLTransitional
class << self
attr_accessor :tags, :tagset, :forms, :self_closing, :doctype
end
-
+
@doctype = ['-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd']
@tagset = XHTMLStrict.tagset.merge({
:strike => Attrs,
:center => Attrs,
:dir => Attrs + [:compact],
:noframes => Attrs,
- :basefont => [:id, :size, :color, :face],
+ :basefont => [:id, :size, :color, :face],
:u => Attrs,
:menu => Attrs + [:compact],
:iframe => AttrCore + [:longdesc, :name, :src, :frameborder, :marginwidth, :marginheight, :scrolling, :align, :height, :width],
@@ -164,7 +164,7 @@ class << self
:area => [:target],
:h1 => [:align]
}
-
+
additional_tags.each do |k, v|
@tagset[k] += v
end
@@ -179,7 +179,7 @@ class XHTMLFrameset
class << self
attr_accessor :tags, :tagset, :forms, :self_closing, :doctype
end
-
+
@doctype = ['-//W3C//DTD XHTML 1.0 Frameset//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd']
@tagset = XHTMLTransitional.tagset.merge({
:frameset => AttrCore + [:rows, :cols, :onload, :onunload],
View
34 spec/markaby/builder_spec.rb
@@ -13,12 +13,12 @@ module Markaby
it "should have method missing as a private method" do
Markaby::Builder.private_instance_methods.should include("method_missing")
end
-
+
describe "setting options" do
it "should be able to restore defaults after setting" do
Markaby::Builder.set :indent, 2
Markaby::Builder.restore_defaults!
-
+
Markaby::Builder.get(:indent).should == 0
end
@@ -27,7 +27,7 @@ module Markaby
Markaby::Builder.get(:indent).should == 2
end
end
-
+
describe "hidden internal variables" do
# internal clobbering by passed in assigns
it "should not overwrite internal helpers ivar when assigning a :helpers key" do
@@ -41,59 +41,59 @@ def some_method
builder.some_method.should == "a value"
end
end
-
+
describe "evaluating blocks" do
it "should evaluate a pure-string block (without requiring a call to the text method)" do
b = Builder.new do
"foo"
end
-
+
b.to_s.should == "foo"
end
-
+
it "should only evaluate the last argument in a pure-string block" do
b = Builder.new do
"foo"
"bar"
end
-
+
b.to_s.should == "bar"
end
-
+
it "should evaluate pure-strings inside an tag" do
b = Builder.new do
h1 do
"foo"
end
end
-
+
b.to_s.should == "<h1>foo</h1>"
end
-
+
it "should ignore a pure string in the block, even if comes last, if there has been any markup whatsoever" do
b = Builder.new do
h1
"foo"
end
-
+
b.to_s.should == "<h1/>"
end
end
-
+
describe "capture" do
before do
@builder = Builder.new
end
-
+
it "should return the string captured" do
out = @builder.capture do
h1 "TEST"
h2 "CAPTURE ME"
end
-
+
out.should == "<h1>TEST</h1><h2>CAPTURE ME</h2>"
end
-
+
it "should not change the output buffer" do
lambda {
@builder.capture do
@@ -101,14 +101,14 @@ def some_method
end
}.should_not change { @builder.to_s }
end
-
+
it "should be able to capture inside a capture" do
out = @builder.capture do
capture do
h1 "foo"
end
end
-
+
out.should == "<h1>foo</h1>"
end
end
View
2 spec/markaby/markaby_other_static.mab
@@ -1 +1 @@
-text "_why?"
+text "_why?"
View
40 spec/markaby/markaby_spec.rb
@@ -11,7 +11,7 @@ def test_simple
assert_equal "<p>foo</p>", mab { p 'foo' }
assert_equal "<p>foo</p>", mab { p { 'foo' } }
end
-
+
def test_classes_and_ids
assert_equal %{<div class="one"></div>}, mab { div.one '' }
assert_equal %{<div class="one two"></div>}, mab { div.one.two '' }
@@ -19,7 +19,7 @@ def test_classes_and_ids
assert_equal %{<hr class="hidden"/>}, mab { hr.hidden }
assert_equal %{<input class="foo" name="bar" id="bar"/>}, mab { input.foo :id => 'bar' }
end
-
+
def test_escaping
assert_equal "<h1>Apples &amp; Oranges</h1>", mab { h1 'Apples & Oranges' }
assert_equal "<h1>Apples & Oranges</h1>", mab { h1 { 'Apples & Oranges' } }
@@ -42,10 +42,10 @@ def test_ivars
assert_equal html, mab(:name => 'Steve') { div { h1 @name; self << capture { div { @name = 'Gerald'; h2 @name } }; h3 @name } }
end
- def test_ivars_without_at_symbol
- assert_equal "<h1>Hello World</h1>", mab { @message = 'Hello World'; h1 message }
- end
-
+ def test_ivars_without_at_symbol
+ assert_equal "<h1>Hello World</h1>", mab { @message = 'Hello World'; h1 message }
+ end
+
def spec_helpers
Markaby::Builder.ignored_helpers.clear
assert_equal %{squirrels}, mab({}, MarkabyTestHelpers) { pluralize('squirrel') }
@@ -54,12 +54,12 @@ def spec_helpers
Markaby::Builder.ignore_helpers :pluralize
assert_exception(NoMethodError, "undefined method `pluralize'", {}, MarkabyTestHelpers) { pluralize('squirrel') }
end
-
+
def test_uses_helper_instance_variable
helper = Module.new do
@some_ivar = :ivar_value
end
-
+
builder = Markaby::Builder.new({}, helper)
assert_equal :ivar_value, builder.some_ivar
end
@@ -104,11 +104,11 @@ def test_builder_bang_methods
end
def test_fragments
- assert_equal %{<div><h1>Monkeys</h1><h2>Giraffes <small>Miniature</small> and <strong>Large</strong></h2><h3>Donkeys</h3><h4>Parakeet <b><i>Innocent IV</i></b> in Classic Chartreuse</h4></div>},
+ assert_equal %{<div><h1>Monkeys</h1><h2>Giraffes <small>Miniature</small> and <strong>Large</strong></h2><h3>Donkeys</h3><h4>Parakeet <b><i>Innocent IV</i></b> in Classic Chartreuse</h4></div>},
mab { div { h1 "Monkeys"; h2 { "Giraffes #{small 'Miniature' } and #{strong 'Large'}" }; h3 "Donkeys"; h4 { "Parakeet #{b { i 'Innocent IV' }} in Classic Chartreuse" } } }
- assert_equal %{<div><h1>Monkeys</h1><h2>Giraffes <strong>Miniature</strong></h2><h3>Donkeys</h3></div>},
+ assert_equal %{<div><h1>Monkeys</h1><h2>Giraffes <strong>Miniature</strong></h2><h3>Donkeys</h3></div>},
mab { div { h1 "Monkeys"; h2 { "Giraffes #{strong 'Miniature' }" }; h3 "Donkeys" } }
- assert_equal %{<div><h1>Monkeys</h1><h2>Giraffes <small>Miniature</small> and <strong>Large</strong></h2><h3>Donkeys</h3><h4>Parakeet <strong>Large</strong> as well...</h4></div>},
+ assert_equal %{<div><h1>Monkeys</h1><h2>Giraffes <small>Miniature</small> and <strong>Large</strong></h2><h3>Donkeys</h3><h4>Parakeet <strong>Large</strong> as well...</h4></div>},
mab { div { @a = small 'Miniature'; @b = strong 'Large'; h1 "Monkeys"; h2 { "Giraffes #{@a} and #{@b}" }; h3 "Donkeys"; h4 { "Parakeet #{@b} as well..." } } }
end
@@ -119,7 +119,7 @@ def test_invalid_xhtml
end
def test_full_doc_transitional
- doc = mab { xhtml_transitional { head { title 'OKay' } } }
+ doc = mab { xhtml_transitional { head { title 'OKay' } } }
assert doc =~ /^<\?xml version="1.0" encoding="UTF-8"\?>/
assert doc.include?(%{"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">})
assert doc.include?(%{<title>OKay</title>})
@@ -131,7 +131,7 @@ def test_full_doc_strict
assert doc.include?(%{"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">})
assert doc.include?(%{<title>OKay</title>})
end
-
+
def test_full_doc_frameset
doc = mab { xhtml_frameset { head { title 'OKay' } } }
assert doc =~ /^<\?xml version="1.0" encoding="UTF-8"\?>/
@@ -145,11 +145,11 @@ def test_root_attributes_can_be_changed
assert doc.include?(%{<title>Salut!</title>})
assert doc.include?(%{ lang="fr"})
end
-
+
def version_file
File.expand_path(File.dirname(__FILE__) + "/../../VERSION")
end
-
+
def test_markaby_should_have_correct_version
assert_equal Markaby::VERSION, File.read(version_file).strip
end
@@ -162,9 +162,9 @@ def test_duplicate_usage_of_same_id
end
end
end
-
+
# auto validation
-
+
def test_tagging_with_invalid_tag_should_raise_error
assert_raises Markaby::InvalidXhtmlError do
mab do
@@ -172,7 +172,7 @@ def test_tagging_with_invalid_tag_should_raise_error
end
end
end
-
+
def test_self_closing_html_tag_with_block_throws_errors
assert_raises Markaby::InvalidXhtmlError do
mab do
@@ -181,10 +181,10 @@ def test_self_closing_html_tag_with_block_throws_errors
end
end
end
-
+
def test_local_assigning
builder = Markaby::Builder.new(:variable => :a_value)
-
+
assert_equal :a_value, builder.variable
end
View
2 spec/markaby/rails/spec_helper.rb
@@ -13,7 +13,7 @@
require RAILS_BOOT_FILE
Rails::Initializer.run
require 'action_controller/test_process'
-
+
$:.unshift MARKABY_ROOT
require 'init'
else
View
2 spec/markaby/rails/views/markaby/_a_partial.mab
@@ -1,3 +1,3 @@
ul do
li "smtlaissezfaire"
-end
+end
View
2 spec/markaby/rails/views/markaby/_partial_child_with_locals.mab
@@ -1 +1 @@
-li author
+li author
View
2 spec/markaby/rails/views/markaby/access_to_helpers.mab
@@ -1 +1 @@
-link_to "bar", "/foo"
+link_to "bar", "/foo"
View
2 spec/markaby/rails/views/markaby/broken.mab
@@ -4,4 +4,4 @@ div {
li 'two'
li supercalifragilisticexpialidocious
}
-}
+}
View
2 spec/markaby/rails/views/markaby/correct_template_values.mab
@@ -2,4 +2,4 @@ ul do
li "smt"
li "joho"
li "spox"
-end
+end
View
2 spec/markaby/rails/views/markaby/form_for.mab
@@ -1,2 +1,2 @@
form_for :obj do
-end
+end
View
2 spec/markaby/rails/views/markaby/form_for_with_fields.mab
@@ -1,3 +1,3 @@
form_for :foo do |f|
f.text_field :foo
-end
+end
View
2 spec/markaby/rails/views/markaby/form_for_with_multiple_fields.mab
@@ -1,4 +1,4 @@
form_for :foo do |f|
f.text_field :foo
f.text_field :baz
-end
+end
View
2 spec/markaby/rails/views/markaby/no_values_passed.mab
@@ -1,3 +1,3 @@
ul do
li "Scott"
-end
+end
View
2 spec/markaby/rails/views/markaby/partial_parent.mab
@@ -1 +1 @@
-render :partial => "a_partial"
+render :partial => "a_partial"
View
4 spec/markaby/rails/views/markaby/partial_parent_with_locals.mab
@@ -1,7 +1,7 @@
ul do
authors = ["smtlaissezfaire"]
-
+
authors.each do |author|
render :partial => "partial_child_with_locals", :locals => {:author => author}
end
-end
+end
View
2 spec/markaby/rails/views/markaby/render_erb_without_explicit_render_call.erb
@@ -1 +1 @@
-hello, from erb
+hello, from erb
View
2 spec/markaby/rails/views/markaby/render_mab_without_explicit_render_call.mab
@@ -1,3 +1,3 @@
ul do
li "smtlaissezfaire"
-end
+end
View
2 spec/markaby/rails/views/markaby/render_with_ivar.mab
@@ -1,3 +1,3 @@
ul do
li @user
-end
+end
View
2 spec/markaby/rails/views/markaby/renders_erb.rhtml
@@ -1 +1 @@
-Hello, from erb!
+Hello, from erb!
View
50 spec/markaby/rails_spec.rb
@@ -3,7 +3,7 @@
if RUNNING_RAILS
class NonSpecificTestController < ActionController::Base
VIEW_PATH = File.expand_path(File.join(File.dirname(__FILE__), 'rails', 'views'))
-
+
around_filter :catch_exceptions
attr_reader :last_exception
@@ -14,10 +14,10 @@ def catch_exceptions
raise @last_exception
end
end
-
+
if Markaby::Rails.deprecated_rails_version?
class ActionController::TestCase < Test::Unit::TestCase; end
-
+
class TestController < NonSpecificTestController
self.template_root = VIEW_PATH
end
@@ -26,7 +26,7 @@ class TestController < NonSpecificTestController
append_view_path(VIEW_PATH)
end
end
-
+
class MarkabyController < TestController
def renders_nothing
render :text => ""
@@ -84,36 +84,36 @@ def renders_partial_with_locals
def render_which_raises_error
render :template => "markaby/broken"
end
-
+
def renders_form_for
@obj = Object.new
render :template => "markaby/form_for"
end
-
+
def render_form_for_with_fields
@obj = Object.new
def @obj.foo
"bar"
end
-
+
render :template => "markaby/form_for_with_fields"
end
-
+
def render_form_for_with_multiple_fields
@obj = Object.new
-
+
def @obj.foo
"bar"
end
-
+
def @obj.baz
"quxx"
end
-
+
render :template => "markaby/form_for_with_multiple_fields"
end
end
-
+
class MarkabyOnRailsTest < ActionController::TestCase
def setup
Markaby::Builder.restore_defaults!
@@ -167,7 +167,7 @@ def test_renders_mab_template_with_correct_values
def test_renders_without_explicit_render_call
get :render_mab_without_explicit_render_call
assert_response :success
-
+
assert_equal @response.body, "<ul><li>smtlaissezfaire</li></ul>"
end
@@ -208,42 +208,42 @@ def test_raises_error_when_template_raises_error
assert %r(undefined local variable or method `supercalifragilisticexpialidocious' for #<Markaby::.*Builder.*) =~
@controller.last_exception.message.to_s
end
-
+
def test_renders_form_for_properly
get :renders_form_for
-
+
assert_response :success
-
+
assert %r(<form.*></form>) =~ @response.body
end
-
+
def test_renders_form_for_with_fields_for
get :render_form_for_with_fields
-
+
assert_response :success
-
+
assert_equal "<form action=\"/markaby/render_form_for_with_fields\" method=\"post\"><input id=\"foo_foo\" name=\"foo[foo]\" size=\"30\" type=\"text\" /></form>",
@response.body
end
-
+
def test_renders_form_for_with_multiple_fields
get :render_form_for_with_multiple_fields
-
+
assert_response :success
-
+
expected_output = "<form action=\"/markaby/render_form_for_with_multiple_fields\" method=\"post\">"
expected_output << "<input id=\"foo_foo\" name=\"foo[foo]\" size=\"30\" type=\"text\" />"
expected_output << "<input id=\"foo_baz\" name=\"foo[baz]\" size=\"30\" type=\"text\" />"
expected_output << "</form>"
-
+
assert_equal expected_output,
@response.body
end
end
-
+
describe "rails version" do
it "should support the current rails version" do
Markaby::Rails::SUPPORTED_RAILS_VERSIONS.should include(::Rails::VERSION::STRING)
end
end
-end
+end
View
12 spec/markaby/rails_version_spec.rb
@@ -2,32 +2,32 @@
unless RUNNING_RAILS
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
-
+
describe "when rails is loaded, but is not a supported version" do
module MockRails
module VERSION
STRING = ::Markaby::Rails::UNSUPPORTED_RAILS_VERSIONS.first
end
end
-
+
def install_mock_rails
Object.const_set(:Rails, MockRails)
end
-
+
def remove_mock_rails
Object.class_eval do
remove_const(:Rails)
end
end
-
+
before do
install_mock_rails
end
-
+
after do
remove_mock_rails
end
-
+
it "should raise" do
lambda {
::Markaby::Rails.load
View
2 spec/markaby/tilt/locals.mab
@@ -1 +1 @@
-li foo
+li foo
View
2 spec/markaby/tilt/markaby.mab
@@ -1 +1 @@
-text "hello from markaby!"
+text "hello from markaby!"
View
2 spec/markaby/tilt/markaby_other_static.mab
@@ -1 +1 @@
-text "_why?"
+text "_why?"
View
2 spec/markaby/tilt/render_twice.mab
@@ -1 +1 @@
-text "foo"
+text "foo"
View
2 spec/markaby/tilt/scope.mab
@@ -1 +1 @@
-li foo
+li foo
View
2 spec/spec.opts
@@ -1,2 +1,2 @@
--color
---backtrace
+--backtrace

0 comments on commit acb563e

Please sign in to comment.
Something went wrong with that request. Please try again.