Skip to content

Commit 6ef1821

Browse files
committed
fixed html expectations due to xhtml rendering within dockerized headless testing
1 parent 77a430b commit 6ef1821

File tree

10 files changed

+27
-40
lines changed

10 files changed

+27
-40
lines changed

spec/usage/components/action_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def action_config
535535
it 'action_path: passing path as a string (not recommended)' do
536536

537537
Rails.application.routes.append do
538-
post '/action_test/:id', to: 'action_test#test', as: 'action_test_with_url_param_and_string_route'
538+
post '/action_test/:id', to: 'action_test#test'
539539
end
540540
Rails.application.reload_routes!
541541

spec/usage/components/address_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def response
2626
static_output = page.html
2727

2828
expected_static_output = <<~HTML
29-
<address>Codey McCodeface<br>1 Developer Avenue<br>Techville</address>
29+
<address>Codey McCodeface<br/>1 Developer Avenue<br/>Techville</address>
3030
HTML
3131

3232
expect(stripped(static_output)).to include(stripped(expected_static_output))

spec/usage/components/br_spec.rb

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,7 @@ def response
3232

3333
static_output = page.html
3434

35-
expected_static_output_1 = <<~HTML
36-
hello
37-
<br>
38-
world!
39-
40-
hello
41-
<br>
42-
<br>
43-
<br>
44-
<br>
45-
<br>
46-
world!
47-
48-
hello
49-
<br id="my-br" class="fancy-br-class">
50-
world!
51-
HTML
52-
53-
expected_static_output_2 = <<~HTML
35+
expected_static_output = <<~HTML
5436
hello
5537
<br/>
5638
world!
@@ -64,11 +46,11 @@ def response
6446
world!
6547
6648
hello
67-
<br id="my-br" class="fancy-br-class">
49+
<br id="my-br" class="fancy-br-class"/>
6850
world!
6951
HTML
7052

71-
expect(stripped(static_output)).to ( include(stripped(expected_static_output_1)) or include(stripped(expected_static_output_2)) )
53+
expect(stripped(static_output)).to ( include(stripped(expected_static_output)) )
7254
end
7355

7456
end

spec/usage/components/fieldset_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ def response
3333
expected_html_output = <<~HTML
3434
<fieldset>
3535
<legend>input legend</legend>
36-
<input>
36+
<input/>
3737
</fieldset>
3838
3939
<fieldset id="world" class="foo">
4040
<legend id="bar" class="hello">input legend</legend>
41-
<input>
41+
<input/>
4242
</fieldset>
4343
4444
<fieldset disabled="disabled">
4545
<legend>input legend</legend>
46-
<input>
46+
<input/>
4747
</fieldset>
4848
4949
HTML

spec/usage/components/form_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def model_submit
5555
render json: {
5656
message: "server says: something went wrong!",
5757
errors: @test_model.errors
58-
}, status: :unproccessable_entity
58+
}, status: :unprocessable_entity
5959
else
6060
render json: {
6161
message: "server says: form submitted successfully!"
@@ -686,6 +686,9 @@ def form_config
686686

687687
it "can be mapped to an Active Record Model" do
688688

689+
Object.send(:remove_const, :TestModel)
690+
691+
689692
class TestModel < ApplicationRecord
690693

691694
validates :description, presence:true
@@ -726,6 +729,8 @@ def form_config
726729
expect(page).to have_field("title", with: "Title")
727730
click_button "Submit me!"
728731
expect(page).to have_field("title", with: "Title")
732+
#page.save_screenshot
733+
#p page.driver.browser.manage.logs.get(:browser)
729734
expect(page).to have_xpath('//span[@class="errors"]/span[@class="error" and contains(.,"can\'t be blank")]')
730735

731736
value = "#{DateTime.now}"

spec/usage/components/hr_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def response
1818
static_output = page.html
1919

2020
expected_static_output = <<~HTML
21-
<hr id="my-id" class="my-class">
21+
<hr id="my-id" class="my-class"/>
2222
HTML
2323

2424
expect(stripped(static_output)).to include(stripped(expected_static_output))

spec/usage/components/iframe_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def response
1515
end
1616

1717
# enhanced iframe tag
18-
iframe id: 'my-id', class: 'my-class', src: "https://www.demopage.com", srcdoc: "<p>Mate Stack UI!</p>" do
18+
iframe id: 'my-id', class: 'my-class', src: "https://www.demopage.com", srcdoc: "Mate Stack UI!" do
1919
plain 'The browser does not support iframe.'
2020
end
2121
}
@@ -28,7 +28,7 @@ def response
2828

