pry-note 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -151,7 +151,7 @@ Pry::Commands.create_command "note" do
151
151
  if message
152
152
  new_content = message
153
153
  else
154
- old_content = notes[co_name][note_number.to_i - 1]
154
+ old_content = notes[co_name][note_number_s.to_i - 1]
155
155
  new_content = edit_note(co_name, old_content.to_s)
156
156
  end
157
157
 
@@ -1,3 +1,3 @@
1
1
  module PryNote
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
data/pry-note.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "pry-note"
5
- s.version = "0.2.7"
5
+ s.version = "0.2.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Mair (banisterfiend)"]
9
- s.date = "2012-12-06"
9
+ s.date = "2012-12-12"
10
10
  s.description = "Ease refactoring and exploration by attaching notes to methods and classes in Pry"
11
11
  s.email = "jrmair@gmail.com"
12
12
  s.files = ["README.md", "Rakefile", "lib/pry-note.rb", "lib/pry-note/commands.rb", "lib/pry-note/hooks.rb", "lib/pry-note/version.rb", "pry-note.gemspec", "test/helper.rb", "test/test_pry_note.rb"]
data/test/helper.rb CHANGED
@@ -14,6 +14,11 @@ ensure
14
14
  File.unlink(f) if File.exists?(f)
15
15
  end
16
16
 
17
+ Pad = OpenStruct.new
18
+ def Pad.clear
19
+ @table = {}
20
+ end
21
+
17
22
  # Return any raised exceptino objects inside the block
18
23
  def capture_exception
19
24
  ex = nil
@@ -183,13 +183,31 @@ describe PryNote do
183
183
  end
184
184
  end
185
185
 
186
- describe "-m switch (used to amend note inline and bypass editor)" do
187
- it 'should amend the content of a note' do
188
- @t.process_command "note add PryNote::TestClass -m 'my note1'"
189
- @t.process_command "note edit PryNote::TestClass:1 -m 'bing'"
190
- PryNote.notes["PryNote::TestClass"].count.should == 1
191
- PryNote.notes["PryNote::TestClass"].first.should =~ /bing/
192
- end
186
+ it 'should amend the content of a note with -m' do
187
+ @t.process_command "note add PryNote::TestClass -m 'my note1'"
188
+ @t.process_command "note edit PryNote::TestClass:1 -m 'bing'"
189
+ PryNote.notes["PryNote::TestClass"].count.should == 1
190
+ PryNote.notes["PryNote::TestClass"].first.should =~ /bing/
191
+ end
192
+
193
+ # this is a regression against a bug which made it impossible to ever
194
+ # edit a note in an editor
195
+ it 'should not raise an exception when amending content without -m' do
196
+ Pry.config.editor = proc { nil }
197
+ @t.process_command "note add PryNote::TestClass -m 'my note1'"
198
+
199
+ capture_exception do
200
+ @t.process_command "note edit PryNote::TestClass:1"
201
+ end.is_a?(Exception).should == false
202
+ end
203
+
204
+ it 'should leave note unchanged when no changes are made in editor' do
205
+ Pry.config.editor = proc { nil }
206
+ @t.process_command "note add PryNote::TestClass -m 'my note1'"
207
+ @t.process_command "note edit PryNote::TestClass:1"
208
+
209
+ PryNote.notes["PryNote::TestClass"].count.should == 1
210
+ PryNote.notes["PryNote::TestClass"].first.should =~ /my note1/
193
211
  end
194
212
  end
195
213
 
@@ -264,6 +282,15 @@ describe PryNote do
264
282
  end
265
283
  end
266
284
 
285
+ it 'should not export when there are no notes' do
286
+ cleanup_file("bing.yml") do
287
+ Pry.config.notes_file = "bing.yml"
288
+ @t.process_command "note export"
289
+ o = File.exists?(Pry.config.notes_file).should == false
290
+ Pry.config.notes_file = nil
291
+ end
292
+ end
293
+
267
294
  it 'should export to specified file' do
268
295
  cleanup_file("blah.yml") do
269
296
  @t.process_command "note add PryNote::TestClass -m 'my note1'"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-note
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake