It's because :test was defined a private method and you're trying to access
it publicly
class Object
private
def test
...
end
end
There are different approaches to testing private methods.
http://blog.jayfields.com/2007/11/ruby-testing-private-methods.html
-or-
you can test the m
Hello is it possible to make something like following:
RSpec::Matchers.define :be_json do |expected|
match do |actual|
JSON.parse(actual) == expected
end
description do
if html? # to html formatter output this
"return JSON:\n#{JSON.pretty_generate(expected)}"
else # for o
I'm trying to stub the method "test" on an object, and I cannot do it with
rspec.
Example with a simpler case:
o = Object.new
o.stub!(:test).and_return "lol"
o.test.should == "lol"
Error:
Failure/Error: o.test.should == "lol"
NoMethodError: private method `test' called for #