diff --git a/Guardfile b/Guardfile index 7ed19699..5be146b6 100644 --- a/Guardfile +++ b/Guardfile @@ -3,14 +3,16 @@ require 'guard/guard' module ::Guard class Bacon < Guard def run_all - system "bundle exec bacon -Itest -q -a" + system "rake spec" puts true end def run_spec(path) if File.exists?(path) - @success &&= system "bundle exec bacon -Itest -q #{path}" + cmd = "bundle exec bacon -Ispec -q #{path}" + puts cmd + @success &&= system cmd puts end end @@ -33,32 +35,32 @@ module ::Guard end guard 'bacon' do - def deduce_test_from(token) - "test/test_#{token}.rb" + def deduce_spec_from(token) + "spec/#{token}_spec.rb" end Dir['lib/pry/*.rb'].each do |rb| rb[%r(lib/pry/(.+)\.rb$)] - test_rb = deduce_test_from $1 - if File.exists?(test_rb) - watch(rb) { test_rb } + spec_rb = deduce_spec_from $1 + if File.exists?(spec_rb) + watch(rb) { spec_rb } else exempt = %w( commands version - ).map {|token| deduce_test_from token} - puts 'Missing ' + test_rb if - ENV['WANT_TEST_COMPLAINTS'] and not exempt.include?(test_rb) + ).map {|token| deduce_spec_from token} + puts 'Missing ' + spec_rb if + ENV['WANT_SPEC_COMPLAINTS'] and not exempt.include?(spec_rb) end end - watch(%r{^lib/pry/commands/([^.]+)\.rb}) { |m| "test/test_commands/test_#{m[1]}.rb" } + watch(%r{^lib/pry/commands/([^.]+)\.rb}) { |m| "spec/commands/#{m[1]}_spec.rb" } # If no such mapping exists, just run all of them watch(%r{^lib/}) { :all } - # If we modified one test file, run it - watch(%r{^test.*/test_.+\.rb$}) + # If we modified one spec file, run it + watch(%r{^spec/.+\.rb$}) end # vim:ft=ruby diff --git a/Rakefile b/Rakefile index 778196a6..49e71a6f 100644 --- a/Rakefile +++ b/Rakefile @@ -18,7 +18,7 @@ def apply_spec_defaults(s) s.homepage = 'http://pry.github.com' s.executables = ['pry'] s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- test/*`.split("\n") + s.test_files = `git ls-files -- spec/*`.split("\n") s.add_dependency('coderay', '~> 1.0.5') s.add_dependency('slop', ['~> 3.3.1']) s.add_dependency('method_source','~> 0.8') @@ -47,8 +47,11 @@ task :default => [:test] desc "Run tests" task :test do check_dependencies unless ENV['SKIP_DEP_CHECK'] - sh "bacon -Itest -rubygems -a -q" + all_specs = Dir['spec/**/*_spec.rb'] + all_specs.shuffle! if all_specs.respond_to? :shuffle! + sh "bacon -Ispec -rubygems -a -q #{all_specs.join ' '}" end +task :spec => :test desc "Run pry" task :pry do diff --git a/test/candidate_helper1.rb b/spec/candidate_helper1.rb similarity index 100% rename from test/candidate_helper1.rb rename to spec/candidate_helper1.rb diff --git a/test/candidate_helper2.rb b/spec/candidate_helper2.rb similarity index 100% rename from test/candidate_helper2.rb rename to spec/candidate_helper2.rb diff --git a/test/test_cli.rb b/spec/cli_spec.rb similarity index 100% rename from test/test_cli.rb rename to spec/cli_spec.rb diff --git a/test/test_code.rb b/spec/code_spec.rb similarity index 97% rename from test/test_code.rb rename to spec/code_spec.rb index 31c928e2..520df34d 100644 --- a/test/test_code.rb +++ b/spec/code_spec.rb @@ -36,13 +36,13 @@ describe Pry::Code do end should 'check for files relative to origin pwd' do - Dir.chdir('test') do |f| - Pry::Code.from_file('test/' + File.basename(__FILE__)).code_type.should == :ruby + Dir.chdir('spec') do |f| + Pry::Code.from_file('spec/' + File.basename(__FILE__)).code_type.should == :ruby end end should 'find files that are relative to the current working directory' do - Dir.chdir('test') do |f| + Dir.chdir('spec') do |f| Pry::Code.from_file(File.basename(__FILE__)).code_type.should == :ruby end end diff --git a/test/test_command_helpers.rb b/spec/command_helpers_spec.rb similarity index 100% rename from test/test_command_helpers.rb rename to spec/command_helpers_spec.rb diff --git a/test/test_command_integration.rb b/spec/command_integration_spec.rb similarity index 100% rename from test/test_command_integration.rb rename to spec/command_integration_spec.rb diff --git a/test/test_command_set.rb b/spec/command_set_spec.rb similarity index 100% rename from test/test_command_set.rb rename to spec/command_set_spec.rb diff --git a/test/test_command.rb b/spec/command_spec.rb similarity index 100% rename from test/test_command.rb rename to spec/command_spec.rb diff --git a/test/test_commands/test_amend_line.rb b/spec/commands/amend_line_spec.rb similarity index 100% rename from test/test_commands/test_amend_line.rb rename to spec/commands/amend_line_spec.rb diff --git a/test/test_commands/test_bang.rb b/spec/commands/bang_spec.rb similarity index 100% rename from test/test_commands/test_bang.rb rename to spec/commands/bang_spec.rb diff --git a/test/test_commands/test_cat.rb b/spec/commands/cat_spec.rb similarity index 100% rename from test/test_commands/test_cat.rb rename to spec/commands/cat_spec.rb diff --git a/test/test_commands/test_cd.rb b/spec/commands/cd_spec.rb similarity index 100% rename from test/test_commands/test_cd.rb rename to spec/commands/cd_spec.rb diff --git a/test/test_commands/test_disable_pry.rb b/spec/commands/disable_pry_spec.rb similarity index 100% rename from test/test_commands/test_disable_pry.rb rename to spec/commands/disable_pry_spec.rb diff --git a/test/test_commands/test_edit_method.rb b/spec/commands/edit_method_spec.rb similarity index 100% rename from test/test_commands/test_edit_method.rb rename to spec/commands/edit_method_spec.rb diff --git a/test/test_commands/test_edit.rb b/spec/commands/edit_spec.rb similarity index 100% rename from test/test_commands/test_edit.rb rename to spec/commands/edit_spec.rb diff --git a/test/test_commands/example.erb b/spec/commands/example.erb similarity index 100% rename from test/test_commands/example.erb rename to spec/commands/example.erb diff --git a/test/test_commands/test_exit_all.rb b/spec/commands/exit_all_spec.rb similarity index 100% rename from test/test_commands/test_exit_all.rb rename to spec/commands/exit_all_spec.rb diff --git a/test/test_commands/test_exit_program.rb b/spec/commands/exit_program_spec.rb similarity index 100% rename from test/test_commands/test_exit_program.rb rename to spec/commands/exit_program_spec.rb diff --git a/test/test_commands/test_exit.rb b/spec/commands/exit_spec.rb similarity index 100% rename from test/test_commands/test_exit.rb rename to spec/commands/exit_spec.rb diff --git a/test/test_commands/test_find_method.rb b/spec/commands/find_method_spec.rb similarity index 100% rename from test/test_commands/test_find_method.rb rename to spec/commands/find_method_spec.rb diff --git a/test/test_commands/test_gem_list.rb b/spec/commands/gem_list_spec.rb similarity index 100% rename from test/test_commands/test_gem_list.rb rename to spec/commands/gem_list_spec.rb diff --git a/test/test_commands/test_help.rb b/spec/commands/help_spec.rb similarity index 100% rename from test/test_commands/test_help.rb rename to spec/commands/help_spec.rb diff --git a/test/test_commands/test_hist.rb b/spec/commands/hist_spec.rb similarity index 100% rename from test/test_commands/test_hist.rb rename to spec/commands/hist_spec.rb diff --git a/test/test_commands/test_jump_to.rb b/spec/commands/jump_to_spec.rb similarity index 100% rename from test/test_commands/test_jump_to.rb rename to spec/commands/jump_to_spec.rb diff --git a/test/test_commands/test_ls.rb b/spec/commands/ls_spec.rb similarity index 100% rename from test/test_commands/test_ls.rb rename to spec/commands/ls_spec.rb diff --git a/test/test_commands/test_play.rb b/spec/commands/play_spec.rb similarity index 100% rename from test/test_commands/test_play.rb rename to spec/commands/play_spec.rb diff --git a/test/test_commands/test_raise_up.rb b/spec/commands/raise_up_spec.rb similarity index 100% rename from test/test_commands/test_raise_up.rb rename to spec/commands/raise_up_spec.rb diff --git a/test/test_commands/test_save_file.rb b/spec/commands/save_file_spec.rb similarity index 100% rename from test/test_commands/test_save_file.rb rename to spec/commands/save_file_spec.rb diff --git a/test/test_commands/test_show_doc.rb b/spec/commands/show_doc_spec.rb similarity index 100% rename from test/test_commands/test_show_doc.rb rename to spec/commands/show_doc_spec.rb diff --git a/test/test_commands/test_show_input.rb b/spec/commands/show_input_spec.rb similarity index 100% rename from test/test_commands/test_show_input.rb rename to spec/commands/show_input_spec.rb diff --git a/test/test_commands/test_show_source.rb b/spec/commands/show_source_spec.rb similarity index 100% rename from test/test_commands/test_show_source.rb rename to spec/commands/show_source_spec.rb diff --git a/test/test_commands/test_whereami.rb b/spec/commands/whereami_spec.rb similarity index 96% rename from test/test_commands/test_whereami.rb rename to spec/commands/whereami_spec.rb index 03557d02..378e72ec 100644 --- a/test/test_commands/test_whereami.rb +++ b/spec/commands/whereami_spec.rb @@ -56,7 +56,7 @@ describe "whereami" do it 'should show description and correct code when __LINE__ and __FILE__ are outside @method.source_location' do class Cor def blimey! - eval <<-END, binding, "test/test_commands/example.erb", 1 + eval <<-END, binding, "spec/cmd/example.erb", 1 pry_eval(binding, 'whereami') END end @@ -70,7 +70,7 @@ describe "whereami" do it 'should show description and correct code when @method.source_location would raise an error' do class Cor - eval <<-END, binding, "test/test_commands/example.erb", 1 + eval <<-END, binding, "spec/cmd/example.erb", 1 def blimey! pry_eval(binding, 'whereami') end diff --git a/test/test_completion.rb b/spec/completion_spec.rb similarity index 100% rename from test/test_completion.rb rename to spec/completion_spec.rb diff --git a/test/test_control_d_handler.rb b/spec/control_d_handler_spec.rb similarity index 100% rename from test/test_control_d_handler.rb rename to spec/control_d_handler_spec.rb diff --git a/test/example_nesting.rb b/spec/example_nesting.rb similarity index 100% rename from test/example_nesting.rb rename to spec/example_nesting.rb diff --git a/test/test_exception_whitelist.rb b/spec/exception_whitelist_spec.rb similarity index 100% rename from test/test_exception_whitelist.rb rename to spec/exception_whitelist_spec.rb diff --git a/test/helper.rb b/spec/helper.rb similarity index 100% rename from test/helper.rb rename to spec/helper.rb diff --git a/test/test_history_array.rb b/spec/history_array_spec.rb similarity index 100% rename from test/test_history_array.rb rename to spec/history_array_spec.rb diff --git a/test/test_hooks.rb b/spec/hooks_spec.rb similarity index 100% rename from test/test_hooks.rb rename to spec/hooks_spec.rb diff --git a/test/test_indent.rb b/spec/indent_spec.rb similarity index 99% rename from test/test_indent.rb rename to spec/indent_spec.rb index bcc2ed53..28de8110 100644 --- a/test/test_indent.rb +++ b/spec/indent_spec.rb @@ -276,7 +276,7 @@ OUTPUT end describe "nesting" do - test = File.read("test/example_nesting.rb") + test = File.read("spec/example_nesting.rb") test.lines.each_with_index do |line, i| result = line.split("#").last.strip diff --git a/test/test_input_stack.rb b/spec/input_stack_spec.rb similarity index 100% rename from test/test_input_stack.rb rename to spec/input_stack_spec.rb diff --git a/test/test_method.rb b/spec/method_spec.rb similarity index 100% rename from test/test_method.rb rename to spec/method_spec.rb diff --git a/test/test_prompt.rb b/spec/prompt_spec.rb similarity index 100% rename from test/test_prompt.rb rename to spec/prompt_spec.rb diff --git a/test/test_pry_defaults.rb b/spec/pry_defaults_spec.rb similarity index 100% rename from test/test_pry_defaults.rb rename to spec/pry_defaults_spec.rb diff --git a/test/test_pry_history.rb b/spec/pry_history_spec.rb similarity index 100% rename from test/test_pry_history.rb rename to spec/pry_history_spec.rb diff --git a/test/test_pry_output.rb b/spec/pry_output_spec.rb similarity index 100% rename from test/test_pry_output.rb rename to spec/pry_output_spec.rb diff --git a/test/test_pry.rb b/spec/pry_spec.rb similarity index 100% rename from test/test_pry.rb rename to spec/pry_spec.rb diff --git a/test/test_sticky_locals.rb b/spec/sticky_locals_spec.rb similarity index 100% rename from test/test_sticky_locals.rb rename to spec/sticky_locals_spec.rb diff --git a/test/test_syntax_checking.rb b/spec/syntax_checking_spec.rb similarity index 100% rename from test/test_syntax_checking.rb rename to spec/syntax_checking_spec.rb diff --git a/test/testrc b/spec/testrc similarity index 100% rename from test/testrc rename to spec/testrc diff --git a/test/testrcbad b/spec/testrcbad similarity index 100% rename from test/testrcbad rename to spec/testrcbad diff --git a/test/test_wrapped_module.rb b/spec/wrapped_module_spec.rb similarity index 100% rename from test/test_wrapped_module.rb rename to spec/wrapped_module_spec.rb