similar to: Spec/Test Speed

Displaying 20 results from an estimated 20000 matches similar to: "Spec/Test Speed"

2007 Sep 26
10
How do I best setup data for Story Runner?
Just started looking at the Story Runner integration, and am converting a few Rails integration tests to get a feel for it. My integration tests relied on fixtures, and since my models have a significant amount of validation (and hence need valid data unless I save without validation), this has made setup easy. With stories however, I''m wondering what the recommended approach is.
2008 Mar 18
11
"Why not MockEverthing" or why use fixtures for all tests?
Hello fellow RSpec users. Before you all start warming up your flame throwers please let me explain my Subject line. I''ve been working over 4 months on a large Rails project with a few other developers. Test coverage was spotty at best, though they *were* RSpec tests. One of the other developers and I had started adding more tests, mostly controller tests using the methodology
2007 Dec 06
43
Mocks? Really?
OK, so i''ve played a bit with mocks and mock_models in controller and view tests and i have a question. Is this statement really correct: "We highly recommend that you exploit the mock framework here rather than providing real model objects in order to keep the view specs isolated from changes to your models." (http://rspec.rubyforge.org/documentation/rails/writing/views.html
2007 Sep 04
3
Model Specs: Fixtures vs Mocks + Stubs?
What is the general opinion about fixtures versus mocking and stubbing in model specs? I heard from agile on IRC that they save the database testing for integration testing, but I also see that the caboose sample applicaiton uses fixtures. I also noticed that on the rspec site, it says "Ironically (for the traditional TDD''er) these are the only specs that we feel should actually
2007 Aug 28
3
How do you keep mocks updated without pain?
Hi! I know you must be answering a lot of basic questions, sorry about that :-) However I have not get it, how do you keep mocks updated without pain? I reached to the point where mocking things for view. I spec model-controller-view using "correct doc" way mocking-stubbing (plus I should run integration test to be sure that everything really works together). Now, when I want to
2007 Aug 10
3
FixtureScenarios
This may have turned up in the RSS feeds of many of you already, but for those who haven''t seen it yet, looks intersting: <http://errtheblog.com/post/7708> > The main problem with fixtures, for me, has always been how unfun > they are. They literally suck the fun out of anything they?re > around. You throw them in your test/ directory, then suddenly > testing
2008 May 26
7
Mocking Models in Controller Specs...
I find myself doing this kind of thing a lot in Controller Specs: @vacancy = mock_model(Vacancy) @vacancy.stub!(:reference) @vacancy.stub!(:title) @vacancy.stub!(:created_at) @vacancy.stub!(:updated_at) @vacancy.stub!(:body) @vacancy.stub!(:contract) @vacancy.stub!(:location) @vacancy.stub!(:salary) @vacancy.stub!(:benefits)
2007 Oct 16
10
Scenarios Plugin Pre-Announcement
This is sort of a pre-announcement for a Rails plugin my friend Adam Williams and I are working on. We''re in the process of extracting it from a project we are working on so that it can be generally useful to the Rails community. We are calling it "Scenarios". It is a drop in replacement for Rails fixtures: http://faithfulcode.rubyforge.org/svn/plugins/trunk/scenarios/README
2007 May 30
6
authentication mocks
hi I''m using restful_authentication and have controller specs working using users fixtures (and login_as) however i''ve been trying for hours without success to do it without fixtures, using mocks and stubs instead. anyone here done this? got code? :) thanks
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
2007 Feb 22
7
We can''t 100% remove our unit tests from the database, can we?
I hope this isn''t too rambly. This is sort of a brain dump of a subject I''ve been thinking about for months as I''ve used RSpec. Let''s say we''ve got a simple query method, that will find all the users in the DB older than 18. Our model could look like class User < ActiveRecord::Base def self.find_older_than(age) find :all, :conditions =>
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,
2008 Jul 05
5
Does RSpec work nicely with UUID primary keys?
I have my application happily generating UUID primary keys using the uuidtools gem. But the auto-generated specifications created by "script/generate rspec_scaffold...", etc, assume that one is using a sequential integer primary key. For those who have hit this same issue, is it just a matter of rewriting the auto-generated specifications to take this into account, or does one have to
2008 May 17
5
Help needed
Hi All, I am new to rspec and it seems that I don''t understand some basics. I need to have a XML import which should parse through XML data and saves all that in various mysql tables. The XML part works just fine and I can test this with rspec. However when I try to execute it "should find country object for DE" do I get an error. @user.country is a one-to-many relation in
2007 Oct 26
3
Specing with Subdomains as Account Keys
How do you go about implementing and rspecing subdomains as account keys? I''m sure that this must be an issues for others as well. So I have an app using subdomains as account keys. The Application Controller sets up @current_company in a before filter. Everything is done within the context of the @current_company. After reading about Demeter''s Revenge
2007 Aug 18
12
Test::Unit to RSpec
So I''ve just started working on a rails project which currently has something like 7500 LOC. All of the tests are written in Test::Unit, although the test coverage is pretty poor: rcov says that 25% of the code is covered, while rake stats shows the code to test ratio as 1:0.1 (800 lines of test code). I guess I''m wondering what would generally be advisable here. Is it
2007 Dec 11
14
Attachment-fu + Story Runner
Hi all, I''m trying to run a Story Runner integration test that uploads a file through Attachment-fu. I''ve tried various ways of specifying the file data, from custom mocks: class MockFile < Struct.new (:original_filename, :read, :content_type); end fdata = MockFile.new "test_upload.txt", "Test Upload", "text/plain" to
2007 Jul 09
12
Mocking User.find( :all, :limit => 10 )
Hi, I''m trying to setup a mock for my controller test but I can''t get it to recognise the mock. I use it "should find all users" do User.should_receive(:find).with( :all, :limit => 10 ).and_return([@user]) do_get end and in the controller @users = User.find(:all, :limit => 10 ) But this does not work. It gives me User expected :find with (:all)
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 Nov 14
4
Stubbing out required associated models
Hello, As I''m becoming more and more familiar with mocking/stubbing, I''m going back to some of my model specs and revaluating how I wrote them. I have certain models in which validation requires the presence of an associated model, which itself needs to be valid(validates_presence_of and validates_associated). When I wrote the specs, I wrote helpers for the attributes instead