1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

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