opal-rspec 0.5.0.beta1 → 0.5.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/Rakefile +11 -3
- data/lib/opal/rspec/version.rb +1 -1
- data/opal/opal/rspec/fixes/kernel.rb +18 -5
- data/spec_mri/integration/browser_spec.rb +37 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c317905daac139b9a3b70651c7c9305a7279078f
|
4
|
+
data.tar.gz: 00b344281961f64460a8b667c2ac849c8de70b3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c916613b1f125e6ee5f17cf56cee9c8e5f41bda97741c4deedc825f43c0d780533147c72c77d42d6a320d1ad51a54f62920b9dee84cfb8fa80ab8269285ec7c
|
7
|
+
data.tar.gz: de0c3fcf3536cc6f59bfc8c404f7f9d4e6c299e445fbaa2e240c970570493e6bc4bf03df40d8a441d67ffae5e445247fc2b833e42d4864ee5be6aec3a2195f98
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'bundler'
|
2
|
+
require 'rspec/core/rake_task'
|
2
3
|
Bundler.require
|
3
4
|
|
4
5
|
Bundler::GemHelper.install_tasks
|
5
6
|
|
6
7
|
require 'opal/rspec/rake_task'
|
7
|
-
Opal::RSpec::RakeTask.new(:
|
8
|
+
Opal::RSpec::RakeTask.new(:specs_via_rake)
|
8
9
|
|
9
10
|
desc 'Generates an RSpec requires file free of dynamic requires'
|
10
11
|
task :generate_requires do
|
@@ -12,8 +13,15 @@ task :generate_requires do
|
|
12
13
|
sh 'ruby -Irspec/lib -Irspec-core/lib/rspec -Irspec-support/lib/rspec util/create_requires.rb'
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
RSpec::Core::RakeTask.new :browser_specs do |t|
|
17
|
+
t.pattern = 'spec_mri/**/*_spec.rb'
|
18
|
+
end
|
19
|
+
|
20
|
+
task :default => [:verify_rake_specs, :browser_specs]
|
21
|
+
|
22
|
+
desc 'Will run a spec suite (rake specs_via_rake) and check for expected combination of failures and successes'
|
23
|
+
task :verify_rake_specs do
|
24
|
+
test_output = `rake specs_via_rake`
|
17
25
|
raise "Expected test runner to fail due to failed tests, but got return code of #{$?.exitstatus}" if $?.success?
|
18
26
|
count_match = /(\d+) examples, (\d+) failures, (\d+) pending/.match(test_output)
|
19
27
|
raise 'Expected a finished count of test failures/success/etc. but did not see it' unless count_match
|
data/lib/opal/rspec/version.rb
CHANGED
@@ -13,22 +13,35 @@ module Kernel
|
|
13
13
|
stack = `err.stack`
|
14
14
|
caller_lines = stack.split("\n")[4..-1]
|
15
15
|
caller_lines.reject! {|l| l.strip.empty? }
|
16
|
+
|
17
|
+
result_formatter = lambda do |filename, line, method=nil|
|
18
|
+
"#{filename}:#{line} in `(#{method ? method : 'unknown method'})'"
|
19
|
+
end
|
20
|
+
|
16
21
|
caller_lines.map do |raw_line|
|
17
22
|
if match = /\s*at (.*) \((\S+):(\d+):\d+/.match(raw_line)
|
18
23
|
method, filename, line = match.captures
|
19
|
-
|
24
|
+
result_formatter[filename, line, method]
|
20
25
|
elsif match = /\s*at (\S+):(\d+):\d+/.match(raw_line)
|
21
26
|
filename, line = match.captures
|
22
|
-
|
27
|
+
result_formatter[filename, line]
|
23
28
|
# catch phantom/no 2nd line/col #
|
24
29
|
elsif match = /\s*at (.*) \((\S+):(\d+)/.match(raw_line)
|
25
30
|
method, filename, line = match.captures
|
26
|
-
|
31
|
+
result_formatter[filename, line, method]
|
27
32
|
elsif match = /\s*at (.*):(\d+)/.match(raw_line)
|
28
33
|
filename, line = match.captures
|
29
|
-
|
34
|
+
result_formatter[filename, line]
|
35
|
+
# Firefox - Opal.modules["rspec/core/metadata"]/</</</</def.$populate@http://192.168.59.103:9292/assets/rspec/core/metadata.self.js?body=1:102:13
|
36
|
+
elsif match = /(.*?)@(\S+):(\d+):\d+/.match(raw_line)
|
37
|
+
method, filename, line = match.captures
|
38
|
+
result_formatter[filename, line, method]
|
39
|
+
# webkit - http://192.168.59.103:9292/assets/opal/rspec/sprockets_runner.js:45117:314
|
40
|
+
elsif match = /(\S+):(\d+):\d+/.match(raw_line)
|
41
|
+
filename,line = match.captures
|
42
|
+
result_formatter[filename, line]
|
30
43
|
else
|
31
|
-
|
44
|
+
"#{filename}:-1 in `(can't parse this stack trace)`"
|
32
45
|
end
|
33
46
|
end
|
34
47
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'capybara/rspec'
|
3
|
+
require 'capybara-webkit'
|
4
|
+
|
5
|
+
# Use Rack config exactly as shipped in the GEM
|
6
|
+
Capybara.app = Rack::Builder.new_from_string(File.read('config.ru'))
|
7
|
+
|
8
|
+
describe 'browser formatter', type: :feature, js: true do
|
9
|
+
RSpec.shared_examples :browser do
|
10
|
+
before do
|
11
|
+
visit '/'
|
12
|
+
# Specs should run in 12 seconds but in case Travis takes longer, provide some cushion
|
13
|
+
Capybara.default_wait_time = 40
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'matches test results' do
|
17
|
+
expect(page).to have_content '182 examples, 65 failures, 22 pending'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'Webkit' do
|
22
|
+
before do
|
23
|
+
Capybara.javascript_driver = :webkit
|
24
|
+
end
|
25
|
+
|
26
|
+
include_examples :browser
|
27
|
+
end
|
28
|
+
|
29
|
+
# TODO: This passes in my local tests (Firefox 40.0.2), but something in the Travis environment causes it to fail
|
30
|
+
xcontext 'Firefox' do
|
31
|
+
before do
|
32
|
+
Capybara.javascript_driver = :selenium
|
33
|
+
end
|
34
|
+
|
35
|
+
include_examples :browser
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0.
|
4
|
+
version: 0.5.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Beynon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -532,6 +532,7 @@ files:
|
|
532
532
|
- spec/should_syntax_spec.rb
|
533
533
|
- spec/skip_pending_spec.rb
|
534
534
|
- spec/subject_spec.rb
|
535
|
+
- spec_mri/integration/browser_spec.rb
|
535
536
|
- util/create_requires.rb
|
536
537
|
- vendor/spec_runner.js
|
537
538
|
homepage: http://opalrb.org
|