-
Notifications
You must be signed in to change notification settings - Fork 472
api: added create and update methods to registries #1663
Conversation
This is not really api but since you've already created the services objects, it's much easier to move them to grape later. |
Coverage failed :( |
I have created the API endpoints 😕 |
For some reason I didn't see the update in the |
12dc8d3
to
94d4e56
Compare
@vitoravelino tests are passing |
def check_uniqueness! | ||
return unless Registry.any? | ||
@valid = false | ||
@messages[:status] = "You can only create one registry" |
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.
Is status
the best name? We were using field names but in this case it's not related to a field. Just wondering...
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 didn't know how to name it... Maybe uniqueness
? or limit
? or instances
?
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 think uniqueness
is fine. What do you think?
expect(resp["errors"]["status"]).to eq("You can only create one registry") | ||
end | ||
|
||
it "returns an error un unreachable registry" 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.
un
?
expect(reg.name).to eq(just_name[:registry][:name]) | ||
end | ||
|
||
it "returns an error un unreachable registry" 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.
un
?
expect(resp["errors"]["hostname"]).to eq("Registry is not empty, cannot change hostname") | ||
end | ||
|
||
it "allows to update if there are repositories and you don't speak about the hostname" 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.
... and you don't change/touch the hostname
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.
👍
Just need to fix/improve the naming and typos.
Signed-off-by: Miquel Sabaté Solà <[email protected]>
94d4e56
to
9aa3ee2
Compare
Signed-off-by: Miquel Sabaté Solà [email protected]