forked from phlex-ruby/phlex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd94ae1
commit adc124e
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.2.0 | ||
3.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
describe Phlex::HTML do | ||
extend ViewHelper | ||
|
||
with "a return value" do | ||
view do | ||
attr_accessor :captured | ||
|
||
def template | ||
@captured = capture { "Hello" } | ||
end | ||
end | ||
|
||
it "captures the return value" do | ||
example.call | ||
expect(example.captured).to be == "Hello" | ||
end | ||
end | ||
|
||
with "a block" do | ||
view do | ||
attr_accessor :captured | ||
|
||
def template | ||
@captured = capture do | ||
h1 { "Hello" } | ||
end | ||
end | ||
end | ||
|
||
it "captures the return value" do | ||
example.call | ||
expect(example.captured).to be == "<h1>Hello</h1>" | ||
end | ||
end | ||
end |