Skip to main content

Unit tests (in progress...)

When write tests?

  • New feature comes
  • Bug fixes
  • Refactor existing feature

How to install test_db locally

Rspec uses test db for test purposes also this way is saving you local db against some mock/wrong data when tests has been running

Related docs:

Directory structure

All tests are in spec folder. More info about it here

Our structure now:

Run scripts

Run all test cases

$ rspec

Run specific test by file name

$ rspec spec/your/path/to_file_name_spec.rb

Run specific test case by line number. e.g. below you wanna run only the "to the User" test case.

$ rspec spec/your/path/to_file_name_spec.rb:2
  context "Send an trial email" do    it "to the User" do      is_email_reached = Platform::PlatformTrialMailer.new.send_mail({        to: [@current_user.email],        subject: "Testing Trial Emails",        from: "[email protected]",        message: "User:#{@current_user}".to_s.html_safe      })      expect(is_email_reached).to eq(true)    end  end