Rails acceptance testing without using rspec but using capybara - ruby-on-rails

I am looking for an example of acceptance testing in Rails without using rspec. My current client uses ruby 1.9.2 and all the tests are written using minitest and they are concerned about the slowness of rspec. Anyways that discussion is over.
I need to write a few functional tests and am looking for examples of how to do functional tests without using rspec. And I would like to use capybara.
I am using Rails 3.0.10 .

sounds like you want to be looking at Cucumber - http://cukes.info/ perhaps?

Related

Rails project using BDD(RSpec and Cucumber)

Basically I want to use BDD(RSpec and cucumber) to make a complete rails project.Is it possible and if yes is it good to make a project using outside-in Rails development?
I will be doing it the way as it is given in - The RSpec Book .
Thanks in advance .
I want to make a rails project. I am thinking of making it using Rspec and Cucumber.
What I mean is using TDD. Writing tests and then passing it by writing the desired application code .
I think so.
You can use rspec for any ruby code: rails, sinatra, writing a gem and even plain ruby code. But you can use this if you want to work on rails https://github.com/rspec/rspec-rails
I'm not very familiar with cucumber, but if you visit its wiki https://github.com/cucumber/cucumber/wiki , you'll find that it can be used in rails, sinatra, Merb, even with other language

How to run an integration test in RoR with rspec and capybara

I have a good understanding of the differences between unit and intergration tests in RoR in theory. I'm using rspec and capybara to do a lot of testing on my site. What I don't understand is how do you run different tests? If I do
bundle exec rspec
it will run all of my specs in all of my spec folders (model, controller, views, integration, etc). If I want to run an integration test, is it as simple as ?
bundle exec rspec spec/integration
I know there are some differences between these types of test behind the scenes. Specifically this problem (which I also have) has me thinking about unit vs. integration: How to test for a redirect with Rspec and Capybara
What does Rails do differently when running integration tests? The solution posted in the above problem is
Checking for redirect is not supported in rspec-rails request specs,
but is supported in Rails integration tests.
So how do I make one of my tests an integration test? Is it just a matter of putting it in the right spec folder?
As I understand it rspec is designed specifically for unit testing purposes, thus you'll need to use something else for integration testing. The message seems it imply that Rails can do integration tests as well. I don't have any experience or knowledge of testing in rails alone, but I do know of the cucumber gem that is built very well for integration tests.
It has it's own domain specific language and other quirks you'll need to get used to but it should have the capability you're looking for.

Alternative to current Ruby on Rails testing methods?

I find that in order to thoroughly test a Rails application with Rspec I am required to write more test code than actual functional Ruby code. Call me crazy but this does not seems right. Is there a different/alternate approach (even one that is not as comprehensive as Rspec).
For unit testing I guess you won't find any replacement.
But for integration testing, you could create scenarios within your browser thanks to Selenium. See: http://seleniumhq.org/
There are many option available here are the few list
Rspec
Watir
Cucumber
factorygirl
capybara
and many more

How does rspec work with Rails 3 for integration tests?

What I'm trying to ahieve is to do integration tests with webrat in rails3 like Yehuda does with test-unit in http://pivotallabs.com/talks/76-extending-rails-3 minute 34.
an example:
describe SomeApp
it "should show the index page"
visit "/"
body.should =~ /hello world/
end
end
Does someone knows a way to do it?
Have you tried using rspec-rails: http://github.com/rspec/rspec-rails
That is the repository (install instructions in the Readme) for the new RSpec 2.0 which will work with Rails 3.
thoughtbot just published a blog post on this.
Stability can become an issue as web applications evolve and grow — integration tests provide a great way to perform end-to-end tests that validate the application is performing as expected.
— RSpec integration tests with Capybara for end-to-end testing
Support for Rails 3 is coming in rSpec 2, apparently.
ceck this link now it is very simple tu use rspec with rails3
http://github.com/rspec/rspec-rails and you don't need to run script/generate rspec_scaffold like in rails 2.x.x, now you just run rails g scaffold and it will generate the rspec files

Rspec integration tests without cucumber?

Is there a way to do integration tests with Rspec without using Cucumber? I prefer using just plain old Webrat. Thanks.
The latest version of RSpec-Rails (1.2.7) now has integration support. Upgrade then start adding specs to spec/integration or use the 'integration_spec' generator. Configure Webrat in spec/spec_helper.rb and you're set!
We've recently started using RSpec with Capybara over Cucumber. Here is a "beginners" blog post I recently wrote on using RSpec integration tests without cucumber.
End-to-end testing with RSpec integration tests and Capybara
Let me know if you have any questions on getting your system set up.
As far as I know Rspec is perfectly capable of testing views and controllers as part of integration tests. A quick look around the internet shows this article at Robby on Rails on view testing and some of the Rdocs within RSpec might help.
Hope this points you in the right direction - I'm afraid I use cucumber myself.

Resources