Displaying 20 results from an estimated 3000 matches similar to: "stubbing network calls"
2007 Feb 18
3
[0.8.0-RC1] problem with drbspec
I''m getting the following error with version 0.8.0 (I updated the gem and the
rails plugin, and re-ran generate/rspec):
c:\wd\clarks>drbspec spec/models/user_spec.rb
c:/ruby/bin/drbspec:16:in `load'': no such file to load -- drbspec
(LoadError)
from c:/ruby/bin/drbspec:16
the same command works fine under 0.7.5.1. Windows XP, rails 1.2.2 and
rubygems 0.9.1
--
View
2007 Feb 17
1
"warning: object#id will be deprecated" with mocks
hi all
I have the following code in a spec:
@user = mock("user")
User.stub!(:authenticate).and_return(@user)
@user.should_receive(:id).once.and_return(99)
post :login, {:username => ''username'', :password => ''password''}
session[:user_id].should == 99
it works as expected but I get the following warning when I run the spec:
warning:
2007 Jan 19
3
problems updating to 0.7.5.1
Hi all
I''ve upgraded the rails plugin from 0.7.5 to 0.7.5.1 (plugin/remove
rspec_on_rails followed by :
ruby script/plugin install
svn://rubyforge.org/var/svn/rspec/tags/REL_0_7_5_1/rspec_on_rails/vendor/plugins/rspec_on_rails
I''ve also updated the rspec gem and removed the older version. I''m running
rubygems 0.9.1 on a windows box
however, when I try to run a spec
2007 Feb 28
4
acts_as_authenticated error with Object#id
I''m getting this when I run my Rails controller specs.
<projectroot>/config/../lib/authenticated_system.rb:16: warning: Object#id
will be deprecated; use Object#object_id
I added "include AuthenticatedTestHelper" to /spec/spec_helper.rb so
that my controller tests^H^H^H^H^Hspecs can use the "login_as" helper
method. Anyone know how to fix this?
--
Cheers,
2009 May 04
6
cucumber - when to stub/mock
I''m just curious about this, since my solution involved stubbing a
call to GeoIp.
Is there a good rule of thumb for when you make exceptions to the ''no
stubbing'' philosophy of Cucumber?
My step was: "Given I am accessing the site from Japan," but I can
think of other situations - mostly when interacting with web services,
that I''d probably
2008 Jan 30
2
Stubbing controller methods vs model methods
I had an error that I couldn''t figure out, then when writing up a
question for the forum I figured it out. The thing is I don''t
understand why the change that was made works and why what existed
before didn''t.
Here is the initial post when I had the error:
----------------------------------
In the controllers/application.rb file
I have a method that finds the account
2011 Feb 16
3
stubbing gets undone?
I''m looking at an example where a stub seems to work sometimes, and
sometimes appears to become "unstubbed". I haven''t boiled it down to a
minimal example, but it goes something like this:
---- the model:
class Premise << ActiveRecord::Base
def lookup_stuff_on_the_web
$stderr.puts("entering lookup_stuff_on_the_web with #{self}")
...
end
end
2007 Dec 17
14
Change in isolation behaviour 1.08 - 1.10 ?
Hi,
I just moved from 1.08 to 1.10 and now have one example failing, which,
under 1.08, passed. Is the due to a change in behaviour?
Here''s my spec (removed some passing examples)
require File.dirname(__FILE__) + ''/../spec_helper''
describe "A user" do
before(:each) do
@user = User.new
@valid_user = User.new(
:email =>
2008 May 03
11
Date comparisons
I occasionally get this error:
1)
''A puzzle once featured, should no longer be nominated'' FAILED
expected: Sun May 04 09:10:26 -0700 2008,
got: Sun May 04 09:10:26 -0700 2008 (using ==)
./spec/models/puzzle_spec.rb:180:
So, the dates looks the same to me. Any ideas for how to debug?
Joe
2006 Oct 04
3
do we need stubbing?
Hey all -
The trunk currently supports three types of mocking/stubbing:
Mock Objects (created dynamically at runtime)
Partial Mocking of methods on existing classes
Stubbing of methods on existing objects or classes
The main difference between Partial Mocking and Stubbing is that Stubs
don''t verify.
I''m wondering if we really need the stubbing facility at all, given
that we
2007 Apr 25
9
Running specs for a plugin - undefined method ''define'' for object
I''m trying to write specs for a plugin I''m developing named audit_fu, and
I''m running into a problem which I can''t get past it. I''ve got the same
specs setup in the main rails app, and everything works fine there, it''s
just running the plugin specs that I''m having a problem with. My setup is:
- edge rails
- edge rspec (in
2007 May 02
13
RSpec 0.8.2 pain, missing spec/rails?
Hi. I''m upgrading a project from an 0.8.0 pre-release gem to 0.8.2.
I''ve installed the 0.8.2 gem, and the rspec_on_rails 0.8.2 plugin:
ruby script/plugin install
svn://rubyforge.org/var/svn/rspec/tags/REL_0_8_2/rspec
When I try to run my specs though, I get the below error. It''s as if the
spec_helper cannot find "spec/rails". I''ve noticed that
2007 Sep 13
2
Failing to raise an exception in a stub
I''ve come across rather strange behaviour when trying to raise an
exception in a stubbed method.
I''m speccing the behaviour of a Rails create action, where I''m using
save! to catch failed saves. In the case of working save, I''m using
the following stub:
@client.stub!(:save!).and_return(true)
which works fine.
However, in the negative case,
2007 Aug 04
5
reusable specs - almost there
I have a lot of controllers with virtually identical functionality for most
actions. I''ve been using shared behaviours to DRY things up a bit, but I
still have to create separate behaviours for each context before I can use
the shared behaviours
what I have now is a generic file which contains all the behaviours and
examples common to all the controllers, and that file gets loaded from
2007 May 23
8
Rails Rendering diagnostics.rhtml in Controller Spec
Forgive me if this isn''t the proper list. It''s specific to the rSpec
Rails plugin.
The problem is, some controller actions are rendering the
"diagnostics.rhtml" template when I''m expecting it to render something
else in a controller spec. I''m assuming this is the template that
displays the error message and a stack trace when an error is raised
in the
2008 Jan 19
6
Quiet Backtrace in RSpec
I''m using RSpec on Rails and would like to clean up the backtraces, so I
went looking for an RSpec equivalent to ThoughtBot''s Quiet Backtrace
gem<http://thoughtbot.com/projects/quietbacktrace>.
I found Spec::Runner::QuietBacktraceTweaker in the RDOCS, but I can''t figure
out how to use it. Can I add something to spec_helper.rb that will
utilize
2007 Jan 29
2
rspec and cookies
Hello
can anyone tell me how to test cookies using rspec? specifically, I''d like
to be able to set a cookie before a get/post request and also to test the
cookies which have been set by a get/post request
I know I can use cookies[:name] = ''value'' to set a cookie but how would I
set expiry information on such a cookie? when i try to pass a hash {:value
=>
2007 Mar 15
5
rake spec:views no transaction error
Hello,
I have recently upgraded to the 0.8.2 release of rSpec, and I am receiving
the following message with each view spec execution:
WARNING: there is no transaction in progress
I have upgraded the rspec_on_rails plugin as well, and both the model and
controller tests are working flawlessly. Is there some simple step I
missed? thanks for the input.
-Chris
-------------- next part
2007 Aug 14
4
Stubbing all methods
Mocha''s mock/stub framework has the ability to stub all methods on a
mock given. Does RSpec''s mocking framework have this ability? And
if not, is there some reason it shouldn''t be implemeneted?
Regards,
Scott
2008 Nov 24
8
Cucumber Custom Logging
Where and how do you put custom logger statements in cucumber? I
understood (more or less) how to do this in rspec in the spec_helper
file but I do not know where to start with cucumber.
I want to add a simple identifying text line in the log file to assist
in picking through the output. Something akin to:
Running Scenario: X
Feature I should have this logged
....
Feature This should