test/test_code_blocks.rb in skim-0.9.3 vs test/test_code_blocks.rb in skim-0.10.0
- old
+ new
@@ -2,44 +2,38 @@
class TestSkimCodeBlocks < TestSkim
def test_render_with_output_code_block
source = %q{
p
- = @callback "Hello Ruby!", ->
- | Hello from within a block!
+ = @callback "Hello Ruby!", -> 'Hello from within a block!'
}
assert_html '<p>Hello Ruby! Hello from within a block! Hello Ruby!</p>', source
end
def test_render_with_output_code_within_block
source = %q{
p
- = @callback "Hello Ruby!", =>
- = @callback "Hello from within a block!"
+ = @callback "Hello Ruby!", => @callback "Hello from within a block!"
}
assert_html '<p>Hello Ruby! Hello from within a block! Hello Ruby!</p>', source
end
def test_render_with_output_code_within_block_2
source = %q{
p
- = @callback "Hello Ruby!", =>
- = @callback "Hello from within a block!", =>
- = @callback "And another one!"
+ = @callback "Hello Ruby!", => @callback "Hello from within a block!", => @callback "And another one!"
}
assert_html '<p>Hello Ruby! Hello from within a block! And another one! Hello from within a block! Hello Ruby!</p>', source
end
def test_output_block_with_arguments
source = %q{
p
- = @define_macro 'person', (first_name, last_name) =>
- .first_name = first_name
- .last_name = last_name
+ = @define_macro 'person', (first_name, last_name) => "<div class=\"first_name\">#{first_name}</div><div class=\"last_name\">#{last_name}</div>"
== @call_macro 'person', 'John', 'Doe'
== @call_macro 'person', 'Max', 'Mustermann'
}
assert_html '<p><div class="first_name">John</div><div class="last_name">Doe</div><div class="first_name">Max</div><div class="last_name">Mustermann</div></p>', source
@@ -85,12 +79,10 @@
assert_html '<p>user name</p>', source
end
def test_captured_code_block_with_conditional
source = %q{
-= @callback "Hello Ruby!", ->
- - if true
- | Hello from within a block!
+= @callback "Hello Ruby!", -> 'Hello from within a block!' if true
}
assert_html 'Hello Ruby! Hello from within a block! Hello Ruby!', source
end
end