Skip to content

Commit 0801f8a

Browse files
committed
eliminate deprecation warnings
1 parent 5ce6c13 commit 0801f8a

26 files changed

+108
-100
lines changed

spec/camelcase_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe Ruby2JS::Filter::CamelCase do
66

77
def to_js( string)
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::CamelCase]).to_s
8+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::CamelCase]).to_s)
99
end
1010

1111
describe :camelCase do
@@ -44,7 +44,7 @@ def to_js( string)
4444

4545
describe Ruby2JS::Filter::DEFAULTS do
4646
it "should include CamelCase" do
47-
Ruby2JS::Filter::DEFAULTS.must_include Ruby2JS::Filter::CamelCase
47+
_(Ruby2JS::Filter::DEFAULTS).must_include Ruby2JS::Filter::CamelCase
4848
end
4949
end
5050
end

spec/cjs_spec.rb

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,58 @@
55
describe Ruby2JS::Filter::CJS do
66

77
def to_js( string)
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::CJS],
9-
file: __FILE__, eslevel: 2017)
8+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::CJS],
9+
file: __FILE__, eslevel: 2017).to_s)
1010
end
1111

1212
def to_js_fn( string)
13-
Ruby2JS.convert(string,
13+
_(Ruby2JS.convert(string,
1414
filters: [Ruby2JS::Filter::CJS, Ruby2JS::Filter::Functions],
15-
file: __FILE__, eslevel: 2017)
15+
file: __FILE__, eslevel: 2017).to_s)
1616
end
1717

1818
describe :exports do
1919
it "should export a simple function" do
20-
to_js( 'export def f(a); return a; end' ).to_s.
20+
to_js( 'export def f(a); return a; end' ).
2121
must_equal 'exports.f = a => a'
2222
end
2323

2424
it "should export an async function" do
25-
to_js( 'export async def f(a, b); return a; end' ).to_s.
25+
to_js( 'export async def f(a, b); return a; end' ).
2626
must_equal 'exports.f = async (a, b) => a'
2727
end
2828

2929
it "should export a value" do
30-
to_js( 'export foo = 1' ).to_s.
30+
to_js( 'export foo = 1' ).
3131
must_equal 'exports.foo = 1'
3232
end
3333

3434
it "should convert .inspect into JSON.stringify()" do
35-
to_js_fn( 'export async def f(a, b); return {input: a}.inspect; end' ).to_s.
35+
to_js_fn( 'export async def f(a, b); return {input: a}.inspect; end' ).
3636
must_equal 'exports.f = async (a, b) => JSON.stringify({input: a})'
3737
end
3838
end
3939

4040
describe :default do
4141
it "should export a simple function" do
42-
to_js( 'export default proc do |a|; return a; end' ).to_s.
42+
to_js( 'export default proc do |a|; return a; end' ).
4343
must_equal 'module.exports = a => a'
4444
end
4545

4646
it "should export an async function" do
47-
to_js( 'export default async proc do |a, b| return a; end' ).to_s.
47+
to_js( 'export default async proc do |a, b| return a; end' ).
4848
must_equal 'module.exports = async (a, b) => a'
4949
end
5050

5151
it "should export a value" do
52-
to_js( 'export default 1' ).to_s.
52+
to_js( 'export default 1' ).
5353
must_equal 'module.exports = 1'
5454
end
5555
end
5656

5757
describe Ruby2JS::Filter::DEFAULTS do
5858
it "should include CJS" do
59-
Ruby2JS::Filter::DEFAULTS.must_include Ruby2JS::Filter::CJS
59+
_(Ruby2JS::Filter::DEFAULTS).must_include Ruby2JS::Filter::CJS
6060
end
6161
end
6262
end

spec/comments_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe Ruby2JS::Filter::Functions do
66

77
def to_js( string)
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::Functions]).to_s
8+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::Functions]).to_s)
99
end
1010

1111
describe 'conversions' do

spec/es2015_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
describe "ES2015 support" do
55

66
def to_js(string)
7-
Ruby2JS.convert(string, eslevel: 2015, filters: []).to_s
7+
_(Ruby2JS.convert(string, eslevel: 2015, filters: []).to_s)
88
end
99

1010
def to_js_fn(string)
11-
Ruby2JS.convert(string, eslevel: 2015,
12-
filters: [Ruby2JS::Filter::Functions]).to_s
11+
_(Ruby2JS.convert(string, eslevel: 2015,
12+
filters: [Ruby2JS::Filter::Functions]).to_s)
1313
end
1414

1515
describe :vars do

spec/es2016_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
describe "ES2016 support" do
55

66
def to_js(string)
7-
Ruby2JS.convert(string, eslevel: 2016, filters: []).to_s
7+
_(Ruby2JS.convert(string, eslevel: 2016, filters: []).to_s)
88
end
99

