Move Readline-loading specs inside normal suite

This simplifies our Rake and Travis config.
This commit is contained in:
Ryan Fitzgerald 2014-03-13 22:22:21 -07:00
parent f386eff43a
commit a0a462573e
4 changed files with 29 additions and 19 deletions

View File

@ -10,7 +10,6 @@ rvm:
script:
- rake spec
- bundle exec bacon spec/isolation/readline_spec.rb
matrix:
allow_failures:

View File

@ -33,7 +33,7 @@ task :test do
if explicit_list = ENV['run']
explicit_list.split(',')
else
(Dir['spec/**/*_spec.rb'] - Dir["spec/isolation/*_spec.rb"]).shuffle!
Dir['spec/**/*_spec.rb'].shuffle!
end
run_specs paths
end

View File

@ -1,17 +0,0 @@
require "bundler/setup"
require "bacon"
describe "Readline" do
describe "on require of 'pry'" do
it "is not made available" do
require('pry').should.be.true
defined?(Readline).should.be.nil
end
end
describe "on invoke of 'pry'" do
it "is made available" do
Pry.start self, input: StringIO.new("exit-all\n"), output: StringIO.new
defined?(Readline).should == "constant"
end
end
end

View File

@ -0,0 +1,28 @@
# These specs ensure that Pry doesn't require readline until the first time a
# REPL is started.
require "helper"
require "shellwords"
describe "Readline" do
before do
@ruby = RbConfig.ruby.shellescape
@pry_dir = File.expand_path(File.join(__FILE__, '../../../lib')).shellescape
end
it "is not loaded on requiring 'pry'" do
`#@ruby -I #@pry_dir -e '
require "pry"
p defined? Readline
'`.should == "nil\n"
end
it "is loaded on invoking 'pry'" do
`#@ruby -I #@pry_dir -e '
require "pry"
Pry.start self, input: StringIO.new("exit-all\n"), output: StringIO.new
puts # put newline after ANSI junk printed by readline
p defined?(Readline)
'`.split("\n").last.should == '"constant"'
end
end