BDD with Ruby on Rails using RSpec 3 and Capybara

Use Behavior Driven Development to build feature rich Ruby on Rails web apps using Rails 4.2, Rspec 3 and Capybara
4.1 (162 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
2,642 students enrolled
Take This Course
  • Lectures 103
  • Length 13 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 8/2015 English

Course Description

Behavior Driven Development (BDD) with Ruby on Rails using RSpec and Capybara provides a thorough introduction to using BDD to building web applications using the popular Ruby on Rails framework. Why BDD to build web applications? The advantages are numerous, and Feature specs used extensively in BDD read like plain English which allows end users and developers to easily communicate with each other using BDD tools. In addition, it is easy for the end users to write the features themselves.

This course is designed for students who have some Ruby on Rails or web application development experience who want to take their skills to the next level but have no or limited experience in BDD or automated testing.

Why should students currently enrolled in the Professional Ruby on Rails Developer or already with some Rails experience take this course?

- Behavior Driven Development is the focus of this course!

- RSpec and Capybara experience for automated testing is necessary as a rails developer, covered thoroughly in this course!

- Emulating browser based user behavior to complete a business process from beginning to end, covered thoroughly in this course!

- Big resume booster, knowledge and usage of RSpec and automated testing is very important, most of the Rails community uses this!

- Complete coverage in terms of features, ALL features are built on basis of automated testing specs, not just selective features

- Building two complex and functional web apps including the featured workout web app in 1 course!

Tip: Most rails syntax (not complex) will not be explained, therefore students are expected to know basics like naming conventions and .each method etc. However, all features and BDD steps will be explained.

Some other key aspects of this course are:

- 99 lectures!

- Rails 4.2 using cloud-based IDE

- Working with external javascript libraries for charts and date pickers

- Migrations, one-to-many and many-to-many associations

- much, much more!

What are the requirements?

  • Students who are currently enrolled in or have completed the "Professional Ruby on Rails Developer" or have equivalent experience and/or understanding in Rails should take this course
  • A browser and internet connection
  • No prior BDD or testing experience necessary
  • Students with a basic understanding of Rails syntax and MVC structure and have ability to understand basic code

What am I going to get from this course?

  • Build robust web applications using Ruby on Rails complete with test suite
  • Use Behavior Driven Development (BDD) to develop code
  • See web applications from a user perspective and emulate user behavior on the browser
  • Think of the business process goals or functions and then approach building features

Who is the target audience?

  • All students currently enrolled in my "Professional Ruby on Rails Developer" course should take this course to expand their web development skillset and learn to build more web apps using Rails
  • Programmers who know Ruby on Rails or other web development framework but want to learn Behavior Driven Development and emulate user behavior
  • Students who are interested in becoming professionals in the Development world and want to learn how to speak to business units in terms of business requirements
  • Students who want to learn using RSpec and Capybara
  • Who should NOT take this course: If you are an absolute beginner to web application development and have no experience with Rails or are not currently enrolled for my Rails course should not take this course

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Introduction: Up and running with Ruby on Rails 4.2 using cloud based IDE

Introduction to the course


Discuss course structure and the apps built using feature tests in the course, what is covered and helpful tips to use throughout the course.


Discuss difference between lectures 4 and 5 in setting up a development environment using cloud based IDE vs a local development environment


Update on development environment and free IDE's


Set up free online development environment using one of the leading providers of IDE's.


If students want to setup their own local development environment and are using Mac's, they may walkthrough the process using this video. Note: the course prefers nitrous IDE due to fast and issue free setup.


Get comfortable and customize cloud-based IDE, run rails server and wrap up Section 1


Optional: Use cloud9 as the IDE intstead of nitrous


Optional: Use koding as IDE instead of nitrous

Section 2: Testing and Setup

Learn about the Model-View-Controller structure of Ruby on Rails web applications.


Discuss the different types of testing used in application development. Learn about RSpec testing framework


Learn how to start a new Rails application without using the default testing framework that comes built in.


Setup an account at Github which is an online code repository and add the SSH key of the IDE to it so code can be pushed to the repo without having to log in every time.


Create a repository for the blog app code on Github and push the code from local IDE to the repository to store it and wrap up Section 2.

Section 3: Build Feature Tests - BDD

Add RSpec and Capybara to the application so they can be used for feature specs and any other testing needs.


Learn how to use git branch feature and use the feature branch to build the create article feature test.


Setup Bootstrap for ease of front-end development (UI) and add navigation and messages to the application


Setup ability to add new article through the browser and create route.


Code for the new template


Complete the create action necessary to handle new article submissions.


Add Guard to the application so tests will run automatically when changes are made to the code without needing to trigger rspec command.


Learn to use Guard and ensure it runs. Fix a minor bug that was introduced during the setup of Guard.


Learn to add validations so restrictions can be enforced on the models, in this case articles.


Discuss the difference between Flash and


Build the listing articles feature for the web app.


Build the showing articles feature for the web app.


Edit the default setup of guard by manipulating the code in the Guardfile to work the way best fits for building the application.


Build the editing articles feature for the web app.


Build the deleting articles feature for the web app.


Refactor the code in the new and edit templates to extract away the redundancy and repetition of code.

Section 4: User Management

Introduction to the User model and how users will be used and implemented in the application.


Install Devise, which is a popular user management gem, in the application to allow the application to handle users.


Create a model for User and also implement the user signup feature for when users are signing up to use the application.


Learn how to install and update Devise views.


Learn how to fix a view after it's created.


Build the ability for users to sign-in or log in to the application.


Customize views and learn how to create partials


Build the ability for users to sign-out of the application


Link articles to users to build the first association between the two models.


Look at the app from the UI and ensure everything is working as expected, add some additional styling and learn how to clean up branches that have been merged back to master.


Restrict access to new, edit and delete buttons based on feature requirements.


Enforce restrictions in the controller for a second layer of protection.

Section 5: Comments feature - nested routes

Build the ability for signed in users to add comments to articles.


The articles/show.html.erb template document in text format


Complete the working implementation of the comments feature for the application.


Homework project to deploy the application to production using an online hosting service called Heroku.

Section 6: Workout App - User Management

Introduction to the workout app and preview the completed app


Start a new Rails Project named workout_app and ensure it's built without the default mini-test testing framework.


Video solution to creating a new workout_app project without mini-test


Homework assignment for students to apply what they learnt in the blog app and create the first homepage feature spec for the workout app.


Solution to creating homepage feature spec.


Apply what was learnt in the blog app to add guard to the application


Solution for how to add guard to the application to automate the running of tests.


Create the application's homepage and add bootstrap to the application for front-end styling.


Template for application.html.erb file prior to updates made during the video lecture for creating homepage on lecture 51.


Add devise to the application for user management.


Homework assignment for students to apply their knowledge and create a user signup feature spec.


Solution for the user signup feature spec.


Build the user signup feature of the application so users can signup to use the application.


Apply the knowledge of feature specs acquired while building the blog app to create a spec for user sign in.


Solution for user sign in feature spec.


Build the user sign in feature of the application so users can sign in to use the application.


Apply knowledge acquired while building the blog app to create a feature spec for signing users out.


Solution for user sign out feature spec.


Build the user sign out feature of the application so users can sign out of the application.


Update the signup and new form templates so they look good.


Document templates for the sign up and new views.


Override the devise_error_messages! method that comes by default with devise.


Code for devise_error_messages! method


Create form partials to clean up the application.html.erb file and group them to header and main.


Restrict access to links in the application based on specs and wrap up section 6.

Section 7: Exercise Management

Introduction to exercises and build valid exercise feature spec.


Build routes for exercises and exercises controller.


Build the exercise model and one to many association with user.


Build ability to create new exercises, update the user model and create the _form.html.erb partial


Text document containing code used in the form partial (_form.html.erb)


Build the show action.


Text document containing code used in show.html.erb


Create invalid exercise feature test and use it to build the validations used for the exercise model.


Add datepicker to the application so users can select workout dates from a pretty user interface.


Build the listing workouts feature for the application.


Adding graphs to exercises listing page for users by using the morris.js and raphael.js javascript libraries.


Text document with code used in the exercise.js file


Implement the editing workouts feature of the application.


Implement the delete workouts feature, cleanup specs and wrap up Section 7.

Section 8: Working with Users

Introduction to the users listings section and fix a bug associated with flash message displays.


Implement feature where all users who are using the app are displayed on the homepage.


Add first name and last name to users, till this point they were identified by email address only.


Enforce additional validations for the user model, namely user names.


Add pagination to the application to beautify and organize user listing views. Only 10 users displayed per page.


Implement the search user by username feature so users can search other users registered for and using the application.


Code for method newly created in the application during the search implementation.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Mashrur Hossain, Technology Professional and Entrepreneur

Hi, I'm Mashrur, I have been a technology professional for over a decade and have degrees in Computer Science and Economics

I have worked with Enterprise Software Systems throughout my career with roles played in analysis, development and management. I lead projects using both agile and waterfall methodologies and am well versed in the inner workings of the software development and delivery world.

During my career, I've realized how much I enjoyed training new hires and new team members and helping them succeed. I've dedicated a good amount of time over the last 7 years on-boarding new analysts and developers and working with them to build and maintain systems which puts me in a very unique position of knowing what new entrants to a field or subject need to succeed. I strongly believe in a focus on fundamentals and practice and not in shortcuts or gimmicks.

I'm very passionate about web application development and I prototype and build web apps in entrepreneurial pursuits. Ruby on Rails has proven to be a very strong force in this field and is especially powerful for startups looking to prototype ideas rapidly and subsequently building on that platform as the ideas catch on.

So join me for my comprehensive Ruby on Rails Developer courses as I guide you through the world of web application development using Rails and bringing your ideas to life.

Instructor Biography

Emmanuel Asante, Mining Software Developer and Freelancer

I studied mining engineering and information systems. I completed a Diploma in Datametrics at the University of South Africa with a specialization in Information Systems.

Whilst working in the mines, I developed various mining, rock mechanics and geological applications using languages ranging from Perl, Turbo Pascal to C#, Java and Ruby. In particular, I developed a mining production information management system, as well as a pit crew performance management system, both for Thompson Creek Metals (Endako Mines), and a client management application for Snowden Mining Industry Consultants, using Ruby on Rails. I currently do freelance web development in Ruby on Rails.

Ready to start learning?
Take This Course