diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/cli_spec.rb | 15 | ||||
-rw-r--r-- | spec/commands/wtf_spec.rb | 38 | ||||
-rw-r--r-- | spec/config_spec.rb | 1 | ||||
-rw-r--r-- | spec/integration/bundler_spec.rb | 3 | ||||
-rw-r--r-- | spec/syntax_checking_spec.rb | 2 |
5 files changed, 22 insertions, 37 deletions
diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index 93625f79..39d6c7a2 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -41,21 +41,6 @@ RSpec.describe Pry::CLI do end end - describe ".add_plugin_options" do - it "returns self" do - expect(described_class.add_plugin_options).to eq(described_class) - end - - it "loads cli options of plugins" do - plugin_mock = double - expect(plugin_mock).to receive(:load_cli_options) - plugins = { 'pry-testplugin' => plugin_mock } - expect(Pry).to receive(:plugins).and_return(plugins) - - described_class.add_plugin_options - end - end - describe ".add_option_processor" do it "returns self" do expect(described_class.add_option_processor {}).to eq(described_class) diff --git a/spec/commands/wtf_spec.rb b/spec/commands/wtf_spec.rb index 52ad0251..c4af0cc5 100644 --- a/spec/commands/wtf_spec.rb +++ b/spec/commands/wtf_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Pry::Command::Wtf do it "prints only a part of the exception backtrace" do subject.process expect(subject.output.string).to eq( - "\e[1mException:\e[0m RuntimeError: oops\n" \ + "\001\e[1m\002Exception:\001\e[0m\002 RuntimeError: oops\n" \ "--\n" \ "0: /bin/pry:23:in `<main>'\n" \ "1: /bin/pry:23:in `<main>'\n" \ @@ -55,7 +55,7 @@ RSpec.describe Pry::Command::Wtf do it "prints full exception backtrace" do subject.process expect(subject.output.string).to eq( - "\e[1mException:\e[0m RuntimeError: oops\n" \ + "\001\e[1m\002Exception:\001\e[0m\002 RuntimeError: oops\n" \ "--\n" \ "0: /bin/pry:23:in `<main>'\n" \ "1: /bin/pry:23:in `<main>'\n" \ @@ -73,7 +73,7 @@ RSpec.describe Pry::Command::Wtf do it "prints more of backtrace" do subject.process expect(subject.output.string).to eq( - "\e[1mException:\e[0m RuntimeError: oops\n" \ + "\001\e[1m\002Exception:\001\e[0m\002 RuntimeError: oops\n" \ "--\n" \ "0: /bin/pry:23:in `<main>'\n" \ "1: /bin/pry:23:in `<main>'\n" \ @@ -116,14 +116,14 @@ RSpec.describe Pry::Command::Wtf do it "prints parts of both original and nested exception backtrace" do subject.process expect(subject.output.string).to eq( - "\e[1mException:\e[0m RuntimeError: outer\n" \ + "\001\e[1m\002Exception:\001\e[0m\002 RuntimeError: outer\n" \ "--\n" \ "0: /bin/pry:23:in `<main>'\n" \ "1: /bin/pry:23:in `<main>'\n" \ "2: /bin/pry:23:in `<main>'\n" \ "3: /bin/pry:23:in `<main>'\n" \ "4: /bin/pry:23:in `<main>'\n" \ - "\e[1mCaused by:\e[0m RuntimeError: inner\n" \ + "\001\e[1m\002Caused by:\001\e[0m\002 RuntimeError: inner\n" \ "--\n" \ "0: /bin/pry:23:in `<main>'\n" \ "1: /bin/pry:23:in `<main>'\n" \ @@ -140,7 +140,7 @@ RSpec.describe Pry::Command::Wtf do it "prints both original and nested exception backtrace" do subject.process expect(subject.output.string).to eq( - "\e[1mException:\e[0m RuntimeError: outer\n" \ + "\001\e[1m\002Exception:\001\e[0m\002 RuntimeError: outer\n" \ "--\n" \ "0: /bin/pry:23:in `<main>'\n" \ "1: /bin/pry:23:in `<main>'\n" \ @@ -148,7 +148,7 @@ RSpec.describe Pry::Command::Wtf do "3: /bin/pry:23:in `<main>'\n" \ "4: /bin/pry:23:in `<main>'\n" \ "5: /bin/pry:23:in `<main>'\n" \ - "\e[1mCaused by:\e[0m RuntimeError: inner\n" \ + "\001\e[1m\002Caused by:\001\e[0m\002 RuntimeError: inner\n" \ "--\n" \ "0: /bin/pry:23:in `<main>'\n" \ "1: /bin/pry:23:in `<main>'\n" \ @@ -177,17 +177,17 @@ RSpec.describe Pry::Command::Wtf do it "prints lines of code that exception frame references" do subject.process expect(subject.output.string).to eq( - "\e[1mException:\e[0m RuntimeError: oops\n" \ + "\001\e[1m\002Exception:\001\e[0m\002 RuntimeError: oops\n" \ "--\n" \ - "0: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ + "0: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ " Array.new(6) { \"\#{__FILE__}:\#{__LINE__}:in `<main>'\" }\n" \ - "1: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ + "1: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ " Array.new(6) { \"\#{__FILE__}:\#{__LINE__}:in `<main>'\" }\n" \ - "2: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ + "2: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ " Array.new(6) { \"\#{__FILE__}:\#{__LINE__}:in `<main>'\" }\n" \ - "3: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ + "3: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ " Array.new(6) { \"\#{__FILE__}:\#{__LINE__}:in `<main>'\" }\n" \ - "4: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ + "4: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ " Array.new(6) { \"\#{__FILE__}:\#{__LINE__}:in `<main>'\" }\n" ) end @@ -200,13 +200,13 @@ RSpec.describe Pry::Command::Wtf do it "skips code and prints only the backtrace frame" do subject.process expect(subject.output.string).to eq( - "\e[1mException:\e[0m RuntimeError: oops\n" \ + "\001\e[1m\002Exception:\001\e[0m\002 RuntimeError: oops\n" \ "--\n" \ - "0: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ - "1: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ - "2: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ - "3: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" \ - "4: \e[1m#{__FILE__}:168:in `<main>'\e[0m\n" + "0: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ + "1: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ + "2: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ + "3: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" \ + "4: \001\e[1m\002#{__FILE__}:168:in `<main>'\001\e[0m\002\n" ) end end diff --git a/spec/config_spec.rb b/spec/config_spec.rb index f1cf5ea6..4018a1db 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -28,7 +28,6 @@ RSpec.describe Pry::Config do specify { expect(subject.output_prefix).to be_a(String) } specify { expect(subject.requires).to be_an(Array) } specify { expect(subject.should_load_requires).to be(true).or be(false) } - specify { expect(subject.should_load_plugins).to be(true).or be(false) } specify { expect(subject.windows_console_warning).to be(true).or be(false) } specify { expect(subject.control_d_handler).to respond_to(:call) } specify { expect(subject.memory_size).to be_a(Numeric) } diff --git a/spec/integration/bundler_spec.rb b/spec/integration/bundler_spec.rb index 2c4f2b27..224616c2 100644 --- a/spec/integration/bundler_spec.rb +++ b/spec/integration/bundler_spec.rb @@ -9,8 +9,9 @@ RSpec.describe 'Bundler' do context "when Pry requires Gemfile, which doesn't specify Pry as a dependency" do it "loads auto-completion correctly" do code = <<-RUBY - require "pry" + require "bundler" require "bundler/inline" + require "pry" # Silence the "The Gemfile specifies no dependencies" warning class Bundler::UI::Shell diff --git a/spec/syntax_checking_spec.rb b/spec/syntax_checking_spec.rb index ca75ba9f..beba497f 100644 --- a/spec/syntax_checking_spec.rb +++ b/spec/syntax_checking_spec.rb @@ -36,7 +36,7 @@ describe Pry do ["o = Object.new.tap{ def o.render;", "'MEH'", "}"], # multiple syntax errors reported in one SyntaxException - ["puts {'key'=>'val'}.to_json"] + ["puts {key: 'val'}.to_json"] ].compact.each do |foo| it "should raise an error on invalid syntax like #{foo.inspect}" do redirect_pry_io(InputTester.new(*foo), @str_output) do |