similar to: Collection proxies need to be stubbed ?

Displaying 20 results from an estimated 10000 matches similar to: "Collection proxies need to be stubbed ?"

2007 Aug 27
7
Foreign key constraints, fixtures, and rake task
I''ve got a spec that loads a fixture in the "before" block. This works fine running scripts/spec, but when I run rake spec instead, I get: ActiveRecord::StatementInvalid in ''User in fixture :quentin with an IM service but no IM name should be invalid'' Mysql::Error: Cannot delete or update a parent row: a foreign key constraint fails
2006 Nov 07
7
should_redirect_to in advance - feels unnatural
I can understand that it''s easier for rspec to set up a mock in advance of the controller call. But it makes it difficult to do something like: context "The HarkController, given Louie the logged-in user" do setup do post :login, :username => ''louie'', :password => ''atest'' end specify "should redirect Louie to the home
2007 Aug 16
17
undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8>
I am getting: undefined method `mock_model'' for [RSpec example]:#<Class:0x25550a8> with my view specs after upgrading to 1.0.8. Is anyone else seeing this? To isolate the message I did the following setup: - create new rails project (with edge) - installed rspec and rspec_on_rails - ran rake spec - ran script/generate rspec_scaffold products - tried to run a builtin view
2006 Oct 17
3
Should fixtures be transactional?
I started using the new Model.should_have(1).records expectation in rspec_on_rails, and quickly realized that my fixtures were remaining loaded, even in contexts that didn''t use them. Bug or feature? Jay Levitt
2007 Aug 13
2
Backtrace tweaker - broken or me?
Using 1.0.8, I just realized that I''ve been scrolling through pages of backtraces when rspec is supposed to clean them up for me. This is a new development machine, so I''m not sure if older versions worked or not. I''m running Ruby 1.8.6, Rails edge, Mac OS X 10.4.10. I''ve verified that the QuietBacktraceTweaker is the one that''s running.
2007 Aug 06
2
Specifying custom rails FormBuilders
I want to write a spec for a custom form builder, but I''m not really sure where it should live or how to include the right rspec_on_rails contexts. Ideally, I should be able to write a spec like: describe LabelledBuilder do it "should let me create a text field" do object = mock(object) object.stub!(:attribute).and_return("Test String") render
2007 Jan 22
1
Observed models cause failures with DRBSpec ?
Hi all ! I don''t believe I am the only one using model observers, right ? Well, here''s a nice one: $ drbspec spec . Finished in 0.125322 seconds 1 specification, 0 failures $ drbspec spec F 1) ''A user with an inactive and an active project should be able to return active projects only'' FAILED [] should == [#<Spec::Mocks::Mock:0xb75590bc
2007 Aug 30
7
mock_model in spec/lib
Has anyone else run into a problem with trying to use mock_model in spec/lib ? For some reason, I can take the same spec, put it in spec/models, have it run fine, but put it in spec/lib, and have it complain about not being able to find #mock_model Thanks, Edward
2007 Aug 02
2
got/expects causes mental layering violation
I was, for the first time, spec''ing a class that redefined ==. And my spec was incorrect, so == was returning false. The result was something like: class C def ==(other) false end end .. C.new.should == other... expected other, got #<C:0x7f03c454> (using ==) But wait! Why on earth is == returning the class itself instead of true/false? That shouldn''t be
2006 Nov 10
3
Stubbing Time.now in trunk
I''m a big fan of stubbing Time.now so it returns a known value. I used to be able to use stubba and say: @time_now = Time.parse("Jan 1 2001") Time.stubs(:now).returns(lambda{@time_now}) However, something in trunk broke that. Fine, rspec''s got its own stubbing lib now, so I tried switching to that: @time_now = Time.parse("Jan 1 2001")
2007 Sep 16
10
I lost the RSpec fight
I''ve been working on a Rails project with one other developer; he was using Test::Unit, and I was using RSpec. That works OK for a while, but obviously it starts causing pain when you have to check in two places to see if a piece of code is properly tested/spec''d, you can''t use TextMate shortcuts to switch back and forth between code and test, you have to duplicate
2006 Nov 06
1
Integration testing: coupling of get and post on forms
This is such a vague request it''s not even worthy of a ticket, but: When rspec does support integration testing, it''d be really nice to be able to do things like this plugin does for standard Rails tests: http://www.jasongarber.com/articles/2006/10/24/easier-testing-of-forms-form_test_helper In a nutshell, it finally closes the loop between "the empty form sent by a
2006 Nov 07
1
RSpec/Selenium start_browser_once patch?
The 0.7.0 vendor/selenium/README.txt references a "start_browser_once.patch" file. This doesn''t seem to be included in either the rspec or selenium-rc distributions, and Google finds nothing... where might I find that patch? Jay Levitt
2007 Sep 20
4
alias :calling :lambda
Sprinkling my examples with ''lambda'' has always seemed like a bit of a wart to me. I''ve gotten into the habit of adding ''alias :calling :lambda'' to my spec suites. My examples then look like: calling { Foo }.should raise_error calling { Bar }.should_not raise_error Is there a reason that RSpec core has chosen not to make exception expectations more
2007 Oct 15
14
Top Quoting?
Sort of off-topic and don''t mean to complain, but many on this list use top quoting. That works ok if you don''t quote the whole previous thread. However, I''m finding that scrolling forever to locate the reply on longer threads is getting tedious. What''s the rationale for top-quoting? Thx.
2007 Jul 29
6
Isolating rails model specs from their implementation
I''m currently taking a Rails project management app I built when learning Rails and adding specs to it. During the course of building the app the requirement that project should be archiveable was added. So a project is in one of two states active or archived. This led to the creation of the following methods: Project.active_projects Project.archived_projects @project.active?
2007 Sep 04
16
Failure Messages in RSpec
Having used JUnit and Test::Unit, I''m quite used to having the ability to insert a failure message, which helps when tests fail. For instance, the example RSpec that is generated for a model class specifies that the model class is valid. Assuming this were supposed to be true, and it failed, I''ve now got to duplicate the code in the test in order to find out why it
2007 May 17
4
How to mock helpers in view specs ?
Hi all, I am mocking the following Rails view (inside a partial): <%= render :partial => "forums/forum", :collection => forum_category.forums.readable_by(current_user? ? current_user : nil) %> My spec fails with the following message: 1) ActionView::TemplateError in ''forum_categories/index (anonymous user) should only render forums accessible to anonymous
2008 Aug 20
9
I want RSpec for CSS layout.
I don''t even know how it''d be possible (through Selenium?), but I want it. I want to see if my stupid CSS hacks break. I want to say: describe "#nav-column" do body = something("#body-column") it "should line up at the top" do dom[:top].should_be == body.dom[:top] end it "should always be to the right" do
2007 Sep 06
5
Removing/overriding/unstubbing a stub?
We''re using Mocha stubs to stub out a slow-performing network request in a Test::Unit class. But naturally, we don''t want to stub it out in the few tests that actually verify the functionality of that network request. Is there a way to do the stub in "setup", but override it for the few tests that need the original functionality? (I realize that in this case, the