-
Notifications
You must be signed in to change notification settings - Fork 49
Adds support to Verify emails, fixes verify_delete
method
#62
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
Conversation
The client tried to instantiate a Verify object from the delete request but the response is empty. Response body is nil and doesn't respond to `.empty?`. Sending the request directly instead.
- Fixes examples - Adds VerifyEmailMessage entity - Adds `verify_email_message` method to client
verify_delete
methodverify_delete
method
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.
Added a few comments and questions 👍
|
||
def created_datetime=(value) | ||
@created_datetime = value_to_time(value) | ||
end | ||
|
||
def valid_until_date_time=(value) |
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.
Isn't a breaking change? Why it's necessary?
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.
Hey @jalerson, the gem generates the attribute names based on the response from the API, and it converts camelCase
to snake_case
.
The response from the server contains the validUntilDatetime
key, therefore the valid_until_date_time
attribute breaks.
It is a breaking change that fixes a broken gem, and this is a major release as well, so I think it fits.
@@ -2,6 +2,6 @@ | |||
|
|||
module MessageBird | |||
module Version | |||
STRING = '2.0.1' |
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 MR is only introducing new features to the gem, which is a minor upgrade. Why we're doing a major upgrade here?
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.
See #62 (comment)
@@ -1,42 +1,56 @@ | |||
# frozen_string_literal: true | |||
|
|||
describe 'Verify' 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.
I understand if you want to keep the test structure consistent with the other tests, however, rspec is such a powerful testing framework to write expressive tests, so I'd recommend:
- use
describe
to describe features - use
context
to describe the feature in different situations/contexts - use
it
to specify expectations (oneit
perexpect
)
For example:
describe 'Verify an email OTP' do
context 'using an existing OTP' do
...
it 'has the ID verify-id' do
expect(verify.id).to eq 'verify-id'
end
it 'has the verified status' do
expect(verify.status).to eq 'verified'
end
end
context 'using a non-existing OTP' do
it 'raises an error' do
expect { @client.verify('verify-id') }.to raise_error(MessageBird::ErrorException)
end
end
context "<insert here any other scenario>" do
...
end
end
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.
Agreed, too late 😆 .
For the topmost describe
block I usually prefer to use the class I'm testing, it gives me an instance of the class in the subject
variable already to be used in the examples, and I can access it in some magic ways:
describe Array do
context "new instances" do
it "should be empty" do
expect(subject).to be_empty
end
# or magically
it { should be_empty }
# or
it { is_expected.to be_empty }
end
end
Just found it's too late for my review 😅 |
Adds support to Verify emails
Added the VerifyEmailMessage entity
Adds example of Verify email
Sets version 3.0.0-rc.1
Fixes
verify_delete
The client tries to instantiate a Verify object from the delete request but the response is empty.
Response body is nil and doesn't respond to
.empty?
.Sending the request directly instead as other
*_delete
methods.