needle_in_a_haystack 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2459b38c1c9073454786482d6e95688ac2d1cc22142962b5629f8ebc62b6c1c9
|
4
|
+
data.tar.gz: 18c7c8a8c85e23084cc2c6f651879b89d00553d70db47cd51c40c426e259e916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c4c0b9eb3d402e7f017399b3b781d30ff4bfe8733d23fb5aca52bb6375f8053d1ad23f27f8ee62663a5c4214c93636f5f5542ae5855919dec1f161fbec69133
|
7
|
+
data.tar.gz: db728fd4f7606029d8a06e696a61c6800b20d382848c66cdce018ae10abf18dbe83a8a9054c2cdf2e1c17fba1e990e9aae53e84984d11d1109aaf382d563067e
|
@@ -11,7 +11,7 @@ class HaystackTag < BaseTag
|
|
11
11
|
validate :prevent_circular_reference
|
12
12
|
validate :ensure_identity
|
13
13
|
|
14
|
-
CATEGORIES = YAML.load_file(
|
14
|
+
CATEGORIES = YAML.load_file(PATH_ONTOLOGY)
|
15
15
|
|
16
16
|
def ancestors
|
17
17
|
ancestors = []
|
@@ -1 +1 @@
|
|
1
|
-
VERSION = "1.0.
|
1
|
+
VERSION = "1.0.8".freeze
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: needle_in_a_haystack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frans Verberne
|
@@ -112,9 +112,7 @@ files:
|
|
112
112
|
- lib/needle_in_a_haystack/strategies/query_strategy.rb
|
113
113
|
- lib/needle_in_a_haystack/strategies/tag_strategy.rb
|
114
114
|
- lib/needle_in_a_haystack/version.rb
|
115
|
-
- lib/tasks/location_create.rake
|
116
115
|
- spec/models/haystack_tag_spec.rb
|
117
|
-
- spec/strategies/find_by_tags_strategy_spec.rb
|
118
116
|
homepage: https://www.fouriq.nl
|
119
117
|
licenses:
|
120
118
|
- Nonstandard
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
RSpec.describe FindByTagsStrategy, type: :strategy do
|
4
|
-
let(:bedroom) { HaystackTag.create(name: "bedRoom", description: "A Bedroom") }
|
5
|
-
let(:lora) { HaystackTag.create(name: "loraMeter", description: "A Lora Meter") }
|
6
|
-
let(:indoor_temp) { HaystackTag.create(name: "tempIndoor", description: "A Indoor temperature sensor") }
|
7
|
-
let(:device) { Device.create(name: "Device1") }
|
8
|
-
let(:point) { Point.create }
|
9
|
-
|
10
|
-
before do
|
11
|
-
device.haystack_tags << [bedroom, lora]
|
12
|
-
folder = device.folders.create(name: "Folder1")
|
13
|
-
folder.points << point
|
14
|
-
point.haystack_tags << [indoor_temp, bedroom]
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "#execute" do
|
18
|
-
context "when finding devices by tags" do
|
19
|
-
it "returns devices with the specified tags" do
|
20
|
-
strategy = described_class.new(Device, [bedroom, lora])
|
21
|
-
context = QueryContext.new(strategy)
|
22
|
-
result = context.execute
|
23
|
-
|
24
|
-
expect(result).to include(device)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "when finding points by tags" do
|
29
|
-
it "returns points with the specified tags" do
|
30
|
-
strategy = described_class.new(Point, [indoor_temp])
|
31
|
-
context = QueryContext.new(strategy)
|
32
|
-
result = context.execute
|
33
|
-
|
34
|
-
expect(result).to include(point)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|