15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/cypress-rails/test_case.rb', line 15
def self.test_locator(path_or_globs)
Dir[path_or_globs].map do |path|
test_name = "test_#{path.gsub(/[\/\.:\\]/, "_")}"
define_method test_name do
bin = FindsBin.new.call
command = "CYPRESS_BASE_URL=http://#{Capybara.server_host}:#{Capybara.server_port} #{bin} run --spec \"#{path}\""
unless system(command)
raise <<~ERROR
Cypress test failed. Try again with:
$ rails test test/system --name #{test_name}
Underlying Cypress command run was:
$ #{command}
ERROR
end
end
end
end
|