-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from nemuba/v0.1.1
V0.1.1
- Loading branch information
Showing
6 changed files
with
17 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
mongo_api (0.1.0) | ||
mongo_api (0.1.1) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module MongoApi | ||
VERSION = "0.1.0" | ||
VERSION = "0.1.1" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,33 +9,29 @@ | |
RSpec.describe Users do | ||
let(:user) { { name: "John Doe", email: "[email protected]", type: "DEFAULT" } } | ||
|
||
it { expect(Users.collection_name).to eq("users") } | ||
it { expect(Users.all).to be_a(Array) } | ||
|
||
it { expect(Users.insert(user)).to be_a(Hash) } | ||
|
||
it "should return a user by name" do | ||
response = Users.select(filter: user.slice(:name)).first | ||
expect(response).to be_a(Hash) | ||
expect(response["name"]).to eq("John Doe") | ||
end | ||
|
||
it "should update user by email" do | ||
set = { name: "John Doe Updated" } | ||
response = Users.update(where: user.slice(:email), set:) | ||
expect(response).to be_a(Hash) | ||
expect(response["modifiedCount"]).to eq(1) | ||
expect(response["matchedCount"]).to eq(1) | ||
end | ||
|
||
it "should delete user by email" do | ||
response = Users.destroy(where: user.slice(:email)) | ||
expect(response).to be_a(Hash) | ||
expect(response["deletedCount"]).to eq(1) | ||
end | ||
|
||
it "should delete all users" do | ||
response = Users.destroy_all | ||
expect(response).to be_a(Hash) | ||
expect(response["deletedCount"]).to be >= 0 | ||
end | ||
end |