I had the same problem with the rspec 2.8.0. and the newer version fixed it. As it says, Rspec 2.8.0, expect(something) causes ArgumentError: wrong number of arguments (1 for 0)
Pluralsight RSpec the Right Way: Wrong Number of Arguments for expect(client.url).to eq
-
19-10-2022 - |
Question
I just started Pluralsights' RSpec the Right Way module. In trying to define @url = url
, I noticed that it doesn't colorize as in the tutorial video, and received the following failure upon trying to get it to pass. I'm a complete rspec newb, so I need help in dissecting what went wrong here.
Thanks
adams-mbp:CommentsDashboard aandrewjeski$ rspec spec/lib/wordpress/comments/client_spec.rb
F
COMMAND LINE
Failures:
1) Wordpress::Comments::Client stores a URL
Failure/Error: expect(client.url).to eq 'http://mashable.com/comments/feed' ArgumentError: wrong number of arguments (1 for 0) # ./spec/lib/wordpress/comments/client_spec.rb:19:in `block (2 levels) in <top (required)>'
Finished in 0.00035 seconds 1 example, 1 failure
Failed examples:
rspec ./spec/lib/wordpress/comments/client_spec.rb:17 #
Wordpress::Comments::Client
stores a URL
TEXT FILE
module Wordpress
module Comments
class Client
attr_reader :url
def initialize url
@url = url
end
end
end
end
describe Wordpress::Comments::Client do
it "stores a URL" do
client = Wordpress::Comments::Client.new 'http://mashable.com/comments/feed'
expect(client.url).to eq 'http://mashable.com/comments/feed'
end
end
No correct solution
OTHER TIPS
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow