Displaying 6 results from an estimated 6 matches for "a_method".
Did you mean:
_method
2007 Aug 14
4
(no subject)
How would you spec out something like the following:
def a_method
x = Class.new do
include Enumerable
end
# do something here with x
end
describe "The Anonymous Class" do
before :each do
@anonymous_class = mock Class
Class.stub!(:new).and_return @anonymous_class
end
it "should create a new anonymous class"...
2009 Apr 08
4
Having trouble extending a class from a Rails plugin
...'t figure it out. I''ve laid out an example
below that illustrates my problem. Any help would be much appreciated.
Thanks,
Jason
# vendor/plugins/my_plugin/init.rb
require ''my_plugin''
# vendor/plugins/my_plugin/lib/my_plugin.rb
module Jason
class MyClass
def a_method
# ...
end
end
end
# app/models/my_class.rb
module Jason
class MyClass
def another_method
# ...
end
end
end
$ script/console
>> Jason::MyClass.new.another_method
NoMethodError: undefined method `another_method'' for
#<Jason::MyClass:0x408b444>
--...
2007 Apr 20
1
speccing a call to break
How can I spec that a method calls break? As far as I can see from
ri, break is a pure syntax element (not a method from Kernel or
Object), so I''m not sure what to mock...
E.g.:
class SomeClass
def a_method
loop do
break
end
end
end
Scott
P.S. Sorry for the annoying questions, but I just want to know!
P.P.S: What is the right form of the verb "to spec" in the
Progressive? Is it "specing" or "speccing"?
2007 Jun 24
6
mocking errors
What is the correct way to mock out the errors on a Rails model?
I''m assuming i need to say
@mock_thing = mock_model(Thing)
@mock_thing_errors = mock("errors")
@mock_thing_errors.should_receive(:full_messages).and_return("An error")
@mock_thing.should_receive(:errors).and_return(@mock_thing_errors)
Just wanted to check the best practice on this kind of thing and how
2007 Mar 12
10
using mocha with rspec
Hi folks.
I''ve just started using rspec and I have to say it''s very nice. The
thing is, I prefer mocha''s mocking dialect. So I thought a simple
require ''mocha'' would set me up.
Unfortunately, rspec does all its goodness using do/end blocks in
anonymous classes, so it wasn''t quite that obvious.
Anyway, here is the incantation I ended up
2006 Jan 24
14
A bad day with Action Mailer
Hi, I''ve setup Action Mailer today to email the contents of a form.
Every seemes fine except when the email is sending.
Here is the error I get on the production server:
SocketError (getaddrinfo: Name or service not known):
/usr/lib/ruby/1.8/net/protocol.rb:83:in `initialize''
/usr/lib/ruby/1.8/net/protocol.rb:83:in `new''