esse-rspec 0.0.2 → 0.0.4

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: 85229a52ecdc873d198b3e2e8e1ddc6d60da81bda3923ef69409153e5ba7bb2b
4
- data.tar.gz: 8392cf44d96fa894cd6493cff562ede6be878c0565b77a32b912279ebfa55f0b
3
+ metadata.gz: edf7cd6ae62013f70d49d21f5e633f90b07cb4331b7f3573d1614d0e74e26ec2
4
+ data.tar.gz: df206c8c7f5c749dfda9ed95bf8b04ee7fdf04d215a356760a936a0069be3660
5
5
  SHA512:
6
- metadata.gz: 699b71edf81ebf20dda976f4c8b164daff31cbb496255e9436023da24fb712ca890741044fe6051aaf32bf15e2fb01956a8a54fe1a3b1e28fd5267678246cf81
7
- data.tar.gz: 350f5e84f98c702ba9de1d567bfbddf11cf8e108e82577067d6a0aaa5cfb1379847a40500696038ee514515090363ccc1305e074ecd569629d420ea614cd9e8a
6
+ metadata.gz: 320944994296eca28470899960df56a72aefea1ef1137e46ce8de30a519eeb505dc531103fdea416b8c67badb9a6843d12240a6dc337a1132797f33a075e356c
7
+ data.tar.gz: 2ab0182c6862f3e7745fadaf136be9f397dc2bda626c29fbff879830585d1e545dd28df4fd7be93eebdec23e934a216198ab36b988c610807ea77d2fedfdf8b0
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.0.4 - 2023-11-15
8
+ * The `cluster_id` argument of `stub_esse_search` is useless when the given index is a Esse::Index. Cluster id is now optional.
9
+
10
+
11
+ ## 0.0.3 - 2023-11-15
12
+ It should not automatically require `esse/rspec` anymore. You should require it manually in your `spec_helper.rb` file.
13
+
7
14
  ## 0.0.2 - 2023-11-15
8
15
  * Whitelist rspec >= 3.0.0
9
16
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- esse-rspec (0.0.2)
4
+ esse-rspec (0.0.4)
5
5
  esse (>= 0.2.4)
6
6
  rspec (>= 3)
7
7
 
data/README.md CHANGED
@@ -7,7 +7,9 @@ RSpec and testing support for [esse](https://github.com/marcosgz/esse)
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'esse-rspec'
10
+ group :test do
11
+ gem 'esse-rspec'
12
+ end
11
13
  ```
12
14
 
13
15
  And then execute:
@@ -17,8 +17,16 @@ module Esse
17
17
  stub_const(Esse::Hstring.new(name).camelize.to_s, klass)
18
18
  end
19
19
 
20
- def stub_esse_search(cluster_name, *indexes, **definition)
21
- cluster = Esse.cluster(cluster_name)
20
+ def stub_esse_search(*cluster_and_indexes, **definition)
21
+ cluster = if Esse.config.cluster_ids.include?(cluster_and_indexes.first)
22
+ Esse.cluster(cluster_and_indexes.shift)
23
+ elsif cluster_and_indexes.first.is_a?(Esse::Index)
24
+ cluster_and_indexes.first.cluster
25
+ else
26
+ Esse.cluster
27
+ end
28
+
29
+ indexes = cluster_and_indexes
22
30
  transport = cluster.api
23
31
  definition[:index] ||= Esse::Search::Query.normalize_indices(*indexes)
24
32
  response = yield
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Esse
4
4
  module RSpec
5
- VERSION = "0.0.2"
5
+ VERSION = "0.0.4"
6
6
  end
7
7
  end
data/lib/esse/rspec.rb CHANGED
@@ -10,6 +10,8 @@ module Esse
10
10
  end
11
11
  end
12
12
 
13
- ::RSpec.configure do |config|
14
- config.include Esse::RSpec::ClassMethods
13
+ if defined?(::RSpec)
14
+ ::RSpec.configure do |config|
15
+ config.include Esse::RSpec::ClassMethods
16
+ end
15
17
  end
data/lib/esse-rspec.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
-
3
- require_relative "esse/rspec"
2
+ #
3
+ # does nothing, user should require `esse/rspec` manually instead
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esse-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos G. Zimmermann