Hacker News new | past | comments | ask | show | jobs | submit login

This looks very interesting... But no tests?

I'm not 100% happy with a project at work, where we're building out a jsonapi from a legacy rails app (part rewrite in-place, part move to react for front-end) - and after setting it up rswag with integration tests generating swagger schemas has been pretty nice. Not quite decided on what I think about activemodel::serializer... But it mostly works, without too much tweaking.

I've also adopted some ideas from:

https://github.com/guillaumebriday/jsonapi-scopes

For filtering/sorting - I think something like it should be in rails, really.

Rswag: https://github.com/rswag/rswag




Rswag looks cool, will try it out. There are tests for rails controllers and I have recently setup Cypress for component testing, will be focusing on tests the coming days.


> There are tests for rails controllers

I only found one:

https://github.com/ToolJet/ToolJet/blob/develop/test/control...

The others appear to be empty scaffolds (which imnho is worse than no tests, really), eg:

https://github.com/ToolJet/ToolJet/blob/develop/test/control...

  require "test_helper"

  class FoldersControllerTest < ActionDispatch::IntegrationTest
    # test "the truth" do
    #   assert true
    # end
  end
Same for empty model tests etc - I'd strongly encourage removing them - as they just add noise.

Btw, if not doing tdd, time is probably better spent on integration tests than controller/model tests. Main challenge I've found with rails projects that were put in use with no tests, is there's a big effort to set up test data/fixtures from scratch. One option can sometimes be to just set up a test database with real data (database dump as a fixture).

> and I have recently setup Cypress for component testing

That's nice, and probably a good focus for a project like this.

Ed: as for mocking/integration testing apis - which might be useful here, there's "vcr": https://github.com/vcr/vcr




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: