Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to run ServiceSpecs with both InMemory storage and Postgres #138

Closed
wants to merge 1 commit into from

Conversation

stanch
Copy link
Contributor

@stanch stanch commented Sep 8, 2023

I needed this to get more confidence in the changes from #137. I’ll rebase that one on this one and add more tests.

Copy link
Contributor

@spenes spenes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

def sendRequestsGetResponse(
createService: Storage[IO] => HttpRoutes[IO]
)(requests: List[Request[IO]]): IO[Response[IO]] =
storageResource.use { storage =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it seems like we can implement it using sendRequestGetState. It would reduce the deduplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it could! The number of variations of these methods across the different files was already big, so I tried to make minimal changes... We probably don’t even need both methods.

class ValidationServiceSpec extends org.specs2.Specification {
class ValidationServiceSpec extends org.specs2.Specification with StorageAgnosticSpec with InMemoryStorageSpec {
def sendRequests(requests: List[Request[IO]]) =
sendRequestGetState(storage => ValidationService.asRoutes(storage, None, SpecHelpers.ctx, createRhoMiddleware()))(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It seems like we don't use the state part at all. Can sendRequestsGetResponse be used instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in its current version as it only returns the first response :/

@spenes
Copy link
Contributor

spenes commented Oct 16, 2023

Moved to here

@spenes spenes closed this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants