Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improved tests for note edit

  • Loading branch information...
commit c9d29fa6e5a311b0e41b9faa15337fdad0985fe6 1 parent d6caa31
@banister authored
Showing with 19 additions and 19 deletions.
  1. +0 −8 lib/pry-note/commands.rb
  2. +19 −11 test/test_pry_note.rb
View
8 lib/pry-note/commands.rb
@@ -32,14 +32,6 @@ def subcommands(cmd)
end
end
- def options(opt)
- opt.on :a, :add, "Add a note to a method or class.", :argument => true
- opt.on :s, :show, "Show any notes associated with the given method or class.", :argument => true
- opt.on :d, :delete, "Delete notes for a method or class.", :argument => true
- opt.on "delete-all", "Delete all notes."
- opt.on "list-all", "List all notes with content."
- end
-
def notes() PryNote.notes ||= {} end
def notes=(o) PryNote.notes = o; end
View
30 test/test_pry_note.rb
@@ -149,20 +149,28 @@ def capture_exception
end
describe "note edit" do
- it 'should error when not given a note number' do
- @t.process_command "note add PryNote::TestClass -m 'my note1'"
+ describe "errors" do
+ it 'should error when not given a note number' do
+ @t.process_command "note add PryNote::TestClass -m 'my note1'"
- capture_exception do
- @t.process_command "note edit PryNote::TestClass -m 'bing'"
- end.message.should =~ /Must specify a note number/
- end
+ capture_exception do
+ @t.process_command "note edit PryNote::TestClass -m 'bing'"
+ end.message.should =~ /Must specify a note number/
+ end
- it 'should error when given out of range note number' do
- @t.process_command "note add PryNote::TestClass -m 'my note1'"
+ it 'should error when given out of range note number' do
+ @t.process_command "note add PryNote::TestClass -m 'my note1'"
- capture_exception do
- @t.process_command "note edit PryNote::TestClass:2 -m 'bing'"
- end.message.should =~ /Invalid note number/
+ capture_exception do
+ @t.process_command "note edit PryNote::TestClass:2 -m 'bing'"
+ end.message.should =~ /Invalid note number/
+ end
+
+ it 'should error when editing object with no notes' do
+ capture_exception do
+ @t.process_command "note edit PryNote::TestClass:2 -m 'bing'"
+ end.message.should =~ /No notes to edit/
+ end
end
describe "-m switch" do
Please sign in to comment.
Something went wrong with that request. Please try again.