1010
def to_js_fn(string)
11-
Ruby2JS.convert(string, eslevel: 2016,
12-
filters: [Ruby2JS::Filter::Functions]).to_s
11+
_(Ruby2JS.convert(string, eslevel: 2016,
12+
filters: [Ruby2JS::Filter::Functions]).to_s)
1313
end
1414

1515
describe :operator do

spec/es2017_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
describe "ES2017 support" do
55

66
def to_js( string)
7-
Ruby2JS.convert(string, eslevel: 2017, filters: []).to_s
7+
_(Ruby2JS.convert(string, eslevel: 2017, filters: []).to_s)
88
end
99

1010
def to_js_fn(string)
11-
Ruby2JS.convert(string, eslevel: 2017,
12-
filters: [Ruby2JS::Filter::Functions]).to_s
11+
_(Ruby2JS.convert(string, eslevel: 2017,
12+
filters: [Ruby2JS::Filter::Functions]).to_s)
1313
end
1414

1515
describe :String do

spec/es2018_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
describe "ES2018 support" do
55

66
def to_js(string)
7-
Ruby2JS.convert(string, eslevel: 2018, filters: []).to_s
7+
_(Ruby2JS.convert(string, eslevel: 2018, filters: []).to_s)
88
end
99

1010
def to_js_fn(string)
11-
Ruby2JS.convert(string, eslevel: 2018,
12-
filters: [Ruby2JS::Filter::Functions]).to_s
11+
_(Ruby2JS.convert(string, eslevel: 2018,
12+
filters: [Ruby2JS::Filter::Functions]).to_s)
1313
end
1414

1515
describe :Hash_Spread do

spec/es2019_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
describe "ES2019 support" do
55

66
def to_js( string)
7-
Ruby2JS.convert(string, eslevel: 2019, filters: []).to_s
7+
_(Ruby2JS.convert(string, eslevel: 2019, filters: []).to_s)
88
end
99

1010
def to_js_fn(string)
11-
Ruby2JS.convert(string, eslevel: 2019,
12-
filters: [Ruby2JS::Filter::Functions]).to_s
11+
_(Ruby2JS.convert(string, eslevel: 2019,
12+
filters: [Ruby2JS::Filter::Functions]).to_s)
1313
end
1414

1515
describe :Exception do

spec/exclude_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
describe 'Ruby2JS::Filter.exclude' do
66

77
def to_js( string, options={} )
8-
Ruby2JS.convert(string,
9-
options.merge(filters: [Ruby2JS::Filter::Functions])).to_s
8+
_(Ruby2JS.convert(string,
9+
options.merge(filters: [Ruby2JS::Filter::Functions])).to_s)
1010
end
1111

1212
describe 'default exclude' do

spec/execjs_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313

1414
it "should handle compile" do
1515
skip if @skip
16-
Ruby2JS.compile('i=1').eval('i+1').must_equal 2
16+
_(Ruby2JS.compile('i=1').eval('i+1')).must_equal 2
1717
end
1818

1919
it "should handle eval" do
2020
skip if @skip
21-
Ruby2JS.eval('"abc" =~ /b/', filters: []).must_equal true
21+
_(Ruby2JS.eval('"abc" =~ /b/', filters: [])).must_equal true
2222
end
2323

2424
it "should handle exec" do
2525
skip if @skip
26-
Ruby2JS.exec('x=%w(a b); x << "c"; return x.pop()').must_equal 'c'
26+
_(Ruby2JS.exec('x=%w(a b); x << "c"; return x.pop()')).must_equal 'c'
2727
end
2828
end

spec/functions_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe Ruby2JS::Filter::Functions do
66

77
def to_js(string)
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::Functions]).to_s
8+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::Functions]).to_s)
99
end
1010

1111
describe 'conversions' do
@@ -482,7 +482,7 @@ def to_js(string)
482482

483483
describe Ruby2JS::Filter::DEFAULTS do
484484
it "should include Functions" do
485-
Ruby2JS::Filter::DEFAULTS.must_include Ruby2JS::Filter::Functions
485+
_(Ruby2JS::Filter::DEFAULTS).must_include Ruby2JS::Filter::Functions
486486
end
487487
end
488488
end

spec/haml_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
template.gsub!(/^#{template[/\A\s+/]}/, '')
1313

1414
haml_engine = Haml::Engine.new(template)
15-
output = haml_engine.render
15+
output = _(haml_engine.render)
1616

1717
output.must_include "<script type='text/javascript'>"
1818
output.must_include 'alert("Hello")'

spec/jquery_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe Ruby2JS::Filter::JQuery do
66

77
def to_js(string)
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::JQuery]).to_s
8+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::JQuery]).to_s)
99
end
1010

