Git Product home page Git Product logo

wdi_7_rails_lab_ajaxify_hacker_news's Introduction

AJAXer News

This repo is a copy of the example branch from the Week 4 Hacker News project. It includes a full set of feature tests.

Your task is to "AJAXify" the process of submitting a new comment (i.e. it should not cause a new page load), while keeping the rest of the app the same. All feature tests should still pass! Make sure you're inserting the new comment at the correct position in the list, given that comments are sorted by score.

To allow our feature tests to use JavaScript, we'll need to make some changes. These have already been made in this repository (and in the player tracker demo you should be using as a reference for setting up TDD Rails projects), but they are listed here for reference.

Setup

  1. Install PhantomJS (one-time, like installing Postgres)
  • Mac: brew install phantomjs
  • Ubuntu: sudo apt-get install phantomjs
  1. Install Poltergeist
  • Add gem 'poltergeist' to the :test group in the Gemfile
  • In rails_helper.rb, add: require 'capybara/poltergeist'
  • In rails_helper.rb, add: Capybara.javascript_driver = :poltergeist
  • Ensure database_cleaner is configured to use truncation for specs tagged :js (our standard configuration file at spec/support/database_cleaner.rb already does this)
  1. In user_creates_comment_spec.rb, change context 'when signed in' do to context 'when signed in', :js do. This tells RSpec to run the tests within this block using the configured Capybara.javascript_driver instead of the default driver. Run rspec and you should see all the tests still passing.

wdi_7_rails_lab_ajaxify_hacker_news's People

Watchers

James Cloos avatar Max Kohl 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.