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

21 commits

Author SHA1 Message Date
Matijs van Zuijlen
96b61f14aa Fix some warnings 2015-01-23 14:03:36 +01:00
Christian Haase
aec888e7bc Update specs using inner_scope helper 2015-01-14 22:36:08 -08:00
Christian Haase
72b486f43b Update specs using yield matcher 2015-01-14 22:36:08 -08: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
Steven Harman
e48ed7c6bc Clean up ambiguous method warnings
When running with Ruby warnings, these usages of `#match` are ambiguous,
but can be made explicit with parens.
2014-06-24 16:07:30 -04:00
Conrad Irwin
dd5e2511f3 Use _pry_.pager instead of Pry::Pager
This is not a concern for backward compatibility as it was introduced
since the last release
2014-05-01 01:51:02 -07:00
Conrad Irwin
44463e7d85 Stop using compatibility aliases for Pry.config 2014-05-01 01:51:01 -07: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
Robert Gleeson
77a9c00067 rename Pry::CommandSet#commands as Pry::CommandSet#to_hash.
'Pry.commands.commands' gone in favor of 'Pry.commands.to_hash' or as
using a CommandSet as an enumerable (Pry.commands.each etc) instead.
2014-02-04 05:14:41 +01:00
Ryan Fitzgerald
3bbe0f0c32 Remove support for 1.8-compatible versions of Ruby 2014-01-19 17:43:07 -08:00
Kyrylo Silin
bebf91f558 Update relevant tests in "command_spec.rb"
Make them use the new Slop syntax.
2013-01-14 20:15:01 +02:00
Kyrylo Silin
c38eb20776 Remove old subcommands cruft
* use a plain old Slop instance instead of `Options`;
  * remove `ClassCommand::Options` and its tests;
  * add clearer subcommand example (for `Command#subcommand` method);
  * refactor `ClassCommand#slop`;
  * refactor `ClassCommand#complete`.

Slop v3.4.0 has introduced full-featured subcommands. There is no need
in Pry specific code anymore.
2013-01-14 20:15:01 +02:00
Kyrylo Silin
ad5bb4c399 Assign default value to :listing option
When you create a class command, there is a problem with `:listing`
option, which doesn't carry the correct default value. Consider the
example:

  class MakeMeHappy < Pry::ClassCommand
    match 'woot'
  end

`MakeMeHappy` command matches against 'woot' String, but its `:listing`
option is set to the "nil" String, which is incorrect. We can fix it by
setting `:listing` explicitly:

  command_options :listing => 'woot'

It's a repetitive task, so we can automate it. Holy smoke, this why we
all use computers, after all!

With help of this commit there is no need to set `:listing` manually.
Pry will handle it for you.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2013-01-04 04:56:54 +02:00
John Mair
0aae15c4d9 Define Pry::ClassCommand.inherited hook
This is so commands that subclass other commands inherit the options, match and description.
2013-01-01 21:24:30 +01:00
Kyrylo Silin
c2050dbb49 Make subclassed commands always carry all options
By options I mean the command options like `:listing`, `:shellwords`,
etc.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-27 13:29:28 +02: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
8a39813708 Fix subcommands
A few things were missing. I had to add a new method and slightly adjust
ClassCommand#slop method. Without these changes subcommands doesn't work
properly.

Add some unit tests for subcommands.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-26 18:07:32 +02:00
Kyrylo Silin
30ec15ab1c Rename "sub_command" to "subcommand"
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-23 13:56:58 +02:00
Kyrylo Silin
cf786881bb Extend ClassCommand so it can define sub commands
Create `ClassCommand::Options` class, which ties up sub commands and
default options together.

Let's consider the command `food make --tea`. `food` is a command,
`make` is a sub command and `--tea` is an option of `make` sub command.
We can access `--tea` via `opts[:make][:tea].

Also, we can check the freshness of our food like so: `food --freshness`.
`--freshness` is a default option. We can access it like so:
`opts.freshness?` or `opts[:freshness]`.

Add unit tests for `ClassCommand::Option` and some other tests that
reflect the additions.

Finally, document everything and fix different typos in the existing
documentation.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-23 13:41:44 +02:00
☈king
848b6bdbeb Rename for tabcompletion-friendliness. 2012-11-15 18:59:51 -06:00
Renamed from test/test_command.rb (Browse further)