2929
expected_static_output = <<~HTML
3030
<iframe src="https://www.demopage.com">The browser does not support iframe.</iframe>
31-
<iframe id="my-id" src="https://www.demopage.com" srcdoc="<p>Mate Stack UI!</p>" class="my-class">The browser does not support iframe.</iframe>
31+
<iframe id="my-id" src="https://www.demopage.com" srcdoc="Mate Stack UI!" class="my-class">The browser does not support iframe.</iframe>
3232
HTML
3333
expect(stripped(static_output)).to include(stripped(expected_static_output))
3434
end
@@ -44,7 +44,7 @@ def response
4444

4545
# enhanced iframe tag
4646
iframe id: 'my-id', class: 'my-class', src: "https://www.demopage.com",
47-
srcdoc: "<p>Mate Stack UI!</p>", text: 'The browser does not support iframe.'
47+
srcdoc: "Mate Stack UI!", text: 'The browser does not support iframe.'
4848
}
4949
end
5050

@@ -56,7 +56,7 @@ def response
5656

5757
expected_static_output = <<~HTML
5858
<iframe src="https://www.demopage.com">The browser does not support iframe.</iframe>
59-
<iframe id="my-id" src="https://www.demopage.com" srcdoc="<p>Mate Stack UI!</p>" class="my-class">The browser does not support iframe.</iframe>
59+
<iframe id="my-id" src="https://www.demopage.com" srcdoc="Mate Stack UI!" class="my-class">The browser does not support iframe.</iframe>
6060
HTML
6161

6262
expect(stripped(static_output)).to include(stripped(expected_static_output))

spec/usage/components/map_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def response
2525

2626
expected_static_output = <<~HTML
2727
<map name="newmap">
28-
<area alt="First" coords="0,0,100,100" href="first.htm" shape="rect">
29-
<area alt="Second" coords="100,100,200,200" href="second.htm" shape="rect">
30-
<area alt="Third" coords="200,200,300,300" href="third.htm" shape="rect">
28+
<area alt="First" coords="0,0,100,100" href="first.htm" shape="rect"/>
29+
<area alt="Second" coords="100,100,200,200" href="second.htm" shape="rect"/>
30+
<area alt="Third" coords="200,200,300,300" href="third.htm" shape="rect"/>
3131
</map>
3232
HTML
3333

spec/usage/components/param_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def response
2323
static_output = page.html
2424

2525
expected_static_output = <<~HTML
26-
<param>
27-
<param name="autoplay" value="true">
28-
<param id="my-id" name="autoplay" value="true" class="my-class">
26+
<param/>
27+
<param name="autoplay" value="true"/>
28+
<param id="my-id" name="autoplay" value="true" class="my-class"/>
2929
HTML
3030

3131
expect(stripped(static_output)).to include(stripped(expected_static_output))

spec/usage/components/wbr_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def response
2828
static_output = page.html
2929

3030
expected_static_output = <<~HTML
31-
<p>First part of text<wbr>Second part of text</p>
32-
<p>First part of second text<wbr id="special" class="nice-wbr">Second part of second text</p>
31+
<p>First part of text<wbr/>Second part of text</p>
32+
<p>First part of second text<wbr id="special" class="nice-wbr"/>Second part of second text</p>
3333
HTML
3434

3535
expect(stripped(static_output)).to include(stripped(expected_static_output))

0 commit comments

Comments
 (0)