Re: [rspec-users] A recently observed anti pattern: commented out tests

2012-07-24 Thread Sidu Ponnappa
I'd suggest adding a coverage ratchet to your build. It's the most effective (if occasionally annoying) tool when dealing with such situations. Some assumptions: * You need a CI server and everyone's using CCMenu/Buildnotify so the team knows as soon as the build breaks * You don't have a brittle

Re: [rspec-users] An open source project with very good use of Cucumber?

2012-06-22 Thread Sidu Ponnappa
The Rspec codebase is itself a great example of how to use Cucumber correctly, IMO. Are you new to TDD entirely? If yes, then I'd suggest you come up to speed on that first. In my experience, many codebases substitute cucumber specs for TDD which is a bad idea. Best, Sidu. http://c42.in http://tw

Re: [rspec-users] Testing an API I'm creating, need test server to be running

2012-01-14 Thread Sidu Ponnappa
Agreed. This is even more a bullet to bite early if your app orchestrates over more than one service, or if services talk to other services or both. Testing this kind of setup is pretty difficult and the tests are typically very brittle. Best, Sidu. http://c42.in http://rubymonk.com Sent from my

Re: [rspec-users] How do we test a Rails Model which does not have an equivalent table in the backend using RSpec

2011-11-21 Thread Sidu Ponnappa
> I'm getting a common error for all such defined methods saying that> > `database_name.table_name does not exist`. Well , this is true but how> > should is it really making a difference?, and how to get a work around> for > this to just test a simple use case of calling a method successfully> i

Re: [rspec-users] any_instance

2011-11-06 Thread Sidu Ponnappa
> Any clues as to what could be wrong? It's either a bug or some other tests have side effects that only show up when run together. Let me try to replicate it on one of my codebases and get back to you. Best, Sidu Ponnappa. http://c42.in http://rubymonk.com On 3 November 2011 04:11, Bra

Re: [rspec-users] rspec not recognised

2011-09-15 Thread Sidu Ponnappa
If you've installed the gem via bundler, you'll need to either do 'bundle exec rspec' or run the build via rake (do `rake -T | grep spec` to list all the spec related tasks). You should also take a look at http://blog.davidchelimsky.net/2011/07/18/stop-typing-bundle-exec/ In any event, most editor

Re: [rspec-users] Assertions for asynchronous behaviour

2011-09-13 Thread Sidu Ponnappa
> the_object.should eventually_call(:foo).within(2).seconds TDDing multithreaded apps. Good times. Best, Sidu. http://blog.sidu.in On 13 September 2011 20:08, Justin Ko wrote: > > > On Tue, Sep 13, 2011 at 6:56 AM, Matt Wynne wrote: >> >> Hi all, >> In GOOS[1] they use an assertion called asser

Re: [rspec-users] generate user-readable tests from Rspec tests?

2011-09-12 Thread Sidu Ponnappa
You can write your own Formatter[1] if the existing ones don't work for you. The default RSpec document format is already available[2] - just pass `--format doc` as a param when running the specs. Best, Sidu. http://c42.in http://blog.sidu.in [1] http://cheat.errtheblog.com/s/rspec/ [2] https://g

Re: [rspec-users] rspec testing inheritance

2011-09-06 Thread Sidu Ponnappa
Wouldn't this be an implementation bound spec? Best, Sidu. http://c42.in On 7 September 2011 11:09, Justin Ko wrote: > > > On Tue, Sep 6, 2011 at 9:40 PM, slavix wrote: >> >> Hello, >> Is there any way to test model inheritance in spec? >> >> something like.. >>  it { ChildModel.should < Parent

Re: [rspec-users] How should I interpret RCov, code coverage?

2011-08-25 Thread Sidu Ponnappa
> Is an RCov code coverage of 100% really good? Because in my opinion a > method should be tested for more than one case but rcov doesn't care > about this :(. RCov is C0 coverage[1]. It's trivial to hit >95% coverage; in fact you can very quickly achieve >60% coverage by writing a handful of Cuke

Re: [rspec-users] [JRuby] simulating a java exception in a spec

2011-08-23 Thread Sidu Ponnappa
on to be a Ruby RuntimeError within the scope of your spec but I'm not sure how this will work (if at all) when Java::JavaLang::NullPointerException is raised from native code. Best, Sidu. http://c42.in On 23 August 2011 22:59, Sidu Ponnappa wrote: > it 'adds validation exceptions

Re: [rspec-users] [JRuby] simulating a java exception in a spec

