Rspec错误的参数个数(1表示0)

时间:2014-02-11 17:44:10

标签: ruby-on-rails ruby rspec

我正在关注pluralsight.com的Rspec教程。本教程提供了以下适用于截屏视频的代码:

module Wordpress
  module Comments
    class Client
      def intitialize(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")
  end
end     

但是当我运行它时,我收到以下错误:

Failure/Error: client = Wordpress::Comments::Client.new("http://mashable.com/comments/feed")
 ArgumentError:
   wrong number of arguments (1 for 0)

2 个答案:

答案 0 :(得分:0)

拼写错误:

module Wordpress
  module Comments
    class Client
      def initialize(url)
        ...         
      end
    end
  end
end

答案 1 :(得分:0)

看起来像拼写错误:initialize,而不是初始化