Quantcast

Cucumber and rspec, do cucumber step definitions use rspec?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cucumber and rspec, do cucumber step definitions use rspec?

S Ahmed
I'm a bit confused as to how cucumber and rspec integrate (if they d at all?).

You write a cucumber feature, and step definitions.
Now in the step definitions, do you write rspec in the step definitions or do they somehow link to the spec's written elsewhere?



_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cucumber and rspec, do cucumber step definitions use rspec?

Andrew Premdas


On 9 May 2011 15:00, S Ahmed <[hidden email]> wrote:
I'm a bit confused as to how cucumber and rspec integrate (if they d at all?).

You write a cucumber feature, and step definitions.
Now in the step definitions, do you write rspec in the step definitions or do they somehow link to the spec's written elsewhere?



Cucumber and rspec are different tools. Cucumber is aimed at a higher level (functional) whilst rspec is aimed at the unit level. So Cucumber features specify your applications behaviour, whilst rspec specifies your objects (and/or classes) behaviour. 

The best place to see how they work in tandem is the RSpec Book.

All best

Andrew


_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users



--
------------------------
Andrew Premdas

_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cucumber and rspec, do cucumber step definitions use rspec?

S Ahmed
Andrew, I've actually read allot of the book (but admittedly I brushed over the cucumber sections), but I was confused at this point.

I understand the outside in development, etc.

What I was confused at was if the two technologies actually integrate at some point.

i.e. if you run cucumber, will it go and run spec's for you also?

Correct me if I am wrong, but the cucumber step definitions do indeed use webrat to hit the pages and verify things in the view pages correct?

On Mon, May 9, 2011 at 10:48 AM, Andrew Premdas <[hidden email]> wrote:


On 9 May 2011 15:00, S Ahmed <[hidden email]> wrote:
I'm a bit confused as to how cucumber and rspec integrate (if they d at all?).

You write a cucumber feature, and step definitions.
Now in the step definitions, do you write rspec in the step definitions or do they somehow link to the spec's written elsewhere?



Cucumber and rspec are different tools. Cucumber is aimed at a higher level (functional) whilst rspec is aimed at the unit level. So Cucumber features specify your applications behaviour, whilst rspec specifies your objects (and/or classes) behaviour. 

The best place to see how they work in tandem is the RSpec Book.

All best

Andrew


_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users



--
------------------------
Andrew Premdas

_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cucumber and rspec, do cucumber step definitions use rspec?

Matt Wynne
In reply to this post by S Ahmed

On 9 May 2011, at 16:00, S Ahmed wrote:

> I'm a bit confused as to how cucumber and rspec integrate (if they d at all?).
>
> You write a cucumber feature, and step definitions.
> Now in the step definitions, do you write rspec in the step definitions or do they somehow link to the spec's written elsewhere?

You write *Ruby* code in the step definitions. Because Cucumber is a testing tool, you often want to make assertions in that Ruby code about how the system you're testing is behaving. RSpec gives you assertions, so you can use RSpec's assertions in your step definitions. You can also use Ruby's own built-in assertions from the Test::Unit::Assertions namespace.

cheers,
Matt

--
Freelance programmer & coach
Founder, http://relishapp.com
+44(0)7974430184 | http://twitter.com/mattwynne

_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cucumber and rspec, do cucumber step definitions use rspec?

Aslak Hellesoy
In reply to this post by S Ahmed


On Mon, May 9, 2011 at 3:00 PM, S Ahmed <[hidden email]> wrote:
I'm a bit confused as to how cucumber and rspec integrate (if they d at all?).


RSpec is two things:
a) A runner (command line program)
b) An assertion library (should, should_not, be_nil and friens)

Cucumber doesn't use a) at all.
If you want, you can use b) in your step definitions. If you don't, Cucumber won't use RSpec at all.

HTH,
Aslak

You write a cucumber feature, and step definitions.
Now in the step definitions, do you write rspec in the step definitions or do they somehow link to the spec's written elsewhere?



_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cucumber and rspec, do cucumber step definitions use rspec?

David Chelimsky-2
On May 10, 2011, at 11:50 AM, aslak hellesoy wrote:



On Mon, May 9, 2011 at 3:00 PM, S Ahmed <[hidden email]> wrote:
I'm a bit confused as to how cucumber and rspec integrate (if they d at all?).


RSpec is two things:
a) A runner (command line program)
b) An assertion library (should, should_not, be_nil and friends)

c) mocking/stubbing


Cucumber doesn't use a) at all.
If you want, you can use b) in your step definitions. If you don't, Cucumber won't use RSpec at all.

Same for stubs.

Cheers,
David

_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cucumber and rspec, do cucumber step definitions use rspec?

Aslak Hellesoy
In reply to this post by S Ahmed


On Mon, May 9, 2011 at 4:12 PM, S Ahmed <[hidden email]> wrote:
Andrew, I've actually read allot of the book (but admittedly I brushed over the cucumber sections), but I was confused at this point.

I understand the outside in development, etc.

What I was confused at was if the two technologies actually integrate at some point.

i.e. if you run cucumber, will it go and run spec's for you also?


Nope
 
Correct me if I am wrong, but the cucumber step definitions do indeed use webrat to hit the pages and verify things in the view pages correct?


Cucumber-Rails generates some step definitions for you in features/step_definitions/web_steps.rb that:
* Use Webrat or Capybara, depending on the command line options you pass to the cucumber:install generator
* We recommend you delete those stepdefs and write your own, based on the Capybara API.
* Cucumber-Rails 0.5.0 will not support Webrat at all, only Capybara

Aslak


On Mon, May 9, 2011 at 10:48 AM, Andrew Premdas <[hidden email]> wrote:


On 9 May 2011 15:00, S Ahmed <[hidden email]> wrote:
I'm a bit confused as to how cucumber and rspec integrate (if they d at all?).

You write a cucumber feature, and step definitions.
Now in the step definitions, do you write rspec in the step definitions or do they somehow link to the spec's written elsewhere?



Cucumber and rspec are different tools. Cucumber is aimed at a higher level (functional) whilst rspec is aimed at the unit level. So Cucumber features specify your applications behaviour, whilst rspec specifies your objects (and/or classes) behaviour. 

The best place to see how they work in tandem is the RSpec Book.

All best

Andrew


_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users



--
------------------------
Andrew Premdas

_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/rspec-users
Loading...