2011-08-23 Thread Sidu Ponnappa
it 'adds validation exceptions raised by service to #errors' do ve = ValidationException #a java exception ve.stub(:localized_message).and_return('a bunch of errors') Just clarifying, but did you mean ve = ValidationException.new I tried replicating your spec but with jav

Re: [rspec-users] ruby 1.8.6

2011-08-22 Thread Sidu Ponnappa
Hi David, Sounds good to me. I haven't seen a 1.8.6 project since December last year. Best, Sidu. http://c42.in http://blog.sidu.in On 22 August 2011 07:41, David Chelimsky wrote: > Hey all, > > It's growing increasingly difficult for RSpec to support Ruby 1.8.6 as other > libraries that rspe

[rspec-users] [ANN] rspec-http 0.9 with header matchers released

2011-08-17 Thread Sidu Ponnappa
Hello everyone, Someone I was pairing with this evening needed this for one of their projects, so I've added matchers for headers to rspec-http and pushed an updated gem. You can now do response.should have_header('Content-Type') response.should have_header('Content-Type' => 'application/json

Re: [rspec-users] Test execution time filtering

2011-08-17 Thread Sidu Ponnappa
> But a sophisticated test will make decisions in mid test. Quis custodiet ipsos custodes? You'll need to write specs for the logic in your specs then. Best, Sidu. http://c42.in http://blog.sidu.in On 10 August 2011 04:53, Mike Jr wrote: > As I understand it, RSpec runs in two passes.  The first

Re: [rspec-users] functional testing with(through?) chrome

2011-08-05 Thread Sidu Ponnappa
I believe Cucumber + Sahi should work for you. More info here: http://blog.sahi.co.in/2010/04/sahi-vs-selenium.html Best, Sidu. http://c42.in On 6 August 2011 07:51, John Sayeau wrote: > Not sure if this can be done using RSpec and something else but I'm > trying to test a website using Chrome

Re: [rspec-users] Rspec teting API.

2011-08-03 Thread Sidu Ponnappa
Your controller specs should suffice for API specs. Is there anything specific you want to do beyond assert the response code, content type and some basic assertions against the body of the response? You may want to take a look at http://github.com/c42/rspec-http for asserting against response co

Re: [rspec-users] question regarding how to test posting form data with Net::HTTP

2011-07-21 Thread Sidu Ponnappa
Hi Patrick, I'd spec out the possible consequences of the different response codes as well what should happen in the event of a HTTP timeout. The requests themselves I would mock out because, as you pointed out, you're calling a 3rd party and you don't want live HTTP calls in your unit tests. Bes

[rspec-users] Time out long running tests using Rspec 2

2011-06-21 Thread Sidu Ponnappa
I'm cross posting a query on timing out tests that came up on our local ruby list: In RSpec1, there was an option "timeout" using which we can fail all > the long running tests i.e. "spec --timeout 2 spec/" will fail those > tests which takes more than 2 seconds to run. It does not seem to be > ex

Re: [rspec-users] How do you factor out common "before(:each)" calls so that multiple specs can use them?

2011-05-25 Thread Sidu Ponnappa
Ken, I've sometimes found extracting this code into a helper like def login(user) @controller.stub(:authenticate_user!) @controller.stub(:current_user).and_return(user) @controller.stub(:add_secure_model_data) user end and before(:each) @user = login(User.new) end because most of my

Re: [rspec-users] For those using Rails with RSpec... what do you guys use for creating Factories?

2011-05-25 Thread Sidu Ponnappa
Given the limitation Justin just mentioned, an easy performance win is to switch your testing environment to use an in-memory db. You could also parallelize your specs to use all cores on your machine. Best, Sidu. http://c42.in http://about.me/ponnappa On 26 May 2011 00:30, Ken Egervari wrote: >

Re: [rspec-users] Writing a spec for HTTP OPTIONS verb

2011-05-24 Thread Sidu Ponnappa
http://about.me/ponnappa On 25 May 2011 00:55, Andrew Premdas wrote: > > > On 24 May 2011 19:13, Sidu Ponnappa wrote: >> >> Hi Andrew, >> >> I'm not sure that's necessarily true - I've read of several RESTful >> APIs using OPTIONS to discover

Re: [rspec-users] Writing a spec for HTTP OPTIONS verb

2011-05-24 Thread Sidu Ponnappa
ernative. Best, Sidu. http://c42.in http://about.me/ponnappa On 24 May 2011 23:54, Sidu Ponnappa wrote: > A cursory examination of > http://apidock.com/rails/ActionController/TestCase seems to indicate > that there may be no way to write tests for options calls using > standard Rail

