-
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 #25 from GD-Personal/bug_fix
Release v0.4.2 (22-09-2024) - Bug fix
- Loading branch information
Showing
9 changed files
with
99 additions
and
19 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
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: | ||
flexi-json (0.4.1) | ||
flexi-json (0.4.2) | ||
|
||
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
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 |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Flexi | ||
module Json | ||
VERSION = "0.4.1" | ||
VERSION = "0.4.2" | ||
end | ||
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
require "spec_helper" | ||
require "debug" | ||
|
||
RSpec.describe Flexi::Json::Dataset do | ||
describe ".initialize" do | ||
|
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 |
---|---|---|
|
@@ -34,4 +34,68 @@ | |
end | ||
end | ||
end | ||
|
||
describe "#search" do | ||
subject { described_class.new("./spec/data/dataset.json") } | ||
|
||
context "for query param" do | ||
it "works for string type" do | ||
expect(subject.search("john")).not_to eq [] | ||
end | ||
|
||
it "works for array type" do | ||
expect(subject.search(["john"])).to eq [] | ||
end | ||
end | ||
|
||
context "for fields param" do | ||
it "works for string type" do | ||
expect(subject.search("john", "full_name")).not_to eq [] | ||
expect(subject.search("john", "full_name, email")).not_to eq [] | ||
end | ||
it "works for array type" do | ||
expect(subject.search("john", ["full_name"])).not_to eq [] | ||
expect(subject.search("john", ["full_name", "email"])).not_to eq [] | ||
end | ||
end | ||
|
||
context "for options params" do | ||
it "works for match_all option" do | ||
options = {match_all: true} | ||
expect(subject.search("john", "full_name", options: options)).not_to eq [] | ||
|
||
query = {full_name: "john", email: "[email protected]"} | ||
expect(subject.search(query, "full_name", options: options)).to eq [] | ||
|
||
query = {full_name: "john", email: "john.doe"} | ||
expect(subject.search(query, options: options)).not_to eq [] | ||
end | ||
|
||
it "works for exact_match option" do | ||
options = {exact_match: true} | ||
expect(subject.search("john", "full_name", options: options)).to eq [] | ||
expect(subject.search("john doe", "full_name", options: options)).not_to eq [] | ||
|
||
query = {full_name: "john", email: "john.doe"} | ||
expect(subject.search(query, "full_name", options: options)).to eq [] | ||
end | ||
|
||
it "works for both options" do | ||
options = {exact_match: true, match_all: true} | ||
query = {full_name: "john", email: "[email protected]"} | ||
expect(subject.search(query, options: options)).to eq [] | ||
|
||
query = {full_name: "john doe", email: "[email protected]"} | ||
expect(subject.search(query, options: options)).not_to eq [] | ||
end | ||
end | ||
end | ||
|
||
describe "#find_duplicates" do | ||
subject { described_class.new("./spec/data/dataset.json") } | ||
it "works" do | ||
expect(subject.find_duplicates("email").size).to eq 2 | ||
expect(subject.find_duplicates("unknown_key").size).to eq 0 | ||
end | ||
end | ||
end |