Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #41 from ifesdjeen/master

Adding an error message when file was not found during dictionary lookup
  • Loading branch information...
commit e857812f7cea9cb5025666883e546105edddf9c0 2 parents 3a2b060 + 5cc982a
Brandon Arbini authored
Showing with 6 additions and 0 deletions.
  1. +1 −0  lib/forgery/file_reader.rb
  2. +5 −0 spec/file_reader_spec.rb
View
1  lib/forgery/file_reader.rb
@@ -31,6 +31,7 @@ def self.find_file(name, folder)
file = "#{path}/#{folder}/#{name}"
return file if File.exists?(file)
end
+ raise ArgumentError.new("File '#{name}' wasn't found in '#{folder}' folder. Searched paths: \n#{Forgery.load_paths.join('\n')}")
end
end
end
View
5 spec/file_reader_spec.rb
@@ -19,6 +19,11 @@
Forgery::FileReader.read_dictionary(:code_names).should include('Shiretoko')
end
+ it "should raise an exception if file wasn't found in load paths" do
+ lambda {
+ Forgery::FileReader.read_dictionary(:non_existing_dictionary)
+ }.should raise_error(ArgumentError)
+ end
after do
# reset load_paths
Forgery.load_paths.clear
Please sign in to comment.
Something went wrong with that request. Please try again.