Re: [rspec-users] Writing a spec for HTTP OPTIONS verb

2011-05-24 Thread Sidu Ponnappa
Hi Andrew, I'm not sure that's necessarily true - I've read of several RESTful APIs using OPTIONS to discover more about a resource at a URI. Rails clearly recognizes the OPTIONS HTTP verb because I get Started OPTIONS "/" for 127.0.0.1 at Tue May 24 23:38:38 +0530 2011 when I query a standard

Re: [rspec-users] Writing a spec for HTTP OPTIONS verb

2011-05-24 Thread Sidu Ponnappa
p://c42.in http://about.me/ponnappa On 24 May 2011 23:43, Sidu Ponnappa wrote: > Hi Andrew, > > I'm not sure that's necessarily true - I've read of several RESTful > APIs using OPTIONS to discover more about a resource at a URI. Rails > clearly recognizes the OPTI

Re: [rspec-users] HTTP Status 406 When Testing :json

2011-05-02 Thread Sidu Ponnappa
x27;d presume) does not have a responds_to clause that matches it. Not sure about :json vs 'json.' On 2 May 2011 18:00, Sidu Ponnappa wrote: > Hi, > > When testing Rails APIs, always assert on response codes and where > relevant, the Location, Content-Type and other headers. We

Re: [rspec-users] HTTP Status 406 When Testing :json

2011-05-02 Thread Sidu Ponnappa
Hi, When testing Rails APIs, always assert on response codes and where relevant, the Location, Content-Type and other headers. We wound up doing this on every single project and so extracted it into a gem that you might find useful: https://github.com/c42/rspec-http Best, Sidu. http://c42.in http

Re: [rspec-users] Parallelize RSpec

2011-04-29 Thread Sidu Ponnappa
icated than > needed.    They both require other moving parts (database; other > server).    It seems now with ruby 1.9 and jruby a simpler solution > (maybe harder to code) would be to use a queue and native threads. > > Thoughts? > > AE > > > > On Thu, Apr 28, 2011

Re: [rspec-users] Parallelize RSpec

2011-04-28 Thread Sidu Ponnappa
You can also take a look at https://github.com/test-load-balancer Best, Sidu. http://c42.in http://about.me/ponnappa On 29 April 2011 01:24, Adam Esterline wrote: > I am looking for some advice on the best way to parallelize a large > set of browser-based regression tests written in rspec.    Ju

Re: [rspec-users] Slow test suite with Ruby 1.9.2 and Rspec 2.5

2011-04-24 Thread Sidu Ponnappa
ve on 1.9.2. Cheers, Sidu. http://c42.in http://about.me/ponnappa On 25 April 2011 03:52, Alisson Sales wrote: > On Sun, Apr 24, 2011 at 6:23 PM, Sidu Ponnappa wrote: >> Are you perhaps seeing http://is.gd/6aINHC ? We've moved several Rails >> projects to 1.9.2 over the la

Re: [rspec-users] Slow test suite with Ruby 1.9.2 and Rspec 2.5

2011-04-24 Thread Sidu Ponnappa
Oh, and it should be sorted in 1.9.3: http://redmine.ruby-lang.org/issues/show/3924 Note that this only impacts startup times - your app should still run faster on 1.9.2. Best, Sidu. http://c42.in http://about.me/ponnappa On 25 April 2011 02:53, Sidu Ponnappa wrote: > Are you perhaps see

Re: [rspec-users] Slow test suite with Ruby 1.9.2 and Rspec 2.5

2011-04-24 Thread Sidu Ponnappa
Are you perhaps seeing http://is.gd/6aINHC ? We've moved several Rails projects to 1.9.2 over the last few months and we've found our builds running slower on all (we use RSpec too). Cheers, Sidu. http://c42.in http://about.me/ponnappa On 25 April 2011 02:44, Alisson Sales wrote: > On Sun, Apr 2

Re: [rspec-users] Need suggestions on how to test a class

2011-04-13 Thread Sidu Ponnappa
Hi Nicholas, You have little choice but to mock external dependencies like S3 and the file system in order to be able to do TDD. The problem is that, as Matt said, if it's a mission critical feature you'll want to create infrastructure to run tests against a real environment (even if it's just a s

Re: [rspec-users] Error running rspec on Debian

2011-04-02 Thread Sidu Ponnappa
I just wanted to confirm that you've verified that the exact same codebase has its specs run correctly on a different OS (or flavour of linux, even)? Best, Sidu. http://c42.in http://about.me/ponnappa On 29 March 2011 06:34, Carlos Torres wrote: > I'm new to Rails and I was planning on trying