# Using Rspec for features and specs under Autotest

**URL:** <https://www.ruby-forum.com/t/using-rspec-for-features-and-specs-under-autotest/182942>\
**Category:** Ruby\
**Created:** [February 5, 2010, 3:21am UTC](https://www.ruby-forum.com/t/using-rspec-for-features-and-specs-under-autotest/182942 "2010-02-05T03:21:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_DeNigris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@Sean\_DeNigris](https://www.ruby-forum.com/u/Sean_DeNigris)\
**Post date:** [February 5, 2010, 3:21am UTC](https://www.ruby-forum.com/t/using-rspec-for-features-and-specs-under-autotest/182942/1 "2010-02-05T03:21:49Z")

</div>

Hi list,

Does anyone have experience using Rspec for both the feature and spec  
cycle with Autotest?

What I mean is that I’m developing a library that will only be used by  
other developers. However, if I only write specs and not acceptance  
tests, I have no idea if it’ll work, and if I hit real resources in  
the specs, coding is really slow because I don’t find out if I have a  
silly error until I wait for half the tests to run.

What I’d like to do is something like this: run all my specs with real  
resources as acceptance tests, then drop down into running the specs  
with mocks until they all pass, then jumping out to the “feature  
layer” of real resources, all automatically with Autotest.

I haven’t gotten into specifics yet, just brainstorming, and wanted to  
know if someone has a good way to deal with this type of situation.

Thanks.  
Sean DeNigris

---

<div class="post-metadata">

**Author:** ![Sean\_DeNigris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@Sean\_DeNigris](https://www.ruby-forum.com/u/Sean_DeNigris)\
**Post date:** [February 5, 2010, 3:26am UTC](https://www.ruby-forum.com/t/using-rspec-for-features-and-specs-under-autotest/182942/2 "2010-02-05T03:26:42Z")

</div>

Sean DeNigris wrote:

> Hi list,
> 
> Does anyone have experience using Rspec for both the feature and spec  
> cycle with Autotest?

Yes!

> What I mean is that I’m developing a library that will only be used by  
> other developers. However, if I only write specs and not acceptance  
> tests, I have no idea if it’ll work, and if I hit real resources in  
> the specs, coding is really slow because I don’t find out if I have a  
> silly error until I wait for half the tests to run.
> 
> What I’d like to do is something like this: run all my specs with real  
> resources as acceptance tests, then drop down into running the specs  
> with mocks until they all pass, then jumping out to the “feature  
> layer” of real resources, all automatically with Autotest.

Probably not a great idea to use mocks. What real resources are slowing  
you down?

For the rest, if you use Cucumber for your acceptance tests (which you  
should!), then autotest will act as you described by default if  
AUTOFEATURE is true.

> I haven’t gotten into specifics yet, just brainstorming, and wanted to  
> know if someone has a good way to deal with this type of situation.
> 
> Thanks.  
> Sean DeNigris

Best,  
–Â  
Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Sean\_DeNigris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@Sean\_DeNigris](https://www.ruby-forum.com/u/Sean_DeNigris)\
**Post date:** [February 5, 2010, 4:23am UTC](https://www.ruby-forum.com/t/using-rspec-for-features-and-specs-under-autotest/182942/3 "2010-02-05T04:23:51Z")

</div>

> Probably not a great idea to use mocks. What real resources are slowing  
> you down?  
> It’s an application scripting library, so pretty much every method  
> call interacts with an application (mostly Apple events) - there are  
> windows popping up all over the place, lol. I just want to use mocks  
> in the specs i.e. unit tests, and use real resources in the outer  
> cycle

> For the rest, if you use Cucumber for your acceptance tests (which you  
> should!), then autotest will act as you described by default if  
> AUTOFEATURE is true.  
> That’s what I’m doing now. What I was wondering was if anybody was  
> using rspec for the specs and rspec again for the features (instead of  
> cucumber). Maybe by encapsulating the choice to use mocks or not as  
> the difference between the two cycles…

It seems like using Cucumber for the features when developers are the  
users will obscure the usage, and I don’t see the benefit to plain  
English in this case.

Sean

Thanks for the reply!

---

<div class="post-metadata">

**Author:** ![Sean\_DeNigris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@Sean\_DeNigris](https://www.ruby-forum.com/u/Sean_DeNigris)\
**Post date:** [February 5, 2010, 4:30am UTC](https://www.ruby-forum.com/t/using-rspec-for-features-and-specs-under-autotest/182942/4 "2010-02-05T04:30:31Z")

</div>

Sean DeNigris wrote:

> > Probably not a great idea to use mocks. ï¿½What real resources are slowing  
> > you down?  
> > It’s an application scripting library, so pretty much every method  
> > call interacts with an application (mostly Apple events) - there are  
> > windows popping up all over the place, lol.

So? That shouldn’t bother you.

> I just want to use mocks  
> in the specs i.e. unit tests, and use real resources in the outer  
> cycle

Unless performance is a serious issue, your tests will probably be  
better done with real resources. Of course, you can use mocks on  
demand, which means you don’t have to ysethem everywhere.

> > For the rest, if you use Cucumber for your acceptance tests (which you  
> > should!), then autotest will act as you described by default if  
> > AUTOFEATURE is true.  
> > That’s what I’m doing now. What I was wondering was if anybody was  
> > using rspec for the specs and rspec again for the features (instead of  
> > cucumber). Maybe by encapsulating the choice to use mocks or not as  
> > the difference between the two cycles…
> 
> It seems like using Cucumber for the features when developers are the  
> users will obscure the usage, and I don’t see the benefit to plain  
> English in this case.

Features are usually best expressed in nontechnical language. That’s  
why Cucumber makes so much sense. If you think it’s not so for your  
case, let’s see some of your features! It’s possible that they’d be  
better as unit tests…

> Sean
> 
> Thanks for the reply!

Best,  
–Â  
Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
