background preloader

Rails Tutorial · Devise with RSpec and Cucumber

Rails Tutorial · Devise with RSpec and Cucumber
Devise with RSpec and Cucumber Introduction Ruby on Rails tutorial showing how to create a Rails 3.2 application using Devise with RSpec and Cucumber. Devise provides ready-made authentication and user management. RSpec is a popular framework for unit testing. The combination of Devise, RSpec, and Cucumber is the foundation for many real-world Rails applications. Is It for You? This tutorial is for experienced Rails developers as well as startup founders or hobbyist coders who are new to Rails. Experienced developers will find the complete application on GitHub; this tutorial provides the detail and background to understand the implementation in depth. For Rails beginners, this tutorial describes each step that you must follow to create the application. This is one in a series of Rails example apps and tutorials from the RailsApps Project. This example application uses ActiveRecord and a SQLite database. For more complex applications that use Devise, CanCan, and Twitter Bootstrap, see: Fork Related:  Ruby on rails

Open Source Rails RailsApps/rails3-devise-rspec-cucumber Better Specs arantius/resurrect-pages RSpec Best Practices Click here to view the complete list of tools reviews This article was originally published in the Spring 2011 issue of Methods & Tools RSpec Best Practices Jared Carroll, Carbon Five, RSpec is a Behavior-Driven Development tool for Ruby programmers. Web Site: tested: 2.5License & Pricing: MIT License, open source / freeSupport: Community RSpec is a great tool in the behavior driven design process of writing human readable specifictions that direct and validate the development of your application. First #describe What You Are Doing Begin by using #describe for each of the methods you plan on defining, passing the method’s name as the argument. describe User do describe '.authenticate' do end describe '.admins' do end describe '#admin?' Then Establish The #context Next use #context to explain the different scenarios in which the method could be executed. For example, the following method has two execution paths: Lose The Should Before:

#275 How I Test Here I show how I would add tests to the password reset feature created in the previous episode. I use RSpec, Capybara, Factory Girl, and Guard to make request, model, and mailer specs. Download: source codeProject Files in Zip (92.2 KB)mp4Full Size H.264 Video (26.4 MB)m4vSmaller H.264 Video (16.1 MB)webmFull Size VP8 Video (18.1 MB)ogvFull Size Theora Video (37.8 MB) Offres d’hébergement Ruby on Rails Ruby on Rails est un Framework basé sur le langage de programmation Ruby. Il est spécialement conçu pour des développements rapides et articulés sur la méthodologie Agile. Le principe de Ruby est de privilégier les conventions plutôt que les configurations. De plus en plus utilisé dans la création de sites internet et d’applications web, l’utilisation de Ruby on Rails implique un hébergement plus spécifiques et disposant entre autres des librairies Ruby. Pour votre Hébergement Ruby on Rails et la production de vos applications Rails, Railsprod vous propose trois offres mutualisées disposant de Ruby on Rails. Votre hébergement Ruby on Rails à la carte… Espace Disque : 500 MoBase de données : 100 MoEnvironnement : ProductionBackup quotidien : non inclusTrafic : illimitéAccès shell : inclusGems : incluses *Frais d’installation : inclusSouscrire * Sous réserve d’approbation du support technique. Besoin d’une solution de gestion de projets ?

How I Test In a recent discussion on Google+, a friend of mine commented, "Test-Driven Development (TDD) and Behavior-Driven Development (BDD) is Ivory Tower BS." This prompted me to think about my first project, how I felt the same way then, and how I feel about it now. Since that first project, I've developed a rhythm of TDD/BDD that not only works for me, but for the client as well. Ruby on Rails ships with a test suite, called Test Unit, but many developers prefer to use RSpec, Cucumber, or some combination of the two. RSpec From the RSpec site: RSpec is a testing tool for the Ruby programming language. RSpec provides a powerful DSL that is useful for both unit and integration testing. Cucumber I've found the benefits of TDD/BDD far outweigh the cons. Cucumber is an integration and acceptance testing framework that supports Ruby, Java, .NET, Flex, and a host of other web languages and frameworks. The Setup Let's first begin a new project, instructing Rails to skip Test Unit. Our First Feature

