File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 11require 'spec_helper'
22require 'support/editor'
3+ require 'support/matchers/be_at_url'
34require 'support/playground_actions'
45
56RSpec . feature "Navigating between pages" , type : :feature , js : true do
67 include PlaygroundActions
78
8- RSpec ::Matchers . define :be_at_url do |path , query = { } |
9- match do |page |
10- uri = URI ::parse ( page . current_url )
11- expect ( uri . path ) . to eql ( path )
12-
13- query = query . map { |k , v | [ k . to_s , Array ( v ) . map ( &:to_s ) ] } . to_h
14- query_hash = CGI ::parse ( uri . query || '' )
15- expect ( query_hash ) . to include ( query )
16- end
17-
18- failure_message do |page |
19- "expected that #{ page . current_url } would be #{ path } with the query parameters #{ query } "
20- end
21- end
22-
239 # This is kind of a test of the router library too, so if that ever
2410 # gets extracted, a chunk of these tests can be removed.
2511
Original file line number Diff line number Diff line change 1+ RSpec ::Matchers . define :be_at_url do |path , query = { } |
2+ match do |page |
3+ uri = URI ::parse ( page . current_url )
4+ expect ( uri . path ) . to eql ( path )
5+
6+ query = query . map { |k , v | [ k . to_s , Array ( v ) . map ( &:to_s ) ] } . to_h
7+ query_hash = CGI ::parse ( uri . query || '' )
8+ expect ( query_hash ) . to include ( query )
9+ end
10+
11+ failure_message do |page |
12+ "expected that #{ page . current_url } would be #{ path } with the query parameters #{ query } "
13+ end
14+ end
You can’t perform that action at this time.
0 commit comments