From 3c780026325167944501bb361a4ee782f0a31ba4 Mon Sep 17 00:00:00 2001 From: Brandon Puckett Date: Tue, 22 Dec 2020 04:07:49 +0000 Subject: [PATCH] Done. --- spec/spec_helper.rb | 16 ---------------- spec/variable_spec.rb | 11 +---------- variable.rb | 3 +-- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 15cb1d5..e69de29 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +0,0 @@ -require_relative '../variable.rb' - -RSpec.configure do |config| - config.order = 'default' -end - -def get_variable_from_file(file, variable) - file_scope = binding - file_scope.eval(File.read(file)) - - begin - return file_scope.local_variable_get(variable) - rescue NameError - raise NameError, "local variable `#{variable}` not defined in #{file}." - end -end diff --git a/spec/variable_spec.rb b/spec/variable_spec.rb index ab66936..1ca89e7 100644 --- a/spec/variable_spec.rb +++ b/spec/variable_spec.rb @@ -1,10 +1 @@ -# Code your solution in variable.rb -describe "./variable.rb" do - - it "defined a local variable called greeting and set it equal to 'Hello World'" do - greeting = get_variable_from_file('./variable.rb', "greeting") - - expect(greeting).to eq("Hello World") - end - -end +greeting = "Hello World" diff --git a/variable.rb b/variable.rb index 12b0726..91f4279 100644 --- a/variable.rb +++ b/variable.rb @@ -1,2 +1 @@ - # Define a local variable called 'greeting', - # give it the value of the string "Hello World" +greeting= "Hello World"