File tree 2 files changed +18
-3
lines changed
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change
1
+ module StringSpecs
2
+ class ClassWithClassVariable
3
+ @@a = "xxx"
4
+
5
+ def foo
6
+ "#@@a "
7
+ end
8
+ end
9
+ end
Original file line number Diff line number Diff line change 1
1
# -*- encoding: binary -*-
2
2
3
3
require_relative '../spec_helper'
4
+ require_relative 'fixtures/class_with_class_variable'
4
5
5
6
# TODO: rewrite these horrid specs. it "are..." seriously?!
6
7
27
28
"#$ip" . should == 'xxx'
28
29
end
29
30
31
+ it "interpolate class variables just with the # character" do
32
+ object = StringSpecs ::ClassWithClassVariable . new
33
+ object . foo . should == 'xxx'
34
+ end
35
+
30
36
it "allows underscore as part of a variable name in a simple interpolation" do
31
37
@my_ip = 'xxx'
32
38
"#@my_ip " . should == 'xxx'
@@ -280,15 +286,15 @@ def long_string_literals
280
286
281
287
it "creates a non-frozen String" do
282
288
code = <<~'RUBY'
283
- "a#{6*7}c"
289
+ "a#{6*7}c"
284
290
RUBY
285
291
eval ( code ) . should_not . frozen?
286
292
end
287
293
288
294
it "creates a non-frozen String when # frozen-string-literal: true is used" do
289
295
code = <<~'RUBY'
290
- # frozen-string-literal: true
291
- "a#{6*7}c"
296
+ # frozen-string-literal: true
297
+ "a#{6*7}c"
292
298
RUBY
293
299
eval ( code ) . should_not . frozen?
294
300
end
You can’t perform that action at this time.
0 commit comments