Giter Site home page Giter Site logo

martouta / roar_responder Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 121 KB

Use roar representers with respond_with in a way that you can easily use multiple representers for the same model and for the same controller but without being mandatory.

License: GNU General Public License v3.0

Ruby 100.00%
rails representers responders roar

roar_responder's People

Contributors

martouta avatar

Watchers

 avatar  avatar

roar_responder's Issues

Test all possible scenarios

This gem probably is gonna be done through TDD so I gotta add the tests! ๐Ÿšจ

What matters the most is the actual integration with Rails so it should be mostly integration tests.

DRY (and refactor in general) along the way.

Tasks (tests)

Unit Tests

  • The gem version is present

Integration Tests

Test 'representer_class' for the controller at an instance level (for each action)
  • 'respond_with' for a successful 'GET' request of an entity (Active Record) #12
  • 'respond_with' for a successful 'GET' request of a collection (ActiveRecord::Relation) #14
  • 'respond_with' for a successful 'POST' request of an entity (Active Record) #15
  • 'respond_with' for a failed 'POST' request of an entity (Active Record) #17
  • 'respond_with' for a successful 'GET' request of an entity (Mongo ID) #18
  • 'respond_with' for a successful 'GET' request of a collection (Mongoid::Criteria) #18
  • 'respond_with' for a successful 'POST' request of an entity (Mongo ID) #18
  • 'respond_with' for a failed 'POST' request of an entity (Mongo ID) #18
  • 'respond_with' for a successful 'GET' request of an entity (PORO) #19
  • 'respond_with' for a successful 'GET' request of a collection (Array of PORO) #19
  • 'respond_with' for a successful 'POST' request of an entity (PORO) #19
  • 'respond_with' for a failed 'POST' request of an entity (PORO) #19

Refactor in #20

Test 'representer_class' for the controller at an class level (define representer_class for the class)
  • 'respond_with' for a successful 'GET' request of an entity (Active Record) #21
  • 'respond_with' for a successful 'GET' request of a collection (ActiveRecord::Relation) #21
  • 'respond_with' for a successful 'POST' request of an entity (Active Record) #21
  • 'respond_with' for a failed 'POST' request of an entity (Active Record) #21
  • 'respond_with' for a successful 'GET' request of an entity (Mongo ID) #21
  • 'respond_with' for a successful 'GET' request of a collection (Mongoid::Criteria) #21
  • 'respond_with' for a successful 'POST' request of an entity (Mongo ID) #21
  • 'respond_with' for a failed 'POST' request of an entity (Mongo ID) #21
  • 'respond_with' for a successful 'GET' request of an entity (PORO) #21
  • 'respond_with' for a successful 'GET' request of a collection (Array of PORO) #21
  • 'respond_with' for a successful 'POST' request of an entity (PORO) #21
  • 'respond_with' for a failed 'POST' request of an entity (PORO) #21
  • โš ๏ธ Ensure that it is not inferring the value but actual fetching it from the direct manual definition inside the controller
Test 'representer_class' for the controller being inferred for the model
  • 'respond_with' for a successful 'GET' request of an entity (Active Record) #27
  • 'respond_with' for a successful 'GET' request of a collection (ActiveRecord::Relation) #27
  • 'respond_with' for a successful 'POST' request of an entity (Active Record) #27
  • 'respond_with' for a failed 'POST' request of an entity (Active Record) #27
  • 'respond_with' for a successful 'GET' request of an entity (Mongo ID) #27
  • 'respond_with' for a successful 'GET' request of a collection (Mongoid::Criteria) #27
  • 'respond_with' for a successful 'POST' request of an entity (Mongo ID) #27
  • 'respond_with' for a failed 'POST' request of an entity (Mongo ID) #27
  • 'respond_with' for a successful 'GET' request of an entity (PORO) #23
  • 'respond_with' for a successful 'GET' request of a collection (A Ruby object that acts as a collection of DummyPoro and that responds to 'length' and other enumerable methods perhaps... because a bare Array wouldn't respond to model_name which is necessary here) #26
  • 'respond_with' for a successful 'POST' request of an entity (PORO) #24
  • 'respond_with' for a failed 'POST' request of an entity (PORO) #25

Refactor in #28

Test render a model to JSON with default serializer
  • Test default model.to_json when the inferred representer class does not exist. The resource of this test also does not need to respond to model_name, but apparently, it needs to respond to to_model although that it's not for this gem itself but for one of the dependencies. #29

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.