use class instance variables instead of class variables
This commit is contained in:
parent
34beda844e
commit
3b8910075a
@ -91,7 +91,7 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @return [Array<String>] The shell and flag.
|
# @return [Array<String>] The shell and flag.
|
||||||
def get_system_shell
|
def get_system_shell
|
||||||
@@shell ||=
|
@shell ||=
|
||||||
begin
|
begin
|
||||||
test_shell = lambda do |*args|
|
test_shell = lambda do |*args|
|
||||||
begin
|
begin
|
||||||
@ -124,7 +124,7 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @return [Array<String>] Command used to execute commands.
|
# @return [Array<String>] Command used to execute commands.
|
||||||
def command_executer
|
def command_executer
|
||||||
@@command_executer ||=
|
@command_executer ||=
|
||||||
if Object.const_get("RUBY_PLATFORM") =~ /mingw/
|
if Object.const_get("RUBY_PLATFORM") =~ /mingw/
|
||||||
if ENV.keys.find {|key| key =~ /MSYS/}
|
if ENV.keys.find {|key| key =~ /MSYS/}
|
||||||
begin
|
begin
|
||||||
@ -143,7 +143,7 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @return [Array<String>] Command used to execute commands.
|
# @return [Array<String>] Command used to execute commands.
|
||||||
def command_executer=(val)
|
def command_executer=(val)
|
||||||
@@command_executer = val
|
@command_executer = val
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -36,11 +36,11 @@ describe Rscons do
|
|||||||
|
|
||||||
describe ".get_system_shell" do
|
describe ".get_system_shell" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
Rscons.class_variable_set(:@@shell, nil)
|
Rscons.instance_variable_set(:@shell, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
after(:each) do
|
after(:each) do
|
||||||
Rscons.class_variable_set(:@@shell, nil)
|
Rscons.instance_variable_set(:@shell, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "uses the SHELL environment variable if it tests successfully" do
|
it "uses the SHELL environment variable if it tests successfully" do
|
||||||
@ -80,11 +80,11 @@ describe Rscons do
|
|||||||
context "command executer" do
|
context "command executer" do
|
||||||
describe ".command_executer" do
|
describe ".command_executer" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
Rscons.class_variable_set(:@@command_executer, nil)
|
Rscons.instance_variable_set(:@command_executer, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
after(:each) do
|
after(:each) do
|
||||||
Rscons.class_variable_set(:@@command_executer, nil)
|
Rscons.instance_variable_set(:@command_executer, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns ['env'] if mingw platform in MSYS and 'env' works" do
|
it "returns ['env'] if mingw platform in MSYS and 'env' works" do
|
||||||
@ -115,10 +115,10 @@ describe Rscons do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe ".command_executer=" do
|
describe ".command_executer=" do
|
||||||
it "overrides the value of @@command_executer" do
|
it "overrides the value of @command_executer" do
|
||||||
Rscons.class_variable_set(:@@command_executer, ["env"])
|
Rscons.instance_variable_set(:@command_executer, ["env"])
|
||||||
Rscons.command_executer = []
|
Rscons.command_executer = []
|
||||||
expect(Rscons.class_variable_get(:@@command_executer)).to eq([])
|
expect(Rscons.instance_variable_get(:@command_executer)).to eq([])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user