KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having problems getting this simple test to pass on RSpec 2.8. I want to write a simple test for the absence of parameters on a method that requires them (i.e. ArgumentError: wrong number of arguments ('x' for 'y')). My test is testing a Gem module method like so: describe "#ip_lookup" do it "should raise an ArgumentError error if no parameters passed" do expect(@geolocater.ip_lookup).to raise_error(ArgumentError) end end My gem module code looks like this: module Geolocater def ip_lookup(ip_address) return ip_address end end My spec runs with this output. Failure/Error: expect(@geolocater.ip_lookup).to raise_error(ArgumentError) ArgumentError: wrong number of arguments (0 for 1) # ./lib/geolocater.rb:4:in `ip_lookup' # ./spec/geolocater_spec.rb:28:in `block (3 levels) in <top (required)>' What am I missing here?
Tags (comma-separated)
Save Edits
Cancel