Permalink
Browse files

test layout support (it works)

  • Loading branch information...
1 parent bb09b3a commit 654e41735fcc021fe5682a10485e676331497f4e S. Brent Faulkner committed Apr 29, 2009
Showing with 27 additions and 10 deletions.
  1. +4 −0 CHANGES
  2. +1 −1 TODO
  3. +1 −1 VERSION.yml
  4. +1 −1 sinatra-markaby.gemspec
  5. +16 −7 test/sinatra_markaby_test.rb
  6. +4 −0 test/views/html.mab
View
@@ -1,3 +1,7 @@
+= 0.9.2.2
+
+* layout support is tested
+
= 0.9.2.1
* use Rack::Test instead of Sinatra::Test
View
2 TODO
@@ -1,3 +1,3 @@
= TODO
-* test layout support
+* refactor render/views in sinatra
View
@@ -1,4 +1,4 @@
---
:major: 0
:minor: 9
-:patch: 2
+:patch: 2.2
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = %q{sinatra-markaby}
- s.version = "0.9.2.1"
+ s.version = "0.9.2.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["S. Brent Faulkner"]
@@ -14,36 +14,45 @@ def markaby_app(&block)
def test_renders_inline_strings
markaby_app { markaby 'mab.p "Hello shrimp!"' }
assert last_response.ok?
- assert_equal "<p>Hello shrimp!</p>", last_response.body
+ assert_equal '<p>Hello shrimp!</p>', last_response.body
end
def test_renders_inline_blocks
markaby_app {
- @name = "Frank & Mary"
+ @name = 'Frank & Mary'
markaby do |mab|
mab.p "Hello #{@name}!"
end
}
assert last_response.ok?
- assert_equal "<p>Hello Frank &amp; Mary!</p>", last_response.body
+ assert_equal '<p>Hello Frank &amp; Mary!</p>', last_response.body
end
def test_renders_markaby_files_in_views_path
markaby_app {
- @name = "World"
+ @name = 'World'
markaby :hello
}
assert last_response.ok?
- assert_equal "<p>Hello, World!</p>", last_response.body
+ assert_equal '<p>Hello, World!</p>', last_response.body
end
def test_renders_in_file_template
markaby_app {
- @name = "Joe"
+ @name = 'Joe'
markaby :in_file
}
assert last_response.ok?
- assert_equal "<p>Hey Joe</p>", last_response.body
+ assert_equal '<p>Hey Joe</p>', last_response.body
+ end
+
+ def test_renders_with_layout
+ markaby_app {
+ @name = 'with Layout'
+ markaby :hello, :layout => :html
+ }
+ assert last_response.ok?
+ assert_equal '<html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><title>Hello</title></head><body><p>Hello, with Layout!</p></body></html>', last_response.body
end
def test_raises_error_if_template_not_found
View
@@ -0,0 +1,4 @@
+mab.html do
+ head { title "Hello" }
+ body { yield }
+end

0 comments on commit 654e417

Please sign in to comment.