Displaying 13 results from an estimated 13 matches for "justnoth".
Did you mean:
justnot
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 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 Aug 22
2
stubbing network calls
I have a couple of methods which make networks calls. Where''s the best place
to stub them so they are stubbed for every description automatically? I
tried in spec_helper.rb but they are no longer stubbed when a spec runs.
at the moment, I''m checking for the test environment in the methods
themselves, and returning a dummy value, but I''m sure there''s a better
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 Jun 15
3
dynamic specs
I''d like to test that my model attributes are properly protected against mass
assignment, something like:
it "should NOT update :balance on mass assignment" do
@account.attributes = {:balance => 1000}
@account.balance.should_not == 1000
end
instead of doing each attribute manually however, I''d like to automate it so
I can pass a list of attributes which CAN be
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 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 Jun 07
4
checking associated objects have been deleted
I have the following model:
class Book < ActiveRecord::Base
has_many :taggings, :dependent => :delete_all
has_many :tags, :through => :taggings
end
is it possible to check that associated taggings are being destroyed
using mocks? I don''t want to test that rails is deleting the
associations, I want to test that I have specified the association as
a dependent one.
the only
2007 Aug 24
26
testing behaviour or testing code?
hypothetical question for all you BDD experts:
I want to make sure that a :list action always returns widgets in
alphabetical order. There''s at least 2 ways of doing this:
it "should fetch items in alphabetical order" do
Widget.should_receive(:find).with(:order => "name ASC")
get :list
end
it "should fetch items in alphabetical order" do
[:red,
2007 Jul 30
0
avoiding repitition
as my rails application gets bigger, I find I''m writing the same generic
specs for standard CRUD operations. with 8 controllers so far, and more to
come, I''m keen to reduce the duplication. I asked before about generating
specs dynamically in this thread :
http://www.nabble.com/dynamic-specs-tf3927280.html#a11137640
but it doesn''t seem possible completely possible.
2007 Jun 01
0
rspec_on_rails, could someone provide an example of using mocks/stubs?
hi all
I''m still a little uncertain on how to use mocks/stubs with rspec when
dealing with associations. I know the point is to isolate the code being
tested and remove external dependencies, but I''m not sure how to implement
it. Can someone suggest how they would spec the code below:
I have a Book model and Review model
class Book < ActiveRecord::Base
has_many :reviews
2007 Jun 25
0
db:test:clone_structure doesn''t purge db
I''m using a "CHARSET=utf8" option in my migrations, but this isn''t dumped to
schema.rb - a file that test:db:clone uses to create the test database. The
end result is some of my specs fail because they''re expecting the db table
to be using utf8.
to get round this, I switched to using db:test:clone_structure which DOES
preserve the charset option, but when the
2007 Feb 18
1
get() method in custom expectation matcher?
I''m trying to write a custom expectation:
controller.should_require_login_for(:action_name).
I''m using the example in the docs for ''Custom Expectation Matchers'' but I''m
unsure how to make the get() method available to my ShouldRequireLogin
class. I''ve tried requiring spec_helper but no joy.
can anyone help?
thanks
--
View this message in