Integration Tests
Integration tests are tests that ensure a subset of application layers (but not in entirety) is behaving as expected.
Integration tests may test application behavior against data persisted in a database, or against a particular set of interactions against a third-party API.
Example
require "rails_helper"
RSpec.describe UpcomingEventsQuery do
it "calculates count" do
create_list(:event, 5, :upcoming)
create_list(:event, 5, :past)
expect(UpcomingEventsQuery.new.count).to eq(5)
end
it "returns the right values" do
upcoming = create(:event, :upcoming)
create(:event, :past)
expect(UpcomingEventsQuery.new).to match_array([upcoming])
end
end