1111
describe :gvars do
@@ -69,7 +69,7 @@ def to_js(string)
6969

7070
describe Ruby2JS::Filter::DEFAULTS do
7171
it "should include JQuery" do
72-
Ruby2JS::Filter::DEFAULTS.must_include Ruby2JS::Filter::JQuery
72+
_(Ruby2JS::Filter::DEFAULTS).must_include Ruby2JS::Filter::JQuery
7373
end
7474
end
7575
end

spec/matchAll_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
describe "matchAll support" do
77

88
def to_js(string)
9-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::MatchAll]).to_s
9+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::MatchAll]).to_s)
1010
end
1111

1212
def to_js_fn1(string)
13-
Ruby2JS.convert(string,
14-
filters: [Ruby2JS::Filter::Functions, Ruby2JS::Filter::MatchAll]).to_s
13+
_(Ruby2JS.convert(string,
14+
filters: [Ruby2JS::Filter::Functions, Ruby2JS::Filter::MatchAll]).to_s)
1515
end
1616

1717
def to_js_2020(string)
18-
Ruby2JS.convert(string, eslevel: 2020,
19-
filters: [Ruby2JS::Filter::MatchAll]).to_s
18+
_(Ruby2JS.convert(string, eslevel: 2020,
19+
filters: [Ruby2JS::Filter::MatchAll]).to_s)
2020
end
2121

2222
def to_js_fn2(string)
23-
Ruby2JS.convert(string,
24-
filters: [Ruby2JS::Filter::MatchAll, Ruby2JS::Filter::Functions]).to_s
23+
_(Ruby2JS.convert(string,
24+
filters: [Ruby2JS::Filter::MatchAll, Ruby2JS::Filter::Functions]).to_s)
2525
end
2626

2727
describe "without filter functions" do
@@ -54,7 +54,7 @@ def to_js_fn2(string)
5454

5555
describe Ruby2JS::Filter::DEFAULTS do
5656
it "should include MatchAll" do
57-
Ruby2JS::Filter::DEFAULTS.must_include Ruby2JS::Filter::MatchAll
57+
_(Ruby2JS::Filter::DEFAULTS).must_include Ruby2JS::Filter::MatchAll
5858
end
5959
end
6060
end

spec/minitest_jasmine_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
describe Ruby2JS::Filter::MiniTestJasmine do
66

77
def to_js( string, opts={} )
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::MiniTestJasmine]).to_s
8+
_(Ruby2JS.convert(string,
9+
filters: [Ruby2JS::Filter::MiniTestJasmine]).to_s)
910
end
1011

1112
describe 'assertions' do

spec/node_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe Ruby2JS::Filter::Functions do
66

77
def to_js( string)
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::Node]).to_s
8+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::Node]).to_s)
99
end
1010

1111
describe 'globals' do
@@ -238,7 +238,7 @@ def to_js( string)
238238

239239
describe Ruby2JS::Filter::DEFAULTS do
240240
it "should include Node" do
241-
Ruby2JS::Filter::DEFAULTS.must_include Ruby2JS::Filter::Node
241+
_(Ruby2JS::Filter::DEFAULTS).must_include Ruby2JS::Filter::Node
242242
end
243243
end
244244
end

spec/notimplemented_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# see https://github.com/whitequark/parser/blob/master/doc/AST_FORMAT.md
77

88
def todo(string)
9-
proc { Ruby2JS.convert(string, filters: []) }.must_raise NotImplementedError
9+
_(proc { Ruby2JS.convert(string, filters: []) }).
10+
must_raise NotImplementedError
1011
end
1112

1213
it "range inclusive" do

spec/react_spec.rb

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
describe Ruby2JS::Filter::React do
66

77
def to_js(string)
8-
Ruby2JS.convert(string, filters: [Ruby2JS::Filter::React], scope: self).to_s
8+
_(Ruby2JS.convert(string, filters: [Ruby2JS::Filter::React],
9+
scope: self).to_s)
910
end
1011

1112
describe :createClass do
@@ -400,9 +401,9 @@ def to_js(string)
400401
end
401402

402403
it "should not support assigning to class variables" do
403-
proc {
404+
_(proc {
404405
to_js( 'class Foo<React; def method; @@x=1; end; end' )
405-
}.must_raise NotImplementedError
406+
}).must_raise NotImplementedError
406407
end
407408
end
408409

@@ -493,7 +494,7 @@ def to_js(string)
493494

494495
describe Ruby2JS::Filter::DEFAULTS do
495496
it "should include React" do
496-
Ruby2JS::Filter::DEFAULTS.must_include Ruby2JS::Filter::React
497+
_(Ruby2JS::Filter::DEFAULTS).must_include Ruby2JS::Filter::React
497498
end
498499
end
499500
end

0 commit comments

Comments
 (0)