Skip to content

Commit

Permalink
Merge pull request #37 from tubbo/fix-match-call-on-regexp
Browse files Browse the repository at this point in the history
Fix ArgumentError in BSON::Regexp::Ruby
  • Loading branch information
durran committed Jun 17, 2015
2 parents f3950ae + ad8c8e6 commit 1ee9626
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/bson/regexp.rb
Expand Up @@ -135,7 +135,7 @@ def respond_to?(method)

def method_missing(method, *arguments)
return super unless respond_to?(method)
compile.send(method)
compile.send(method, *arguments)
end
end

Expand Down
8 changes: 6 additions & 2 deletions spec/bson/regexp_spec.rb
Expand Up @@ -40,8 +40,12 @@
StringIO.new(bson)
end

let(:regex) do
described_class.from_bson(io)
end

let(:result) do
described_class.from_bson(io).compile
regex.compile
end

it_behaves_like "a bson element"
Expand All @@ -58,7 +62,7 @@
it_behaves_like "a serializable bson element"

it "runs the method on the Regexp object" do
expect(result.match('6')).not_to be_nil
expect(regex.match('6')).not_to be_nil
end
end

Expand Down

0 comments on commit 1ee9626

Please sign in to comment.