Skip to content

Commit 1f45958

Browse files
committed
Update to phlex 2.0 (rc1)
1 parent 2efb173 commit 1f45958

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
1515

1616
### Changed
1717

18+
- Update to phlex 2.0.
19+
1820
### Deprecated
1921

2022
### Removed

Gemfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ source "https://rubygems.org"
66
gemspec
77

88
gem "rake", "~> 13.0"
9-
10-
gem "rspec", "~> 3.0"
11-
gem "capybara"
9+
gem "rspec", "~> 3.13"
10+
gem "rack-test", "~> 2.1"
11+
gem "capybara", "~> 3.35"
1212
gem "puma"
13-
gem "rack-test"
1413

15-
gem "standard", "~> 1.3"
14+
gem "standard", "~> 1.43"
15+
gem "debug"

roda-phlex.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
3131
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
3232
spec.require_paths = ["lib"]
3333

34-
spec.add_dependency "phlex", ">= 1.7.0"
34+
spec.add_dependency "phlex", ">= 2.0.0.rc1", "<3"
3535
spec.add_dependency "roda", ">= 3.0.0"
3636
end

spec/roda/phlex_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
it "outputs the full response with an explicit layout" do
8787
last_response = get_capybara("/stream/explicit")
8888
expect(last_response.body).to eq <<~HTML.chomp
89-
<!DOCTYPE html><html><head></head><body>Layout Start<p>View Data</p>Layout End</body></html>
89+
<!doctype html><html><head></head><body>Layout Start<p>View Data</p>Layout End</body></html>
9090
HTML
9191
# Indicates that streaming is being used.
9292
expect(last_response["Content-Length"]).to be_nil

spec/support/views.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def view_template
8080
html do
8181
head do
8282
meta(charset: "UTF-8")
83-
meta("http-equiv" => "UTF-8", "content" => "IE=edge")
83+
meta("http-equiv" => safe("UTF-8"), "content" => "IE=edge")
8484
meta(
8585
name: "viewport",
8686
content: "width=device-width, initial-scale=1.0"
@@ -114,7 +114,7 @@ def view_template
114114

115115
module ExplicitLayout
116116
class Layout < Phlex::HTML
117-
def view_template(&block)
117+
def view_template
118118
doctype
119119
html {
120120
head {
@@ -124,7 +124,7 @@ def view_template(&block)
124124
# benefit all pages that opt in to streaming.
125125
body {
126126
plain "Layout Start"
127-
yield_content(&block)
127+
yield
128128
plain "Layout End"
129129
}
130130
}
@@ -133,15 +133,15 @@ def view_template(&block)
133133

134134
class MyView < Phlex::HTML
135135
def view_template
136-
render Layout.new {
136+
render(Layout.new do
137137
# Knowing that this page can take a while to generate we can choose to
138138
# flush here so the browser can render the site header while downloading
139139
# the rest of the page - which should help minimise the First Contentful
140140
# Paint metric.
141141
flush
142142

143143
p { "View Data" }
144-
}
144+
end)
145145
end
146146
end
147147
end

0 commit comments

Comments
 (0)