Code Monkey home page Code Monkey logo

wdi_6_rails_lab_feature_spec's Introduction

Acceptance Testing with Rails and Rspec

Overview

A short description of a system feature.
โ€œ...understandable to customers and developers, testable, valuable to the customer and small enough so that the programmers can build half a dozen in an iteration.โ€ Kent Beck, 2001

Examples:

As a visitor.
I would like to see all movies.
So I can decide what movie to see.

As a visitor.
I would like to create a new movie.
So that I can, eventually, get a rating on a movie.

As a visitor/unregistered user I would like to sign up
So I use all the wonderful features of this app.

As registered user I would like to sign in. So I can manage my movies.

As a signed in user
I would like to be able to add to my set of movies.
So I can rate these movies.

As a signed in user
I would like to be able to rate movies
So that I can share my ratings with other users.

RSpec Feature Specs

  • One way to create acceptance tests for user stories.
  • Treat the application as a black box. With no internal knowledge of how the app implements it features.
  • Interact with the interface and observe results.
  • Outside in testing. Start at the UI implementing each feature/behavior as needed.
  • Cover the data layer with unit/model test then skip up to acceptance tests.

Other ways to create acceptance tests.

Capybara

  • Capybara
  • Browser automation library
  • Simulates a real user.
  • Come with drivers for Rack::Test and Selenium.
  • Javascript support using PhantomJS.
    • Headless browser that can be used to test javascript as well.
    • More on this when we go over javascript.

Lab. Build out the Movie resource (Outside In).

  • Add capybara and launchy gem to the Gemfile.

  • Add a feature spec for viewing movies. Drive the implementation with Behavior Driven Design (BDD)

    • Create a route for movies.
    • Create a controller for movies.
    • Create a movie index action.
    • Create a movie index view. To view all the movies.
  • Add a feature to registering users.

    • Install Devise.
    • Create a feature spec for signing up/registering users.
    • Create a feature spec for signing in/logging in users.

Resources

wdi_6_rails_lab_feature_spec's People

Contributors

tdyer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.