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

Add .rspec and require 'helper' from there

Just discovered this nice feature of RSpec where it can load all files for
us. Works with `bundle exec rake` and `bundle exec rspec spec/file_spec.rb`,
which covers all use cases.
This commit is contained in:
Kyrylo Silin 2018-11-18 14:04:44 +08:00
parent 1f60cc1ff5
commit e61354693f
65 changed files with 13 additions and 125 deletions

2
.rspec Normal file
View file

@ -0,0 +1,2 @@
--color
--require helper

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::Hooks do
before do
Pry::CLI.reset

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::CodeObject do
describe "basic lookups" do
before do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::Code do
describe '.from_file' do
specify 'read lines from a file on disk' do

View file

@ -1,4 +1,3 @@
require 'helper'
describe Pry::ColorPrinter do
include Pry::Helpers::Text
let(:io) { StringIO.new }

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::Helpers::CommandHelpers do
before do
@helper = Pry::Helpers::CommandHelpers

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe "commands" do
before do
@str_output = StringIO.new

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::CommandSet do
before do
@set = Pry::CommandSet.new do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe "Pry::Command" do
before do
@set = Pry::CommandSet.new

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "amend-line" do
before do
@t = pry_tester

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "!" do
before do
@t = pry_tester

View file

@ -1,5 +1,3 @@
require_relative '../../helper'
describe Pry::Command::Cat::FileFormatter do
before do
@p = Pry.new

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "cat" do
before do
@str_output = StringIO.new

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe 'cd' do
before do
@o, @obj = Object.new, Object.new

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "disable-pry" do
before do
@t = pry_tester

View file

@ -1,5 +1,4 @@
require 'pathname'
require_relative '../helper'
describe "edit" do
before do

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "exit-all" do
before { @pry = Pry.new }

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "exit-program" do
it 'should raise SystemExit' do
expect { pry_eval('exit-program') }.to raise_error SystemExit

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "exit" do
before { @pry = Pry.new(target: :outer, output: StringIO.new) }

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "find-method" do
MyKlass = Class.new do
def hello

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "gem-list" do
it 'should not raise when invoked' do
expect { pry_eval(self, 'gem-list') }.to_not raise_error

View file

@ -1,9 +1,6 @@
# These tests are out of date.
# They need to be updated for the new 'gist' API, but im too sleepy to
# do that now.
require_relative '../helper'
describe 'gist' do
it 'has a dependency on the jist gem' do
expect(Pry::Command::Gist.command_options[:requires_gem]).to eq("gist")

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "help" do
before do
@oldset = Pry.config.commands

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "hist" do
before do
Pry.history.clear

View file

@ -1,5 +1,3 @@
require 'helper'
RSpec.describe "jump-to" do
let(:obj) { Object.new }

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "ls" do
describe "bug #1407" do
it "behaves as usual when a method of the same name exists." do

View file

@ -1,9 +1,6 @@
# This command needs a TONNE more tests for it, but i can't figure out
# how to do them yet, and i really want to release. Sorry. Someone
# come along and do a better job.
require_relative '../helper'
describe "play" do
before do
@o = Object.new

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "raise-up" do
before do
@self = "Pad.self = self"

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "reload_code" do
describe "reload_current_file" do
it 'raises an error source code not found' do

View file

@ -1,4 +1,3 @@
require_relative '../helper'
describe "ri" do
it "prints an error message without an argument" do
expect(pry_eval("ri")).to include("Please provide a class, module, or method name (e.g: ri Array#push)")

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "save-file" do
before do
@tf = Tempfile.new(["pry", ".py"])

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe Pry::Command::ShellCommand do
describe 'cd' do
before do

View file

@ -1,4 +1,3 @@
require_relative '../helper'
require "fixtures/show_source_doc_examples"
describe "show-doc" do

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "show-input" do
before do
@t = pry_tester

View file

@ -1,4 +1,3 @@
require_relative '../helper'
require "fixtures/show_source_doc_examples"
describe "show-source" do

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "watch expression" do
# Custom eval that will:
# 1) Create an instance of pry that can use for multiple calls

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "whereami" do
it 'should work with methods that have been undefined' do
class Cor

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe "wtf?!" do
let(:tester) do
pry_tester do

View file

@ -1,4 +1,3 @@
require_relative 'helper'
require "readline" unless defined?(Readline)
require "pry/input_completer"

View file

@ -1,4 +1,3 @@
require 'helper'
RSpec.describe Pry::Config::Behavior do
let(:behavior) do
Class.new do

View file

@ -1,4 +1,3 @@
require 'helper'
RSpec.describe Pry::Config::Memoization do
let(:config) do
Class.new do

View file

@ -1,4 +1,3 @@
require_relative 'helper'
describe Pry::Config do
describe "bug #1552" do
specify "a local key has precendence over its default when the stored value is false" do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::DEFAULT_CONTROL_D_HANDLER do
describe "control-d press" do
before do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::Helpers::DocumentationHelpers do
before do
@helper = Pry::Helpers::DocumentationHelpers

View file

@ -1,5 +1,4 @@
require 'pathname'
require_relative 'helper'
describe Pry::Editor do
class Pry::Editor

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe 'Formatting Table' do
it 'knows about colorized fitting' do
t = Pry::Helpers::Table.new %w(hihi), column_count: 1

View file

@ -1,4 +1,3 @@
require_relative 'helper'
require 'tempfile'
describe Pry do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::Hooks do
before do
@hooks = Pry::Hooks.new

View file

@ -1,5 +1,3 @@
require_relative 'helper'
# Please keep in mind that any hash signs ("#") in the heredoc strings are
# placed on purpose. Without these editors might remove the whitespace on empty
# lines.

View file

@ -1,4 +1,3 @@
require "helper"
require "shellwords"
RSpec.describe "Hanami integration" do

View file

@ -1,7 +1,6 @@
# These specs ensure that Pry doesn't require readline until the first time a
# REPL is started.
require "helper"
require "shellwords"
RSpec.describe "Readline" do

View file

@ -1,5 +1,3 @@
require_relative '../helper'
describe Pry::Method::Patcher do
before do
@x = Object.new

View file

@ -1,4 +1,3 @@
require_relative 'helper'
require 'set'
describe Pry::Method do

View file

@ -1,4 +1,3 @@
require_relative "helper"
describe "Pry::Pager" do
describe "PageTracker" do
before do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::Prompt do
describe ".[]" do
it "accesses prompts" do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
_version = 1
describe "test Pry defaults" do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry do
describe "output failsafe" do
after do

View file

@ -1,4 +1,3 @@
require_relative 'helper'
describe Pry::REPL do
it "should let you run commands in the middle of multiline expressions" do
ReplTester.start do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry do
before do
@str_output = StringIO.new

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry do
describe 'loading rc files' do
before do

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe "Pry.run_command" do
before do
o = Object.new

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe "Sticky locals (_file_ and friends)" do
it 'locals should all exist upon initialization' do
expect { pry_eval '_file_', '_dir_', '_ex_', '_pry_', '_' }.to_not raise_error

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry do
before do
@str_output = StringIO.new

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe "Pry.config.unrescued_exceptions" do
before do
@str_output = StringIO.new

View file

@ -1,5 +1,3 @@
require_relative 'helper'
describe Pry::WrappedModule do
describe "#initialize" do
it "should raise an exception when a non-module is passed" do