How to create Rails App using cucumber - ruby-on-rails

I am new for cucumber. I want to create on sample application using cucumber.
I am working on Windows 7 OS. Can any one guide me?
Thanks.

I think these are two separate problems:
Building a Rails application on Windows
Building a Rails application with Cucumber (using principles promoted by Cucumber like BDD, Specification by Example and an outside-in workflow)
Building a Rails application on Windows
There are a lot of tutorials, best starting point is probably: Getting Started with Rails on Rails Guides.
However the official advice there is using a virtual machine with Linux :-)
Here is a good thread with advice for running Rails under Windows.
Building a Rails application with Cucumber
An extraordinary example for this is the Book Rails 3 in Action by Manning.
This book really excels at showing how to create an application outside-in with Specification by Example using Cucumber.
In each chapter of the book a new feature is implemented. There are almost no screenshots explaining those features. Instead the authors are using Cucumber scenarios at the beginning of each chapter to exactly specify the desired new behavior that is the topic of given chapter. Then they are showing and explaining the necessary steps and the code that is needed to implement the functionality.
This is the best example I have found for using Cucumber with Rails so far.
This is also a really great example how Specfication by Example can be used for building a shared understanding - since teaching is all about sharing understanding.
However the scenarios in the book are quite focusing of specifying behavior on the UI level ... which is not commonly agreed on being best practice. But for teaching Rails it is great.
Rails 3 in Action is still in the early access program. I don't know where the official sources are.
But when you search on GitHub you already find different implementations of the example application (Tiketee):
https://github.com/rubykr/ticketee
https://github.com/oMartell/ticketee-rails-3-in-action
https://github.com/rails3book/ticketee

Here is the guide how to do it.

I found an interesting webcast video that does just this.
The basic procedure is define a couple features in cucumber. (actually the gherkin language)
Run cucumber
Fix errors
Repeat the
2 steps until you have a
working app.
It makes use of a few RoR gems like webrat and rspec.
http://railscasts.com/episodes/155-beginning-with-cucumber

Related

Ruby on Rails examples for testing

I'm learning Ruby on Rails at the moment.
Being a tester by profession (JMeter, Selenium etc.), I'd like to know if there any good example Ruby on Rails projects that I can run for the purposes of trying out JMeter and Cucumber and other Load and Functional test tools.
The kind of thing that just does stuff like signs up users, books tickets for something or other, does searches... has admin functions...
Not important exactly what, just that it's relatively easy to install, and it gives me a good chance to exercise JMeter and Web Driver.
Might be nice if it:
1) Uses RoR best practices to help me learn
2) PostgresQL DB
3) Bootstrap framework
Any ideas?
Cheers,
Tim

Railstutorial : which parts of the app to upgrade first?

After finishing with Rails Tutorial by Michael Hartl, which parts of the sample app proposed in tutorial should I upgrade first? Authentication method comes to mind first..
Given the huge popularity of that tutorial, I suppose there is something like a list of steps to be taken for that app to become more up-to-date in this ever changing world of web dev etc. etc. etc.
Overall is it a good idea to use that app as a foundation for building something more advanced?
Thanks in advance!
I learned Rails with that book :)
However, even the authentication algorithm used there is great to learn, in practice you can use other alternatives. For example I use the wonderful Devise gem (Railscasts 209 and 210).
There are some ideas at the end of the book that explain how you can extend the application. However, I think that building your own app from scratch is better now that you know how to do it.
After reading that book, I created some basic projects, and in parallel started reading The Ruby Programming Language and The Rails 3 Way.
Hope it helps! Welcome to the Rails world :)

Extracting a Rails application into a plugin or engine

I have a Rails 2.3 application which I would like to extract into a plugin, or engine. The application has user authentication, and basic cms capabilities supported by ancestry plugin.
I want to extract the logic for the application into a plugin/engine so that I can use this code for future projects, with a different "skin" or "theme" if required.
I'm not entirely sure I actually understand the difference between plugin and engine concepts, so that would be a good first point.
What is the best approach, are there any good starting points, links, explanations, examples that I should follow. Also, with the release of R3 to consider, is there anything that I should be aware of for that, with regards to plugins etc.
I am going to start off by watching Ryan's http://railscasts.com/episodes/149-rails-engines
but obviously thats over a year old now, so one of the challenges I'm faced with is finding the most up to date and relevant information on this subject.
All tips and help gratefully received.
Actually, converting an application is pretty straigtforward. Just create a plugin-folder, put an app-folder inside containing all yor model-views-controllers folders, and that's it.
You will have to manage your migrations yourself though. Also you have to define rake-tasks to copy files to your public folder. I think the railscasts is still pretty up-to-date, if anything it is now easier in rails 2.3.
Good luck!
[EDIT: for rails3] Rails 3 engines are very clean and powerful. Check this gist by Jose Valim.
You will probably be better off focusing your engine on Rails 3, as opposed to trying to make it compatible for Rails 2 and Rails 3, due to the backwards incompatible changes. Here is a more up to date tutorial for Rails 3
also the book "Crafting Rails applications" by Rails Core member Jose Valim, has a good chapter on it. Int he shows how to use his tool EngineX which generates a Rails 3 engine structure, so you can more easily create engines for your Rails 3 projects. His gem devise is also a rails engine which is also nice, because you can easily customize it by copying the templates into the application directory, and allowing you to subclass the controllers that you want to customize more.
Writing a plugin is an entirely different process than writing an app, if you already have your app code it should be straightforward converting it into a plugin.
Consider that if you use third-party plugins in your app it could get pretty messy.

Rails - Any plugins for building a online quiz/test?

I'm trying to add some online tests to my site and before I rolled up my sleeves I was wondering if there is any ruby on rails plugin support for such a task.
Essentially I'm looking for something that lets me add multiple choice questions. Performing the scoring logic would be an added bonus.
Any one know of anything?
Ryan Bates has a screencast on nested model forms where the example app is a survey tool You could use it as a starting point.

Concept of, Framework for , How to Test View of MVC (Ruby on Rails)

I am now doing the UI from fresh so I want to make it fully test.
Could anyone suggest the correct way to do this and where should be the good place to start?
such as Concept, Framework.
(I already know some concept of testing)
Maybe Selenium can help you with frontend testing.
Take a look at The RSpec Book. The book goes over much more than just using RSpec (the testing framework). It also delves into the methodology of BDD (Behavior-Driven Development) starting from testing the UI using a tool like Cucumber all the way down through the rest of the Rails stack. It's probably the best book on the entire subject for practical testing in Rails right now. Most of the concepts in the book will apply to other languages and technologies as well
Try the Cucumber site. The site has a bunch of documentation and videos to get you started.
Watir may be useful as a tool and there are various tutorials out there for it.

Resources