opal-rspec 0.5.0 → 0.6.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +6 -0
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/.travis.yml +36 -26
- data/Appraisals +7 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +2 -4
- data/README.md +38 -16
- data/Rakefile +19 -7
- data/config.ru +3 -1
- data/gemfiles/opal_0.10_stable.gemfile +15 -0
- data/gemfiles/opal_master.gemfile +12 -15
- data/lib/opal/rspec/rake_task.rb +21 -8
- data/lib/opal/rspec/version.rb +1 -1
- data/lib/opal/rspec.rb +2 -2
- data/opal/opal/rspec/async/async_example.rb +5 -5
- data/opal/opal/rspec/async/example_group.rb +4 -4
- data/opal/opal/rspec/async/hooks.rb +2 -2
- data/opal/opal/rspec/async/legacy.rb +8 -9
- data/opal/opal/rspec/fixes/opal/compatibility.rb +3 -181
- data/opal/opal/rspec/fixes/opal.rb +0 -4
- data/opal/opal/rspec/fixes/rspec/core/metadata.rb +7 -26
- data/opal/opal/rspec/fixes/rspec/core.rb +0 -2
- data/opal/opal/rspec/fixes/rspec/example_groups.rb +0 -11
- data/opal/opal/rspec/fixes/rspec/expectations.rb +0 -1
- data/opal/opal/rspec/fixes/rspec/matchers/built_in/start_and_end_with.rb +0 -21
- data/opal/opal/rspec/fixes/rspec/mocks/error_generator.rb +0 -26
- data/opal/opal/rspec/fixes/rspec/support/spec/stderr_splitter.rb +13 -0
- data/opal/opal/rspec/fixes/rspec/support/spec.rb +1 -0
- data/opal/opal/rspec/fixes/rspec/support.rb +1 -1
- data/opal/opal/rspec/formatter/html_printer.rb +1 -1
- data/opal/opal/rspec/pre_require_fixes.rb +0 -5
- data/opal/opal/rspec/runner.rb +1 -1
- data/opal-rspec.gemspec +2 -3
- data/spec/mri/integration/browser_spec.rb +0 -3
- data/spec/mri/integration/spec_opts_spec.rb +1 -1
- data/spec/mri/unit/opal/rspec/browser_formatter_spec.rb +0 -3
- data/spec/mri/unit/opal/rspec/rack/config.ru +1 -1
- data/spec/mri/unit/opal/rspec/rake_task_spec.rb +60 -6
- data/spec/opal/after_hooks_spec.rb +26 -24
- data/spec/opal/around_hooks_spec.rb +2 -0
- data/spec/opal/async_spec.rb +22 -20
- data/spec/opal/before_hooks_spec.rb +20 -18
- data/spec/opal/example_spec.rb +4 -2
- data/spec/opal/matchers_spec.rb +3 -1
- data/spec/opal/mock_spec.rb +2 -0
- data/spec/opal/should_syntax_spec.rb +2 -0
- data/spec/opal/skip_pending_spec.rb +7 -5
- data/spec/opal/spec_helper.rb +4 -0
- data/spec/opal/subject_spec.rb +2 -0
- data/spec/rspec/core/filter/core/async/hooks.rb +0 -1
- data/spec/rspec/core/filter/core/async/metadata.rb +4 -0
- data/spec/rspec/core/filter/core/bugs/memoized_helpers.rb +0 -6
- data/spec/rspec/core/require_specs.rb +0 -1
- data/spec/rspec/expectations/config.rb +6 -1
- data/spec/rspec/expectations/filter/bugs/configuration.txt +0 -3
- data/spec/rspec/expectations/filter/bugs/contain_exactly.rb +0 -5
- data/spec/rspec/expectations/filter/bugs/define_negated_matcher.rb +0 -1
- data/spec/rspec/expectations/filter/bugs/dsl.rb +15 -0
- data/spec/rspec/expectations/filter/bugs/expectation_target.rb +4 -0
- data/spec/rspec/expectations/filter/bugs/expectations.rb +4 -0
- data/spec/rspec/expectations/filter/bugs/respond_to.rb +5 -11
- data/spec/rspec/expectations/filter/unsupported/dsl.rb +10 -0
- data/spec/rspec/expectations/fixes/example_patches.rb +0 -17
- data/spec/rspec/expectations/opal_alternates/dsl_spec.rb +2 -2
- data/spec/rspec/expectations/require_specs.rb +0 -1
- data/spec/rspec/filter_processor.rb +21 -5
- data/spec/rspec/mocks/filter/bugs/and_call_original.rb +11 -0
- data/spec/rspec/mocks/filter/bugs/and_yield.rb +4 -0
- data/spec/rspec/mocks/filter/bugs/any_instance.rb +1 -7
- data/spec/rspec/mocks/filter/bugs/partial_double.rb +5 -6
- data/spec/rspec/mocks/filter/bugs/stub_implementation.rb +0 -4
- data/spec/rspec/mocks/filter/unsupported/and_call_original.rb +7 -0
- data/spec/rspec/mocks/filter/unsupported/and_return.rb +4 -0
- data/spec/rspec/mocks/filter/unsupported/argument_matchers.rb +0 -3
- data/spec/rspec/mocks/filter/unsupported/combining_implementation_instructions.rb +0 -5
- data/spec/rspec/mocks/filter/unsupported/double.rb +0 -3
- data/spec/rspec/mocks/filter/unsupported/instance_double_with_class_loaded.rb +10 -0
- data/spec/rspec/mocks/filter/unsupported/nil_expectation_warning.rb +0 -4
- data/spec/rspec/mocks/filter/unsupported/partial_double.rb +0 -2
- data/spec/rspec/mocks/mocks_spec_loader.rb +1 -1
- data/spec/rspec/mocks/require_specs.rb +0 -1
- data/spec/rspec/mocks/spec_helper_opal.rb +2 -0
- data/spec/rspec/opal_rspec_spec_loader.rb +19 -4
- data/spec/rspec/support/filter/unsupported/fuzzy_matcher.rb +4 -0
- data/spec/rspec/support/filter/unsupported/support.rb +0 -3
- data/spec/rspec/support/require_specs.rb +0 -1
- metadata +27 -51
- data/opal/opal/rspec/fixes/opal/class.rb +0 -8
- data/opal/opal/rspec/fixes/opal/corelib/error.rb +0 -61
- data/opal/opal/rspec/fixes/opal/corelib/regexp.rb +0 -92
- data/opal/opal/rspec/fixes/opal/corelib/struct.rb +0 -260
- data/opal/opal/rspec/fixes/opal/corelib.rb +0 -3
- data/opal/opal/rspec/fixes/opal/kernel.rb +0 -80
- data/opal/opal/rspec/fixes/opal/stdlib/pp.rb +0 -23
- data/opal/opal/rspec/fixes/opal/stdlib/set.rb +0 -36
- data/opal/opal/rspec/fixes/opal/stdlib.rb +0 -2
- data/opal/opal/rspec/fixes/rspec/core/example_group.rb +0 -9
- data/opal/opal/rspec/fixes/rspec/core/reporter.rb +0 -14
- data/opal/opal/rspec/fixes/rspec/expectations/syntax.rb +0 -25
- data/opal/opal/rspec/fixes/rspec/support/fuzzy_matcher.rb +0 -23
- data/opal/opal/rspec/fixes/rspec/support/ruby_features.rb +0 -8
- data/spec/rspec/core/filter/core/async/metadata.txt +0 -2
- data/spec/rspec/core/filter/core/unsupported/metadata_filter.txt +0 -2
- data/spec/rspec/core/fixes/opal_itself.rb +0 -38
- data/spec/rspec/expectations/filter/bugs/aliases.rb +0 -13
- data/spec/rspec/expectations/filter/bugs/be.rb +0 -4
- data/spec/rspec/expectations/filter/bugs/be_instance_of.rb +0 -7
- data/spec/rspec/expectations/filter/bugs/description_generation.rb +0 -4
- data/spec/rspec/expectations/filter/bugs/dsl.txt +0 -14
- data/spec/rspec/expectations/filter/bugs/expectation_target.txt +0 -2
- data/spec/rspec/expectations/filter/bugs/expectations.txt +0 -2
- data/spec/rspec/expectations/filter/bugs/have_attributes.rb +0 -8
- data/spec/rspec/expectations/filter/bugs/include.rb +0 -4
- data/spec/rspec/expectations/filter/unsupported/dsl.txt +0 -8
- data/spec/rspec/expectations/filter/unsupported/respond_to.rb +0 -5
- data/spec/rspec/expectations/fixes/opal_itself.rb +0 -140
- data/spec/rspec/mocks/filter/bugs/and_call_original.txt +0 -9
- data/spec/rspec/mocks/filter/bugs/argument_matchers.rb +0 -3
- data/spec/rspec/mocks/filter/bugs/double.txt +0 -3
- data/spec/rspec/mocks/filter/bugs/methods.rb +0 -5
- data/spec/rspec/mocks/filter/unsupported/and_call_original.txt +0 -5
- data/spec/rspec/mocks/filter/unsupported/and_return.txt +0 -2
- data/spec/rspec/mocks/filter/unsupported/expected_arg_verification.txt +0 -2
- data/spec/rspec/mocks/filter/unsupported/instance_double_with_class_loaded.txt +0 -8
- data/spec/rspec/mocks/filter/unsupported/receive_message_chain.rb +0 -4
- data/spec/rspec/mocks/filter/unsupported/stub.rb +0 -7
- data/spec/rspec/mocks/fixes/opal_itself.rb +0 -59
- data/spec/rspec/support/filter/unsupported/fuzzy_matcher.txt +0 -2
- data/spec/rspec/support/fixes/opal_itself.rb +0 -13
@@ -1,20 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe 'hooks' do
|
2
4
|
describe 'after' do
|
3
5
|
before :all do
|
4
6
|
@@total = 0
|
5
7
|
@@example_still_in_progress = nil
|
6
8
|
end
|
7
|
-
|
9
|
+
|
8
10
|
after :all do
|
9
11
|
expected = 13
|
10
12
|
unless @@total == expected
|
11
|
-
msg = "Expected #{expected} after hits but got #{@@total}"
|
13
|
+
msg = "Expected #{expected} after hits but got #{@@total}"
|
12
14
|
`console.error(#{msg})`
|
13
|
-
end
|
15
|
+
end
|
14
16
|
end
|
15
|
-
|
17
|
+
|
16
18
|
let(:raise_before_error) { false }
|
17
|
-
|
19
|
+
|
18
20
|
before do |example|
|
19
21
|
if raise_before_error
|
20
22
|
@@example_still_in_progress = nil
|
@@ -26,71 +28,71 @@ describe 'hooks' do
|
|
26
28
|
end
|
27
29
|
@@example_still_in_progress = example.description
|
28
30
|
end
|
29
|
-
|
30
|
-
let(:raise_after_error) { false }
|
31
|
-
|
31
|
+
|
32
|
+
let(:raise_after_error) { false }
|
33
|
+
|
32
34
|
context 'sync' do
|
33
35
|
after do
|
34
36
|
@@total += 1
|
35
|
-
@@example_still_in_progress = nil
|
37
|
+
@@example_still_in_progress = nil
|
36
38
|
raise 'expected after problem' if raise_after_error
|
37
39
|
end
|
38
|
-
|
39
|
-
subject { 42 }
|
40
|
-
|
40
|
+
|
41
|
+
subject { 42 }
|
42
|
+
|
41
43
|
context 'before fails' do
|
42
44
|
let(:raise_before_error) { true }
|
43
|
-
|
45
|
+
|
44
46
|
it 'should not reach the example' do
|
45
47
|
fail 'we reached the example and we should not have!'
|
46
48
|
end
|
47
49
|
end
|
48
|
-
|
50
|
+
|
49
51
|
context 'match succeeds' do
|
50
52
|
context 'sync match' do
|
51
53
|
it { is_expected.to eq 42 }
|
52
54
|
end
|
53
|
-
|
55
|
+
|
54
56
|
it 'async match' do
|
55
57
|
delay_with_promise 0 do
|
56
58
|
expect(subject).to eq 42
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
60
|
-
|
62
|
+
|
61
63
|
context 'match fails' do
|
62
64
|
context 'sync match' do
|
63
65
|
it { is_expected.to eq 43 }
|
64
66
|
end
|
65
|
-
|
67
|
+
|
66
68
|
it 'async match' do
|
67
69
|
delay_with_promise 0 do
|
68
70
|
expect(subject).to eq 43
|
69
71
|
end
|
70
72
|
end
|
71
|
-
end
|
72
|
-
|
73
|
+
end
|
74
|
+
|
73
75
|
context 'after fails' do
|
74
76
|
let(:raise_after_error) { true }
|
75
|
-
|
77
|
+
|
76
78
|
it { is_expected.to eq 42 }
|
77
79
|
end
|
78
|
-
|
80
|
+
|
79
81
|
context 'context' do
|
80
82
|
after :context do
|
81
83
|
raise 'it failed in the after context!'
|
82
84
|
end
|
83
|
-
|
85
|
+
|
84
86
|
it { is_expected.to eq 42 }
|
85
87
|
end
|
86
88
|
end
|
87
|
-
|
89
|
+
|
88
90
|
context 'async' do
|
89
91
|
after do
|
90
92
|
delay_with_promise 0 do
|
91
93
|
@@total += 1
|
92
94
|
@@example_still_in_progress = nil
|
93
|
-
raise 'after problem' if raise_after_error
|
95
|
+
raise 'after problem' if raise_after_error
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
data/spec/opal/async_spec.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe 'legacy async' do
|
2
4
|
let(:foo) { 100 }
|
3
5
|
|
4
6
|
before do
|
5
7
|
@model = Object.new
|
6
8
|
end
|
7
|
-
|
9
|
+
|
8
10
|
async "fails properly after a long delay" do
|
9
11
|
obj = [2, 2, 3, 4]
|
10
12
|
|
@@ -12,7 +14,7 @@ describe 'legacy async' do
|
|
12
14
|
async { obj.should == [1, 2, 3, 4] }
|
13
15
|
end
|
14
16
|
end
|
15
|
-
|
17
|
+
|
16
18
|
async 'allows overriding the timeout', timeout: 15 do
|
17
19
|
delay(11) do
|
18
20
|
async { expect(42).to eq(42) }
|
@@ -52,18 +54,18 @@ describe 'legacy async' do
|
|
52
54
|
end
|
53
55
|
|
54
56
|
describe 'promise' do
|
55
|
-
let(:foo) { 100 }
|
56
|
-
|
57
|
+
let(:foo) { 100 }
|
58
|
+
|
57
59
|
it 'matcher fails properly' do
|
58
60
|
delay_with_promise 0 do
|
59
61
|
1.should == 2
|
60
|
-
end
|
62
|
+
end
|
61
63
|
end
|
62
64
|
|
63
65
|
it 'matcher succeeds' do
|
64
66
|
delay_with_promise 0 do
|
65
67
|
1.should == 1
|
66
|
-
end
|
68
|
+
end
|
67
69
|
end
|
68
70
|
|
69
71
|
context 'non-assertion failure in promise' do
|
@@ -89,7 +91,7 @@ describe 'promise' do
|
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
92
|
-
|
94
|
+
|
93
95
|
context 'skipped' do
|
94
96
|
it 'via variable', skip: true do
|
95
97
|
obj = [1, 2, 3, 4]
|
@@ -105,30 +107,30 @@ describe 'promise' do
|
|
105
107
|
delay_with_promise 0 do
|
106
108
|
obj.should == [2, 2, 3, 4]
|
107
109
|
end
|
108
|
-
end
|
109
|
-
|
110
|
+
end
|
111
|
+
|
110
112
|
it 'in example, inside promise' do
|
111
113
|
delay_with_promise 0 do
|
112
114
|
skip 'want to skip within'
|
113
115
|
end
|
114
116
|
end
|
115
|
-
|
117
|
+
|
116
118
|
it 'in example, outside promise' do
|
117
119
|
skip 'want to skip within'
|
118
120
|
delay_with_promise 0 do
|
119
121
|
1.should == 1
|
120
|
-
end
|
121
|
-
end
|
122
|
+
end
|
123
|
+
end
|
122
124
|
end
|
123
|
-
|
125
|
+
|
124
126
|
context 'pending' do
|
125
127
|
it 'in example' do
|
126
128
|
obj = [1, 2, 3, 4]
|
127
129
|
|
128
130
|
delay_with_promise 0 do
|
129
131
|
pending 'want to pend within'
|
130
|
-
obj.should == [2, 2, 3, 4]
|
131
|
-
end
|
132
|
+
obj.should == [2, 2, 3, 4]
|
133
|
+
end
|
132
134
|
end
|
133
135
|
|
134
136
|
it 'via variable', pending: 'the reason' do
|
@@ -137,8 +139,8 @@ describe 'promise' do
|
|
137
139
|
delay_with_promise 0 do
|
138
140
|
obj.should == [2, 2, 3, 4]
|
139
141
|
end
|
140
|
-
end
|
141
|
-
end
|
142
|
+
end
|
143
|
+
end
|
142
144
|
|
143
145
|
it "should make example fail properly before async block reached" do
|
144
146
|
expect(:foo).to eq(:baz)
|
@@ -146,18 +148,18 @@ describe 'promise' do
|
|
146
148
|
delay_with_promise(0) do
|
147
149
|
expect(nil).to eq 'we reached this assertion and we should not have'
|
148
150
|
end
|
149
|
-
end
|
151
|
+
end
|
150
152
|
end
|
151
153
|
|
152
154
|
describe 'async/sync mix' do
|
153
155
|
it 'fails properly if a sync test is among async tests' do
|
154
156
|
1.should == 2
|
155
157
|
end
|
156
|
-
|
158
|
+
|
157
159
|
it 'is an async test between 2 sync tests' do
|
158
160
|
delay_with_promise 0 do
|
159
161
|
1.should == 1
|
160
|
-
end
|
162
|
+
end
|
161
163
|
end
|
162
164
|
|
163
165
|
it 'passes correctly if a sync test is among async tests' do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe 'hooks' do
|
2
4
|
describe 'before' do
|
3
5
|
context 'async' do
|
@@ -101,83 +103,83 @@ describe 'hooks' do
|
|
101
103
|
end
|
102
104
|
end
|
103
105
|
end
|
104
|
-
|
106
|
+
|
105
107
|
context 'sync' do
|
106
108
|
context 'with sync subject' do
|
107
109
|
subject { 42 }
|
108
|
-
|
110
|
+
|
109
111
|
context 'context' do
|
110
112
|
context 'success' do
|
111
113
|
before :context do
|
112
114
|
@@before_context_both_sync = 22
|
113
115
|
end
|
114
|
-
|
116
|
+
|
115
117
|
before do
|
116
118
|
raise "@@before_context_both_sync should already be 22!" unless @@before_context_both_sync == 22
|
117
119
|
@test_value = 42
|
118
120
|
end
|
119
|
-
|
120
|
-
it { is_expected.to eq @test_value }
|
121
|
+
|
122
|
+
it { is_expected.to eq @test_value }
|
121
123
|
end
|
122
|
-
|
124
|
+
|
123
125
|
context 'fails properly' do
|
124
126
|
before :context do
|
125
127
|
raise 'it failed in the before context!'
|
126
128
|
@@before_context_both_sync = 55
|
127
129
|
end
|
128
|
-
|
130
|
+
|
129
131
|
before do
|
130
132
|
raise "we reached before:each and we should not have!" if @@before_context_both_sync == 55
|
131
133
|
end
|
132
|
-
|
134
|
+
|
133
135
|
it 'should not reach the example' do
|
134
136
|
fail 'we reached the example and we should not have!'
|
135
137
|
end
|
136
138
|
end
|
137
139
|
end
|
138
|
-
|
140
|
+
|
139
141
|
context 'succeeds' do
|
140
142
|
before do
|
141
143
|
@test_value = 42
|
142
144
|
end
|
143
|
-
|
145
|
+
|
144
146
|
it { is_expected.to eq @test_value }
|
145
147
|
end
|
146
|
-
|
148
|
+
|
147
149
|
context 'before :each fails properly' do
|
148
150
|
before do
|
149
151
|
raise 'before :each failed properly'
|
150
152
|
end
|
151
|
-
|
153
|
+
|
152
154
|
it 'should not reach the example' do
|
153
155
|
fail 'we reached the example and we should not have!'
|
154
156
|
end
|
155
157
|
end
|
156
|
-
|
158
|
+
|
157
159
|
context 'first before :each in chain triggers failure' do
|
158
160
|
before do
|
159
161
|
raise 'first before :each fails, this is correct'
|
160
162
|
end
|
161
|
-
|
163
|
+
|
162
164
|
context 'inner context' do
|
163
165
|
before do
|
164
166
|
raise 'we reached the inner before :each and we should not have'
|
165
167
|
end
|
166
|
-
|
168
|
+
|
167
169
|
it 'should not reach the example' do
|
168
170
|
fail 'we reached the example and we should not have!'
|
169
171
|
end
|
170
172
|
end
|
171
173
|
end
|
172
|
-
|
174
|
+
|
173
175
|
context 'match fails properly' do
|
174
176
|
before do
|
175
177
|
@test_value = 42
|
176
178
|
end
|
177
|
-
|
179
|
+
|
178
180
|
it { is_expected.to_not eq @test_value }
|
179
181
|
end
|
180
182
|
end
|
181
|
-
end
|
183
|
+
end
|
182
184
|
end
|
183
185
|
end
|
data/spec/opal/example_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
module SomeHelpers
|
2
4
|
def opal_rspec_helper
|
3
5
|
let(:defined_opal_helper) { :it_works }
|
@@ -166,9 +168,9 @@ describe 'exception handling' do
|
|
166
168
|
it "should fail properly if an exception is raised" do
|
167
169
|
raise 'problem'
|
168
170
|
end
|
169
|
-
|
171
|
+
|
170
172
|
it "should ignore an exception after a failed assertion" do
|
171
173
|
expect(42).to eq(43)
|
172
174
|
raise 'problem'
|
173
|
-
end
|
175
|
+
end
|
174
176
|
end
|
data/spec/opal/matchers_spec.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe "be_truthy" do
|
2
4
|
it "passes with truthy values" do
|
3
5
|
expect(true).to be_truthy
|
4
6
|
expect(1.0).to be_truthy
|
5
7
|
expect([]).to be_truthy
|
6
8
|
end
|
7
|
-
|
9
|
+
|
8
10
|
it 'fails properly with truthy values' do
|
9
11
|
expect(false).to be_truthy
|
10
12
|
end
|
data/spec/opal/mock_spec.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
1
3
|
describe 'skip' do
|
2
4
|
it 'in example, no promise' do
|
3
5
|
skip 'want to skip within'
|
4
6
|
end
|
5
|
-
|
7
|
+
|
6
8
|
it 'no implementation provided'
|
7
9
|
|
8
10
|
skip 'entire group' do
|
@@ -30,14 +32,14 @@ describe 'pending' do
|
|
30
32
|
it 'would fail otherwise' do
|
31
33
|
pending 'want to pend within example'
|
32
34
|
obj = [1, 2, 3, 4]
|
33
|
-
obj.should == [2, 2, 3, 4]
|
35
|
+
obj.should == [2, 2, 3, 4]
|
34
36
|
end
|
35
|
-
|
37
|
+
|
36
38
|
it 'would not fail otherwise, thus fails properly' do
|
37
39
|
pending 'want to pend within example'
|
38
40
|
obj = [1, 2, 3, 4]
|
39
|
-
obj.should == [1, 2, 3, 4]
|
41
|
+
obj.should == [1, 2, 3, 4]
|
40
42
|
end
|
41
43
|
end
|
42
|
-
end
|
44
|
+
end
|
43
45
|
end
|
data/spec/opal/subject_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
rspec_filter 'hooks' do
|
2
2
|
# promise, see opal alternates
|
3
3
|
filter /RSpec::Core::Hooks when an error happens in.* allows the error to propagate to the user/
|
4
|
-
filter('RSpec::Core::Hooks#around considers the hook to have run when passed as a block to a method that yields').unless { at_least_opal_0_9? }
|
5
4
|
|
6
5
|
# promise, for some reason succeeds on Opal 0.8, see opal alternates
|
7
6
|
filter('RSpec::Core::Hooks#around does not consider the hook to have run when passed as a block to a method that does not yield').if { at_least_opal_0_9? }
|
@@ -0,0 +1,4 @@
|
|
1
|
+
rspec_filter 'metadata' do
|
2
|
+
# Promise on the run, see opal alternates
|
3
|
+
filter('RSpec::Core::Metadata backwards compatibility :example_group allows integration libraries like VCR to infer a fixture name from the example description by walking up nesting structure').unless { at_least_opal_0_11? }
|
4
|
+
end
|
@@ -2,10 +2,4 @@ rspec_filter 'memoized_helpers' do
|
|
2
2
|
# These depend on https://github.com/opal/opal/issues/1124, but you can only reproduce that with Opal 0.9
|
3
3
|
filter 'RSpec::Core::MemoizedHelpers explicit subject with a name when `super` is used raises a "not supported" error'
|
4
4
|
filter 'RSpec::Core::MemoizedHelpers explicit subject with a name when `super` is used with a `let` definition before the named subject raises a "not supported" error'
|
5
|
-
|
6
|
-
# This works right in Opal 0.9 (see sandbox/subject_issue_test), might be something with the class scoping PR (https://github.com/opal/opal/pull/1114) that requires compiler changes to fix
|
7
|
-
filter("RSpec::Core::MemoizedHelpers explicit subject with a name yields the example in which it is eval'd").unless { at_least_opal_0_9? }
|
8
|
-
|
9
|
-
# This works right in Opal 0.9 (Class === Enumerable), might be https://github.com/opal/opal/commit/304ab9c464754ca54ab03f1f31d5c137ae8e995d but not sure
|
10
|
-
filter('RSpec::Core::MemoizedHelpers implicit subject with a Module returns the Module').unless { at_least_opal_0_9? }
|
11
5
|
end
|
@@ -1,5 +1,10 @@
|
|
1
1
|
require 'opal/progress_json_formatter' # verify case uses this
|
2
2
|
|
3
|
+
# Only doing this because this spec causes the runner itself to break
|
4
|
+
CAUSES_SPECS_TO_CRASH = [
|
5
|
+
'RSpec::Expectations::Configuration#backtrace_formatter defaults to a null formatter when rspec-core is not loaded'
|
6
|
+
]
|
7
|
+
|
3
8
|
RSpec::configure do |config|
|
4
9
|
config.color = true
|
5
10
|
|
@@ -11,6 +16,6 @@ RSpec::configure do |config|
|
|
11
16
|
expectations.syntax = :expect
|
12
17
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
13
18
|
end
|
14
|
-
|
19
|
+
config.filter_run_excluding full_description: Regexp.union(CAUSES_SPECS_TO_CRASH)
|
15
20
|
#config.full_description = 'RSpec::Matchers once required includes itself in Minitest::Test'
|
16
21
|
end
|
@@ -3,6 +3,3 @@ RSpec::Expectations::Configuration configuring rspec-expectations directly behav
|
|
3
3
|
RSpec::Expectations::Configuration configuring rspec-expectations directly behaves like configuring the expectation syntax can limit the syntax to :expect
|
4
4
|
RSpec::Expectations::Configuration configuring using the rspec-core config API behaves like configuring the expectation syntax can limit the syntax to :should
|
5
5
|
RSpec::Expectations::Configuration configuring using the rspec-core config API behaves like configuring the expectation syntax can limit the syntax to :expect
|
6
|
-
|
7
|
-
# global config problem
|
8
|
-
RSpec::Expectations::Configuration#backtrace_formatter defaults to a null formatter when rspec-core is not loaded
|
@@ -1,11 +1,6 @@
|
|
1
1
|
rspec_filter 'contain_exactly' do
|
2
2
|
# https://github.com/opal/opal/pull/1136 - operators and method missing issues with a_value > < etc
|
3
3
|
filter /should_not =~ \[:with, :multiple, :args\] fails when the arrays match.*/
|
4
|
-
unless at_least_opal_0_9?
|
5
|
-
filter('should =~ array when the array undefines `=~` still works')
|
6
|
-
filter('using contain_exactly with expect passes for an out of order valid positive expectation with hashes')
|
7
|
-
filter('using contain_exactly with expect passes for an in order valid positive expectation with hashes')
|
8
|
-
end
|
9
4
|
filter('should =~ array when the array defines a `send` method still works')
|
10
5
|
filter('should =~ array when the array defines a `=~` method delegates to that method rather than using the contain_exactly matcher')
|
11
6
|
filter('should =~ array fails an invalid positive expectation')
|
@@ -1,7 +1,6 @@
|
|
1
1
|
rspec_filter 'define_negated_matcher' do
|
2
2
|
# method owner (no issue/PR) and block (https://github.com/opal/opal/pull/1132)
|
3
3
|
filter('RSpec::Matchers.define_negated_matcher when the negated description is overriden overrides the failure message with the provided block')
|
4
|
-
filter('RSpec::Matchers.define_negated_matcher when the negated description is overriden overrides the description with the provided block').unless { at_least_opal_0_9? }
|
5
4
|
filter('RSpec::Matchers.define_negated_matcher when no block is passed when matched negatively fails matches against values that pass the original matcher')
|
6
5
|
filter('RSpec::Matchers.define_negated_matcher when no block is passed when matched positively fails matches against values that pass the original matcher')
|
7
6
|
filter('RSpec::Matchers.define_negated_matcher the failure message for a matcher with default failure messages when failing negatively uses the phrasing from the provided defined matcher alias')
|
@@ -0,0 +1,15 @@
|
|
1
|
+
rspec_filter 'dsl' do
|
2
|
+
filter('RSpec::Matchers::DSL::Matcher allows chainable methods to accept blocks').unless { at_least_opal_0_10? }
|
3
|
+
|
4
|
+
# something w/ inheritance is wrong here
|
5
|
+
filter 'RSpec::Matchers::DSL::Matcher defined using the dsl can get a method object for methods in the running example'
|
6
|
+
|
7
|
+
# probably class scoping issue since new_matcher creates a new DSL matcher class, probably https://github.com/opal/opal/issues/1110 related
|
8
|
+
filter('RSpec::Matchers::DSL::Matcher#match_unless_raises without a specified error class passes if no error is raised').unless { at_least_opal_0_10? }
|
9
|
+
|
10
|
+
# not sure, class scoping issue? (see above)
|
11
|
+
filter('RSpec::Matchers::DSL::Matcher#match_unless_raises with an unexpected error raises the error').unless { at_least_opal_0_10? }
|
12
|
+
filter('RSpec::Matchers::DSL::Matcher#match_unless_raises with an assertion with passing assertion passes').unless { at_least_opal_0_10? }
|
13
|
+
filter('RSpec::Matchers::DSL::Matcher with an included module allows multiple modules to be included at once').unless { at_least_opal_0_10? }
|
14
|
+
filter('RSpec::Matchers::DSL::Matcher allows an early `return` to be used from a `match_unless_raises` block').unless { at_least_opal_0_10? }
|
15
|
+
end
|
@@ -0,0 +1,4 @@
|
|
1
|
+
rspec_filter 'expectations' do
|
2
|
+
# Probably more related to nesting lambdas in the test than with using raise_error - https://github.com/opal/opal/pull/1117
|
3
|
+
filter('RSpec::Expectations does not allow expectation failures to be caught by a bare rescue').unless { at_least_opal_0_10? }
|
4
|
+
end
|
@@ -1,13 +1,7 @@
|
|
1
1
|
rspec_filter 'respond_to' do
|
2
|
-
#
|
3
|
-
filter('expect(...).
|
4
|
-
filter('expect(...).to respond_to(:sym).with(2).arguments passes if target responds to
|
5
|
-
filter
|
6
|
-
filter('expect(...).
|
7
|
-
|
8
|
-
# arity related
|
9
|
-
filter('expect(...).to respond_to(:sym).with(1).argument passes if target responds to any number of arguments').if { at_least_opal_0_9? }
|
10
|
-
filter('expect(...).to respond_to(:sym).with(2).arguments passes if target responds to one or more arguments').if { at_least_opal_0_9? }
|
11
|
-
filter('expect(...).not_to respond_to(:sym).with(1).argument fails if target responds to :sym with any number of args').if { at_least_opal_0_9? }
|
12
|
-
filter('expect(...).not_to respond_to(:sym).with(2).arguments fails if target responds to :sym with one or more args').if { at_least_opal_0_9? }
|
2
|
+
# arity + splat related in opal (more related to Method#arity than arity checking)
|
3
|
+
filter('expect(...).to respond_to(:sym).with(1).argument passes if target responds to any number of arguments').unless { at_least_opal_0_10? }
|
4
|
+
filter('expect(...).to respond_to(:sym).with(2).arguments passes if target responds to one or more arguments').unless { at_least_opal_0_10? }
|
5
|
+
filter('expect(...).not_to respond_to(:sym).with(1).argument fails if target responds to :sym with any number of args').unless { at_least_opal_0_10? }
|
6
|
+
filter('expect(...).not_to respond_to(:sym).with(2).arguments fails if target responds to :sym with one or more args').unless { at_least_opal_0_10? }
|
13
7
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
rspec_filter 'dsl' do
|
2
|
+
# mutable strings, see opal alternates
|
3
|
+
filter 'RSpec::Matchers::DSL::Matcher defined using the dsl raises NoMethodError for methods not in the running_example'
|
4
|
+
|
5
|
+
# Fixnum = Numeric on Opal, see opal alternates
|
6
|
+
filter 'RSpec::Matchers::DSL::Matcher wrapping another expectation (expect(...).to eq ...) can use the `include` matcher from a `match` block'
|
7
|
+
|
8
|
+
# regex compatibility, see opal alternates
|
9
|
+
filter('RSpec::Matchers::DSL::Matcher wrapping another expectation (expect(...).to eq ...) can use the `match` matcher from a `match` block').unless { at_least_opal_0_11? }
|
10
|
+
end
|
@@ -13,20 +13,3 @@ module Opal
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
17
|
-
unless Opal::RSpec::Compatibility.constant_resolution_works_right?
|
18
|
-
groups_are_in = RSpec::ExampleGroups
|
19
|
-
built_in_spec = :BuiltInMatchers
|
20
|
-
# in case we aren't running all of the examples
|
21
|
-
if groups_are_in.const_defined? built_in_spec
|
22
|
-
example_group = groups_are_in.const_get built_in_spec
|
23
|
-
example_group.let(:matchers) do
|
24
|
-
# .constants is broken in Opal, this is a hack
|
25
|
-
constants = Opal::RSpec.get_constants_for(RSpec::Matchers::BuiltIn) - [:NullCapture, :CaptureStdOut, :CaptureStdErr]
|
26
|
-
constants.map { |n| RSpec::Matchers::BuiltIn.const_get(n) }.select do |m|
|
27
|
-
#BuiltIn.constants.map { |n| BuiltIn.const_get(n) }.select do |m|
|
28
|
-
m.method_defined?(:matches?) && m.method_defined?(:failure_message)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -31,14 +31,14 @@ describe 'Opal RSpec::Matchers::DSL::Matcher' do
|
|
31
31
|
|
32
32
|
expect {
|
33
33
|
expect(Fixnum).to descend_from(Array)
|
34
|
-
}.to fail_with(/expected
|
34
|
+
}.to fail_with(/expected Number to descend from Array/)
|
35
35
|
# Fixnum = Numeric on Opal
|
36
36
|
#}.to fail_with(/expected Fixnum to descend from Array/)
|
37
37
|
|
38
38
|
expect {
|
39
39
|
expect(Fixnum).not_to descend_from(Object)
|
40
40
|
# Fixnum = Numeric on Opal
|
41
|
-
}.to fail_with(/expected
|
41
|
+
}.to fail_with(/expected Number not to descend from Object/)
|
42
42
|
#}.to fail_with(/expected Fixnum not to descend from Object/)
|
43
43
|
end
|
44
44
|
|