RSpec | PeepCode Screencasts ▶ We’ve been acquired by Pluralsight! ▶ Upgrade your account to Pluralsight ▶ More details… Filter by tag: Ruby on Rails · Ruby · Javascript · Play by Play · Unix · RSpec · Deployment · Pdf · Design · Cocoa · iPhone · Node · Databases · Productivity · Git RSpec 2: with Rails 4 and Ruby 2 (Part 3 of 3) RSpec 2: Tools (Part 2 of 3) RSpec 2: The Basics (Part 1 of 3) Use the Cucumber RSpec Controllers and Tools RSpec Mocks and Models RSpec Basics Ruby on Rails - Blogueur - Guillaure Barillot Selenium is a great tool for integration testing but it has two major drawbacks : it relies on Firefox engine, so every time Firefox updates, you have to cross your finger and praise your test suite will still be usable it is f**** slow Solve those 2 problems in just a few minutes, switch to [...] When it came across image manipulation using Rails, I had to make a choice : Paperclip to handle high traffic/popular websites, and DragonFly for privates, more confidential but also more evolutive applications. Let’s start with an example : # Paperclip typical image URL /system/pictures/877/thumbnail/my_thumbnail_image_name.jpg?1352719049 # DragonFly image URL /media/BAhbB1sHOgZmIjIyMDEyLzA5LzE0LzE3XzI0XzA0XzMyMl9BdXLDqWxpZV9DSEFVVkVBVS5KUEdbCDoGcDoKdGh1bWIiCjUweDUw Paperclip resizes the image on upload, then [...] C’est assez étonnant d’avoir encore ce genre de problème de nos jours, mais Ruby (même 1.9.3), ne gère toujours pas correctement les passages de caractères accentués en majuscule.

Digesting Rails: BDD with RSpec | Robert Lysik I’ve now progressed through the first six chapters of the Ruby on Rails Tutorial and my head is spinning. I feel like Keanu Reeve’s character from the 90′s b-movie Johnny Mnemonic. Before I proceed, I thought I’d take some time to digest what I’ve learned and do a little research into aspects that I’ve found somewhat inscrutable, which are legion. Where to start? I’m somewhat intrigued by the idea of Test Driven Development, or in the case of the Ruby on Rails tutorial its variant which is described as Behavior Driven Development. Behavior Driven Development Behavior Driven Development or BDD is a framework for unit testing of software that seeks to rephrase test cases using more natural language. RSpec RSpec is a Behavior Driven Development tool for Ruby inspired by the work of Dan North and JBehave. A Simple Example The Ruby on Rails Tutorial contains an excellent overview of BDD and RSpec and interweaves testing using RSpec throughout each chapter. So, what’s up with “it?” Voila!

Documentation for rspec-rails (2.12.2) rspec-rails is a testing framework for Rails 3.x and 4.x. Use rspec-rails 1.x for Rails 2.x. Installation Add rspec-rails to both the :development and :test groups in the Gemfile: group :development, :test do gem 'rspec-rails', '~> 2.0'end Download and install by running: bundle install Initialize the spec/ directory (where specs will reside) with: rails generate rspec:install To run your specs, use the rspec command: bundle exec rspec bundle exec rspec spec/models bundle exec rspec spec/controllers/accounts_controller_spec.rb Specs can also be run via rake spec, though this command may be slower to start than the rspec command. In Rails 4, you may want to create a binstub for the rspec command so it can be run via bin/rspec: bundle binstubs rspec-core Generators Once installed, RSpec will generate spec files instead of Test::Unit test files when commands like rails generate model and rails generate controller are used. You may also invoke invoke RSpec generators independently. Model Specs Upgrade note

Data Scraping and More With Ruby, Nokogiri, Sinatra and Heroku | Hunter Powers In this article, you will learn the basics of scraping and parsing data from websites with Ruby and Nokogiri. You will then take this information and build a sample application, first as a command line tool and then as a full Sinatra web app. Finally, you will deploy your new application on the heroku hosting platform. There is a screencast that accompanies this article. Data scraping is the process of extracting data from output that was originally intended for humans. Nokogiri is a Ruby Gem that extracts data from web pages using CSS selectors. Let’s look at an example: In this page, there are three bits of interesting information: price, time, and inventory status. The above example is very simple, but hopefully gets the point across about how you can target content for extraction using CSS selectors. The 9:30 club is a music venue in DC. What we need is a way to target all concerts. Let’s take it a step farther and turn our app into a full Sinatra application.

Ruby for Newbies: Testing with Rspec Ruby is a one of the most popular languages used on the web. We're running a Session here on Nettuts+ that will introduce you to Ruby, as well as the great frameworks and tools that go along with Ruby development. In this episode, you’ll learn about testing your Ruby code with Rspec, one of the best testing libraries in the business. If you’ve read my recent tutorial on JasmineJS, you’ll probably notice several similarities in Rspec. It’s pretty easy to install Rspec. That easy. Now, let’s set up a small project. Here’s what your project directory should look like: We put the specifications (or specs) in a spec folder; we have one spec file for each class. (Have you met require_relative yet? You may not be familiar with the YAML module; YAML is a simple text database that we’ll use to store data. So, now that we’re all set up, let’s get cracking on some specs! Let’s start with the tests for the Book class. This is how we start: with a describe block. Moving on, Here’s our first test.

Related: