From cbf19cc7a47d7a5a2d723eefc48ef1b2130d3220 Mon Sep 17 00:00:00 2001 From: Ryan Fitzgerald Date: Sun, 9 Dec 2012 11:42:41 -0800 Subject: [PATCH] Move all fixtures into fixtures/ --- Rakefile | 2 +- spec/{ => fixtures}/candidate_helper1.rb | 0 spec/{ => fixtures}/candidate_helper2.rb | 0 spec/{ => fixtures}/example_nesting.rb | 0 spec/{ => fixtures}/testrc | 0 spec/{ => fixtures}/testrcbad | 0 spec/helper.rb | 5 ++--- spec/indent_spec.rb | 2 +- spec/pry_spec.rb | 9 +++++---- spec/wrapped_module_spec.rb | 6 ++---- 10 files changed, 11 insertions(+), 13 deletions(-) rename spec/{ => fixtures}/candidate_helper1.rb (100%) rename spec/{ => fixtures}/candidate_helper2.rb (100%) rename spec/{ => fixtures}/example_nesting.rb (100%) rename spec/{ => fixtures}/testrc (100%) rename spec/{ => fixtures}/testrcbad (100%) diff --git a/Rakefile b/Rakefile index 695f77c5..0fbf3a39 100644 --- a/Rakefile +++ b/Rakefile @@ -50,7 +50,7 @@ task :test do check_dependencies unless ENV['SKIP_DEP_CHECK'] all_specs = Dir['spec/**/*_spec.rb'] all_specs.shuffle! if all_specs.respond_to? :shuffle! - system "bacon -Ispec -rubygems -a -q #{all_specs.join ' '}" + system "bacon -Ispec -rubygems -q #{all_specs.join ' '}" end task :spec => :test diff --git a/spec/candidate_helper1.rb b/spec/fixtures/candidate_helper1.rb similarity index 100% rename from spec/candidate_helper1.rb rename to spec/fixtures/candidate_helper1.rb diff --git a/spec/candidate_helper2.rb b/spec/fixtures/candidate_helper2.rb similarity index 100% rename from spec/candidate_helper2.rb rename to spec/fixtures/candidate_helper2.rb diff --git a/spec/example_nesting.rb b/spec/fixtures/example_nesting.rb similarity index 100% rename from spec/example_nesting.rb rename to spec/fixtures/example_nesting.rb diff --git a/spec/testrc b/spec/fixtures/testrc similarity index 100% rename from spec/testrc rename to spec/fixtures/testrc diff --git a/spec/testrcbad b/spec/fixtures/testrcbad similarity index 100% rename from spec/testrcbad rename to spec/fixtures/testrcbad diff --git a/spec/helper.rb b/spec/helper.rb index 64ca8a92..1f1eb6f9 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -6,9 +6,8 @@ end require 'mocha/api' require 'pry/test/helper' - -require File.expand_path('../helpers/bacon', __FILE__) -require File.expand_path('../helpers/mock_pry', __FILE__) +require 'helpers/bacon' +require 'helpers/mock_pry' class Module public :remove_const diff --git a/spec/indent_spec.rb b/spec/indent_spec.rb index 28de8110..9eb9a2f6 100644 --- a/spec/indent_spec.rb +++ b/spec/indent_spec.rb @@ -276,7 +276,7 @@ OUTPUT end describe "nesting" do - test = File.read("spec/example_nesting.rb") + test = File.read("spec/fixtures/example_nesting.rb") test.lines.each_with_index do |line, i| result = line.split("#").last.strip diff --git a/spec/pry_spec.rb b/spec/pry_spec.rb index 47da48a8..d22b0f57 100644 --- a/spec/pry_spec.rb +++ b/spec/pry_spec.rb @@ -307,8 +307,8 @@ describe Pry do describe "test loading rc files" do before do - Pry::HOME_RC_FILE.replace File.expand_path("../testrc", __FILE__) - Pry::LOCAL_RC_FILE.replace File.expand_path("../testrc", __FILE__) + "/../testrc" + Pry::HOME_RC_FILE.replace "spec/fixtures/testrc" + Pry::LOCAL_RC_FILE.replace "spec/fixtures/testrc/../testrc" Pry.instance_variable_set(:@initial_session, true) end @@ -355,7 +355,7 @@ describe Pry do describe "that raise exceptions" do before do - Pry::HOME_RC_FILE = File.expand_path("../testrcbad", __FILE__) + Pry::HOME_RC_FILE = "spec/fixtures/testrcbad" Pry.config.should_load_rc = true Pry.config.should_load_local_rc = false @@ -390,7 +390,8 @@ describe Pry do end it "should output an error" do - @doing_it[].should =~ /Error loading #{File.expand_path("../testrcbad", __FILE__)}: messin with ya/ + @doing_it.call.should == + "Error loading spec/fixtures/testrcbad: messin with ya" end end end diff --git a/spec/wrapped_module_spec.rb b/spec/wrapped_module_spec.rb index 9814a50c..91445ef3 100644 --- a/spec/wrapped_module_spec.rb +++ b/spec/wrapped_module_spec.rb @@ -11,10 +11,8 @@ describe Pry::WrappedModule do describe "candidates" do before do class Host - source_files = [File.join(File.dirname(__FILE__), "candidate_helper1.rb"), - File.join(File.dirname(__FILE__), "candidate_helper2.rb")] - - source_files.each do |file| + %w(spec/fixtures/candidate_helper1.rb + spec/fixtures/candidate_helper2.rb).each do |file| binding.eval File.read(file), file, 1 end