Permalink
Browse files

Use global rather than class vars in reloader spec

The use of class variables in the Reloader spec would trigger warnings
in Ruby 1.9.3 and (I believe) cause the Rubinius failures in same specs.

Related bug: http://bugs.ruby-lang.org/issues/3080
  • Loading branch information...
1 parent d696150 commit 51f44184c978ea7ac877f8deb964c7aba4436280 @TrevorBramble TrevorBramble committed Mar 13, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 spec/reloader_spec.rb
@@ -11,14 +11,14 @@ def tmp_dir
# Returns the path of the Sinatra application file created by
# +setup_example_app+.
def app_file_path
- File.join(tmp_dir, "example_app_#{@@example_app_counter}.rb")
+ File.join(tmp_dir, "example_app_#{$example_app_counter}.rb")
end
# Returns the name of the Sinatra application created by
# +setup_example_app+: 'ExampleApp1' for the first application,
# 'ExampleApp2' fo the second one, and so on...
def app_name
- "ExampleApp#{@@example_app_counter}"
+ "ExampleApp#{$example_app_counter}"
end
# Returns the (constant of the) Sinatra application created by
@@ -70,8 +70,8 @@ def update_file(path, &block)
# the new application as the one being tested and enables the
# reloader.
def setup_example_app(options={})
- @@example_app_counter ||= 0
- @@example_app_counter += 1
+ $example_app_counter ||= 0
+ $example_app_counter += 1
FileUtils.mkdir_p(tmp_dir)
write_app_file(options)

0 comments on commit 51f4418

Please sign in to comment.