Skip to content

Adds unit test for video on page #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added spec/dummy/app/assets/videos/corgi.mp4
Binary file not shown.
30 changes: 10 additions & 20 deletions spec/usage/components/video_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,15 @@
describe 'Video Component', type: :feature, js: true do

it 'Renders a video tag on the page' do
#
# class ExamplePage < Matestack::Ui::Page
# def response
# components {
# # simple video
# # test below fails, either add something to `spec/dummy/app/assets/videos/*` or stub it
# # video path: 'yourvid.mp4', width: 500, height: 300
# }
# end
# end
#
# visit '/example'
#
# static_output = page.html
#
# expected_static_output = <<~HTML
# <video src="yourvid.mp4" width="500" height="300"></video>
# HTML
#
# expect(stripped(static_output)).to include(stripped(expected_static_output))
class ExamplePage < Matestack::Ui::Page
def response
components {
video path: 'corgi.mp4', width: 500, height: 300
}
end
end

visit '/example'
expect(page).to have_xpath("//video[contains(@src,'corgi.mp4') and @width='500' and @height='300']")
end
end