-
Notifications
You must be signed in to change notification settings - Fork 7
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
Improve testing modes #26
Conversation
The stub client, used in the fake testing mode, currently doesn't work as it's defined as only taking one argument, but in reality this method should accept two. Rather than hard coding the two arguments, I've defined it to accept any number of arguments. I've also added a test to avoid this issue from coming up again. I think it was 02dc49c which introduced this bug when using the fake testing mode.
This will mean users of this library have a better understanding of the testing modes available and how to use them.
This changes the way we disable DfE Analytics in our tests by using the built-in DfE Analytics fake testing mode. Note that this depends on DFE-Digital/dfe-analytics#26.
This changes the way we disable DfE Analytics in our tests by using the built-in DfE Analytics fake testing mode. Note that this depends on DFE-Digital/dfe-analytics#26.
it 'does not go out to the network' do | ||
request = stub_analytics_event_submission | ||
|
||
DfE::Analytics::Testing.fake! do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block isn't necessary as it's the default state, set in the body of the Testing
module (also a la sidekiq) — could rename spec and/or add something to the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's true that this is default, but I wanted this test to be explicit in case that changes in the future. It's clear that whatever might change around this test, we're at least using the fake
testing mode in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I'm with you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @thomasleese!
This changes the way we disable DfE Analytics in our tests by using the built-in DfE Analytics fake testing mode. Note that this depends on DFE-Digital/dfe-analytics#26.
This changes the way we disable DfE Analytics in our tests by using the built-in DfE Analytics fake testing mode. Note that this depends on DFE-Digital/dfe-analytics#26.
This makes two changes to the built-in testing modes to make them easier to use:
fake!
currently doesn't work as the stubbedinsert
method has the wrong signature.