I got that quite strange issue with Rspec while building a new gem.
I'm using rspec-rails with the default spec/spec_helper.rb file:
# frozen_string_literal: true
require 'bundler/setup'
require 'byebug'
require 'nobrainer'
# require 'rspec/core'
# require 'rspec/expectations'
Dir[
File.join(File.expand_path(__dir__), 'models', '*.rb')
].sort.each { |file| require file }
require 'my_gem'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.include RSpec::Matchers
config.include NoBrainer::Matchers
end
My test is using a NoBrainer document to test a field but fails with:
NoBrainer::Config.machine_id being nil make the code returning false. Adding a to_i on it "solve" the issue but look weird so I'd like to get your input @nviennot if you will :)
I got that quite strange issue with Rspec while building a new gem.
I'm using
rspec-rails
with the defaultspec/spec_helper.rb
file:My test is using a NoBrainer document to test a field but fails with:
The error come from the
NoBrainer::Document::PrimaryKey::Generator._generate
method, from the last line:Actually
machine_id
isfalse
because of this line:NoBrainer::Config.machine_id
beingnil
make the code returningfalse
. Adding ato_i
on it "solve" the issue but look weird so I'd like to get your input @nviennot if you will :)