Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:adamwiggins/rush
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Wiggins committed Mar 13, 2008
2 parents e4e8026 + e8c9424 commit 47f5ec3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/rush/find_by.rb
Expand Up @@ -12,6 +12,8 @@ def method_missing(meth, *args)
find_by(m[1], args.first)
elsif m = meth.to_s.match(/^find_all_by_([a-z_]+)$/)
find_all_by(m[1], args.first)
else
super
end
end

Expand Down
7 changes: 5 additions & 2 deletions spec/find_by_spec.rb
Expand Up @@ -7,8 +7,7 @@ class Foo

def initialize(bar)
@bar = bar
end
end
end end

@one = Foo.new('one')
@two = Foo.new('two')
Expand Down Expand Up @@ -52,4 +51,8 @@ def initialize(bar)
it "find_by_ with field not recognized by objects raises no errors" do
@list.find_by_nothing('x')
end

it "raises NoMethodError for things other than find_by" do
lambda { @list.does_not_exist }.should raise_error(NoMethodError)
end
end

0 comments on commit 47f5ec3

Please sign in to comment.