Giter Club home page Giter Club logo

olio-test's Introduction

README

This is a Ruby on Rails application produced as a possible solution to the coding task described here.

Please ensure your system has the proper prerequisites installed. These are:

  • Ruby version 3.1.2
  • SQLite3

Getting started

  1. Clone this repository, and switch to the new directory
$ git clone [email protected]:kierandenshi/test-app-rails.git
$ cd test-app-rails
  1. Install required Ruby gems
$ bundle install

This application uses the following additional gems to support testing and development: rspec-rails, factory_bot_rails, shoulda-matchers, webmock, rubocop, rubocop-performance, rubocop-rails, rubocop-rspec.

  1. Prepare the database
$ bundle exec rails db:create
$ bundle exec rails db:migrate
  1. Start the application
$ bundle exec rails server

Then you can visit the application in a browser at http://localhost:3000. Rails will log output directly to the terminal. Use ctrl+c to stop the server at any time.

Rails will bind to IP 127.0.0.1 and port 3000 by default. If these defaults do not suit your system, you can specify a different IP and port to bind to using the -b and -p switches - example: bundle exec rails server -b=0.0.0.0 -p=4000

Application files

In keeping with the Rails principle of convention over configuration, the application's files live inside the /app directory. Following MVC, sub-directories of interest (for this application) are controllers, models, services, and views. Routes are defined in /config/routes.rb.

Unit tests and linting

This application uses:

  • RSpec for unit tests. The files that contain unit tests can be found in the /spec directory.
$ bundle exec rspec
$ bundle exec rubocop

Some of the default rules relating to next line indentation have been disabled to suit personal preference. These can be re-enabled by updating the root level configuration file .rubocop.yml

TODO / Improvements

Rate limit data fetching

Data required for functional display is persisted locally so it is not necessary to perform a fetch each time the application receives a request. Simple rate limiting could be implemented by locally storing and checking a timestamp value before performing fetches.

Refactor likes

The "like" functionality could be improved. Using a dedicated controller and model could improve routing, and polymorphic associations would allow the like function to be used with additional models should the application grow. Full page reloads when using the "like" links could be avoided with use of Hotwire, or some client side Javascript.

Improve test coverage

  • More/better unit testing, particularly controller tests.
  • Automated browser testing to test actual page rendering and interactions.

olio-test's People

Contributors

kierandenshi avatar

Watchers

 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.