Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03bd63d

Browse files
committed
fix tests for the latest TypeScript compiler
1 parent de78697 commit 03bd63d

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
33
# Specify your gem's dependencies in typescript-rails.gemspec
44
gemspec
55

6-
gem 'rails', '~> 3.2.0'
6+
gem 'rails', '~> 4.0'

test/template_handler_test.rb

+13-7
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,33 @@ def app
2323
@app ||= DummyApp
2424
end
2525

26+
def source
27+
# source without comments
28+
last_response.body.gsub(%r{^//[^\n]*}m, '')
29+
end
30+
2631
test "typescript views are served as javascript" do
2732
get "/site/index.js"
28-
29-
s = last_response.body
30-
assert_match /var x = 5;\s*/, last_response.body
33+
assert_match /var x = 5;\s*/,
34+
source
3135
end
3236

3337
test "<reference> to other .ts file works" do
3438
get "/site/ref1_2.js"
35-
assert_match /var f = function \(x, y\) \{\s*return x \+ y;\s*\};\s*f\(1, 2\);\s*/, last_response.body
39+
assert_match /var f = function \(x, y\) \{\s*return x \+ y;\s*\};\s*f\(1, 2\);\s*/,
40+
source
3641
end
3742

3843
test "<reference> to other .d.ts file works" do
3944
get "/site/ref2_2.js"
40-
assert_match /f\(1, 2\);\s*/, last_response.body
45+
assert_match /f\(1, 2\);\s*/,
46+
source
4147
end
4248

4349
test "<reference> to multiple .ts files works" do
4450
get "/site/ref3_1.js"
45-
assert_match /var f1 = function \(\) \{\s*\};\s*var f2 = function \(\) \{\s*\};\s*f1\(\);\s*f2\(\);\s*/,
46-
last_response.body
51+
assert_match /var f1 = function \(\) \{\s*\};\s*var f2 = function \(\) \{\s*\};\s*f1\(\);\s*f2\(\);/,
52+
source
4753
end
4854

4955
end

0 commit comments

Comments
 (0)