similar to: Integration testing: coupling of get and post on forms

Displaying 20 results from an estimated 4000 matches similar to: "Integration testing: coupling of get and post on forms"

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 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
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.
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
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 Jan 21
35
Collection proxies need to be stubbed ?
Hi all ! I just started writing specs on a new project. I would just like to validate that this is the way you would write it. I know about mocks, stubs and expectations. I don''t think this is a problem for me. My question really boils down to: def index @projects = current_user.projects.active end My spec needs to return the proxy, no ? Here''s my code: context "A
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
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 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
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 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 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
2007 Oct 24
3
Using Mechanize in Story Step Implementations
Hi, Thought this might be of interest story writers. The mechanize plugin seems to play nice with RSpec. The following mix of methods seems to work just fine. I especially like the helpers for populating forms. agent = WWW::Mechanize.new page = agent.get ''http://www.gmail.com'' page.should have_tag(''form'', :count => 1) form = page.forms.first form.email =
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 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
2008 Aug 28
2
HostName not quite working as expected?
Setting up a few hosts in a small domain, I thought I'd save keystrokes by defining ssh_config aliases for their non-canonicalized names. For example: Host myhost HostName myhost.example.com Host *.example.com Port 23 ... I would have expected that "ssh myhost" would then start a session on port 23 (instead of 22). And I've seen blog/list posts that suggest the same
2008 Jun 14
2
FTS/squat search indexes built when?
I know that a given search index doesn't get built the first time until you do an actual search on it from an IMAP client. I don't much care about that; I'm the only user, and I don't create new folders too often. At worst, I could create a script to go search every folder once. But what I'm not clear about: Does it then get updated on every delivery by LDA? Or does the
2006 Jul 24
9
Mongrel: auto-reload plugins?
When developing applications, Webrick will automatically reload controllers, models, etc. if the source changes. For obvious reasons, it doesn''t do this for plugins, which makes it a pain to develop said plugins. I was hoping Mongrel might have some facility to say "watch this directory too and reload any changes". Obviously, re-init''ing all plugins would be
2006 Apr 02
7
RANT: belongs_to -> refers_to
Every once in a while, I pipe up and whine that "belongs_to" should really be ''refers_to" [http://dev.rubyonrails.org/ticket/2130]. It''s time again. I''ve got a bunch of stuff going onto eBay, so, like any good engineer, I don''t just post it manually: I design a Rails-based inventory database that creates a semantically-correct XHTML/CSS auction