use class instance variables instead of class variables

This commit is contained in:
Josh Holtrop 2015-02-15 18:38:09 -05:00
parent 34beda844e
commit 3b8910075a
2 changed files with 10 additions and 10 deletions

View File

@ -91,7 +91,7 @@ module Rscons
#
# @return [Array<String>] The shell and flag.
def get_system_shell
@@shell ||=
@shell ||=
begin
test_shell = lambda do |*args|
begin
@ -124,7 +124,7 @@ module Rscons
#
# @return [Array<String>] Command used to execute commands.
def command_executer
@@command_executer ||=
@command_executer ||=
if Object.const_get("RUBY_PLATFORM") =~ /mingw/
if ENV.keys.find {|key| key =~ /MSYS/}
begin
@ -143,7 +143,7 @@ module Rscons
#
# @return [Array<String>] Command used to execute commands.
def command_executer=(val)
@@command_executer = val
@command_executer = val
end
end

View File

@ -36,11 +36,11 @@ describe Rscons do
describe ".get_system_shell" do
before(:each) do
Rscons.class_variable_set(:@@shell, nil)
Rscons.instance_variable_set(:@shell, nil)
end
after(:each) do
Rscons.class_variable_set(:@@shell, nil)
Rscons.instance_variable_set(:@shell, nil)
end
it "uses the SHELL environment variable if it tests successfully" do
@ -80,11 +80,11 @@ describe Rscons do
context "command executer" do
describe ".command_executer" do
before(:each) do
Rscons.class_variable_set(:@@command_executer, nil)
Rscons.instance_variable_set(:@command_executer, nil)
end
after(:each) do
Rscons.class_variable_set(:@@command_executer, nil)
Rscons.instance_variable_set(:@command_executer, nil)
end
it "returns ['env'] if mingw platform in MSYS and 'env' works" do
@ -115,10 +115,10 @@ describe Rscons do
end
describe ".command_executer=" do
it "overrides the value of @@command_executer" do
Rscons.class_variable_set(:@@command_executer, ["env"])
it "overrides the value of @command_executer" do
Rscons.instance_variable_set(:@command_executer, ["env"])
Rscons.command_executer = []
expect(Rscons.class_variable_get(:@@command_executer)).to eq([])
expect(Rscons.instance_variable_get(:@command_executer)).to eq([])
end
end
end