News for hackers. Stuff that matters.
Re:Show HN: Open-source alternative to Retool, Internal.io, ... by navaneethpk on Monday June 07, 2021 @09:54AM (#27422626)
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.
Re:Show HN: Open-source alternative to Retool, Internal.io, ... by e12e on Monday June 07, 2021 @11:50AM (#27423982)
> 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