Skip to content

ottsse/voting-app

Repository files navigation

Voting app for interview exercises

This Rails and React application is the starting point for our Voting app interview exercise. You may not need all the various files included to complete the assignment, but they are here in case they help you move faster! Please modify anything you need to in order to meet the requirements and show us your own approach.

Installation

Your development environment should have:

Initialize git, install the application, and initialize the database:

# First, download the zip file, unzip the directory,
# and navigate into the project directory. Then:
git init
git add .
git commit -m "Initial files provided"
bundle install
bundle exec rake db:migrate

# Install JS packages, including React
yarn install

Running the app

bundle exec rails server

Visit http://localhost:3000 in your browser

For asset live reloading, run:

./bin/shakapacker-dev-server

If the assets ever get out of sync, delete /public/packs and restart your Rails server (and your shakapacker-dev-server if it was running).

Running tests

The included test suite uses Rspec and Capybara.

Check out spec/requests/ for example tests.

# Run all tests
bundle exec rspec

# Run one test file
bundle exec rspec <path/to/the/file.rb>

# Run one test case inside a test file
bundle exec rspec <path/to/the/file.rb>:<line_number>

Accessing the Rails console

bundle exec rails console

Debugging

You can open up a debugging console by adding binding.pry anywhere in test or application code.

Example:

def show
  binding.pry
  render json: { data: @my_object }, status: :ok
end

In this example, when the show method is hit during click testing or a test, a debugger will open up in the terminal, where you can inspect values:

@my_object.id
@my_object.valid?

Step to the next line with next. Resume regular code execution or tests with continue.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published