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
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
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
> 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
> 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
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
> 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
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
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
> 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
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
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
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
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
> 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
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
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
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
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
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
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:
>
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
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
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
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
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
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
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
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
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
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
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
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
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
34 matches
Mail list logo