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

29 commits

Author SHA1 Message Date
Kyrylo Silin
cd1a9bbe5e Fix offences of the Style/FrozenStringLiteralComment cop
Fixes #1824 (Enabling `# frozen_string_literal: true` in `~/.pryc` crashes most
operations)
2019-05-08 00:14:20 +03:00
Kyrylo Silin
18c45d26c5 rubocop: enable the Style/FrozenStringLiteralComment cop
This will greatly ease Pry support on Ruby 3.0 (when it's out).
2019-05-08 00:13:17 +03:00
Kyrylo Silin
475b01da9b Rename '_pry_' to 'pry_instance'
Although `_pry_` is a well-established name, it is confusing. `pry_instance` is
a clearer name (arguably the best name). This change was dictated by Rubocop but
I support it. Therefore, I decided to do it, but I realise it's a big change.

`Pry::Command` deprecates `_pry_` and emits a warning. This seems to be the only
place where `_pry_` is used publicly.

Another place where it may affect the user is the sticky locals area. I don't
think it will be a big issue there, though.
2019-03-23 00:54:39 +02:00
Kyrylo Silin
1ed301123d rubocop: fix offences of the Lint/Debugger cop 2019-03-03 17:48:57 +02:00
Kyrylo Silin
4956376f13 rubocop: fix offences of the Metrics/LineLength cop
I realise that some code might be less readable now, but now that we set a good
default limit, we protect the codebase from further mess. It's important to do
this to prevent adding more mess to already messy code that we have. :doctor:
2019-03-03 17:37:58 +02:00
Kyrylo Silin
a2ca82c772 rubocop: fix offences of the Layout/SpaceAfterComma cop 2019-02-26 01:05:56 +02:00
Kyrylo Silin
e61354693f 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.
2018-11-18 14:04:44 +08:00
Kyrylo Silin
d069ca381b rubocop: fix offences of the Layout/EmptyLinesAroundArguments cop 2018-11-04 16:42:25 +08:00
Kyrylo Silin
22f0d664e0 rubocop: fix offences of the Layout/EmptyLines cop 2018-11-04 15:55:52 +08:00
Kyrylo Silin
383f97e341 rubocop: fix offences of the Layout/EmptyLineBetweenDefs cop 2018-10-14 14:40:48 +08:00
Kyrylo Silin
96c6958cc6 specs: convert to shoulds to expects 2015-03-10 22:49:29 +02:00
Matijs van Zuijlen
3376e6a0db Fix more warnings 2015-01-23 14:03:50 +01:00
Josh Cheek
144d32e1d6 Switch test suite to RSpec
Removes Bacon and Mocha

Reasoning explained in this comment: https://github.com/pry/pry/issues/277#issuecomment-51708712

Mostly this went smoothly. There were a few errors that I fixed along
the way, e.g. tests that were failing but for various reasons still
passed. Should have documented them, but didn't think about it until
very near the end. But generaly, I remember 2 reasons this would happen:
`lambda { raise "omg" }.should.raise(RuntimeError, /not-omg/)` will pass
because the second argument is ignored by Bacon. And `1.should == 2`
will return false instead of raising an error when it is not in an it
block (e.g. if stuck in a describe block, that would just return false)

The only one that I felt unsure about was spec/helpers/table_spec.rb
`Pry::Helpers.tablify_or_one_line('head', %w(ing)).should == 'head: ing'`
This is wrong, but was not failing because it was in a describe block
instead of an it block.  In reality, it returns `"head: ing\n"`,
I updated the test to reflect this, though I don't know for sure
this is the right thing to do

This will fail on master until https://github.com/pry/pry/pull/1281 is merged.
This makes https://github.com/pry/pry/pull/1278 unnecessary.
2014-08-10 17:37:21 -06:00
Robert Gleeson
74135c1890 allow for tests to be run with ease.
'bacon spec/config_spec.rb' instead of 'bacon -I spec spec/config_spec.rb'
2014-03-14 05:31:24 +01:00
Uros Jurglic
0262e827ae Add print option to play command (resolves #864)
When print option in play is used, it prints the executed code.
2013-12-12 10:11:00 +01:00
Jonathan Jackson and Travis Anderson
d6176275b6 Add expression flag to play
This is in reference to issue #904.  In said issue it was mentioned that
this should be a `-L` flag because it was ostensibly an extension of the
`-l` flag.  Felt `-e` was more intention revealing.
2013-07-22 19:03:23 -04:00
Conrad Irwin
2c60f93b2d Merge branch 'wip.refactor'
Conflicts:
	lib/pry/completion.rb
	lib/pry/pry_instance.rb
	spec/commands/play_spec.rb
	spec/pry_defaults_spec.rb
2013-01-18 00:19:38 -08:00
John Mair
75d1380c07 play specs: rewrite -i spec to use redirect_pry_io
This is because pry_tester doesn't work when the eval_string is mutated by a command
2013-01-14 17:06:08 +01:00
John Mair
703f42b1ee play and amend-line: now use fix-indent to correct broken indentation 2013-01-12 22:29:33 +01:00
John Mair
8732bb1025 updated play_spec.rb to check for errors
Also added play spec for multi-ranged -i options but does not work
for some weird reason?!
2013-01-12 22:29:32 +01:00
John Mair
4a059fd3a6 Pry::Command::CodeCollector: replace module inclusion with delegation
And implement play and save-file using the new delegator. 'gist' still needs
to be re-implemented using CodeCollector.

************
TODO:
**************
Couldn't write a test for `play --lines 4..5` with implied target.eval("__FILE__") parameter,
need to come up with a decent test.
2013-01-09 01:42:09 +01:00
John Mair
439c5c6811 Reimplemented play, save-file with Pry::Command::CodeCollector
Pry::Command::CodeCollector is a mixin that extracts out shared
functionality from play, save-file and gist. Gist is yet to be
reimplemented.
2013-01-09 01:42:08 +01:00
Ryan Fitzgerald
1ea1927b43 Rename accept_line to eval 2012-12-27 22:06:50 -08:00
Ryan Fitzgerald
7313581093 Fix play_spec and command_integration_spec 2012-12-18 00:53:32 -08:00
John Mair
9a279461c1 PryTestHelpers methods are now module_functions, included into Bacon::Context by default 2012-12-07 23:08:49 +01:00
John Mair
31a9578228 cleaned up lib/pry/test/helper.rb
* removed most historicla junk from lib/pry/test/helper.rb
* relocated recalcitrant junk to the local spec/helper.rb (this isn't exposed to 3rd parties)
2012-12-07 21:41:05 +01:00
Kyrylo Silin
9b85398d29 Remove some repetitive bits from play_spec.rb
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-01 05:49:27 +02:00
Kyrylo Silin
de50544759 Add support for play 69 syntax
`play 69` is a shortcut for `play --file #{_file_} --lines 69`. It plays
lines from the current file. Example (I omitted some useless
information):

  pry(main)> show-source hello
    def hello
      binding.pry
      true
      puts "hi"
      69
    end
  pry(main)> hello
    1: def hello
 => 2:   binding.pry
    3:   true
    4:   puts "hi"
    5:   69
    6: end
  pry(main)> play 5
  => 69
  pry(main)> play 3..4
  hi
  => nil
  pry(main)>

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-01 05:22:16 +02:00
☈king
848b6bdbeb Rename for tabcompletion-friendliness. 2012-11-15 18:59:51 -06:00
Renamed from test/test_commands/test_play.rb (Browse further)