Skip to content

Commit

Permalink
Move require outside of class method
Browse files Browse the repository at this point in the history
Otherwise if m is installed via gem install and run in a repo that doesn't have 
it inside of its Gemfile, the following error is thrown: 

cannot load such file -- method_source (LoadError)

All props on solving this in light of my derping around go to @schneems.
  • Loading branch information
olivierlacan committed Nov 6, 2015
1 parent f419869 commit 3f49381
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/m/test_method.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "method_source"

module M
### Simple data structure for what a test method contains.
#
Expand All @@ -22,7 +24,7 @@ def self.create(suite_class, test_method)
#
# The end line should be the number of line breaks in the method source,
# added to the starting line and subtracted by one.
require "method_source"

end_line = method.source.split("\n").size + start_line - 1

# Shove the given attributes into a new databag
Expand Down

0 comments on commit 3f49381

Please sign in to comment.