Permalink
Browse files

[^] Bug #60 has been fixed

  • Loading branch information...
1 parent 0561ffd commit bb863961b9e352e5bb520151906e273fbceda344 @romanvbabenko romanvbabenko committed Nov 3, 2011
Showing with 14 additions and 2 deletions.
  1. +2 −2 lib/rails-footnotes/notes/controller_note.rb
  2. +12 −0 spec/notes/controller_note_spec.rb
View
4 lib/rails-footnotes/notes/controller_note.rb
@@ -14,7 +14,7 @@ def link
end
def valid?
- prefix? && File.exists?(self.controller_filename)
+ prefix? && controller_filename && File.exists?(controller_filename)
end
protected
@@ -23,7 +23,7 @@ def controller_path
end
def controller_filename
- @controller_filename ||= Gem.find_files(self.controller_path).first # tnx https://github.com/MasterLambaster
+ @controller_filename ||= Gem.find_files(controller_path).first # tnx https://github.com/MasterLambaster
end
def controller_text
View
12 spec/notes/controller_note_spec.rb
@@ -0,0 +1,12 @@
+require "spec_helper"
+require "rails-footnotes/notes/controller_note"
+
+describe Footnotes::Notes::ControllerNote do
+ # Issue #60
+ it "should not be valid if conftroller file not exist" do
+ note = Footnotes::Notes::ControllerNote.new(mock)
+ note.stub(:controller_filename).and_return(nil)
+
+ note.should_not be_valid
+ end
+end

0 comments on commit bb86396

Please sign in to comment.