There were a few issues. Looks like the original jets spec_helper.rb
was copied over and replaced with one from a Rails project. Fixes in here: https://github.com/thushw/maestro/pull/1
To get rspec
to pass, the fixes were:
- Remove rails rspec helpers. Jets and Rails code differ quite a bit so using the rails helpers probably won’t work in most cases.
- Use the
spec/spec_helper.rb
that is originally generated with jets new
- Use more generic factory_bot instead
Here’s the output:
rspec output
$ bundle exec rspec
{:message=>"Evaluating lead with ID against Maestro Campaign 1 : Health"}
{:message=>"Evaluating lead with ID against Maestro Buyer 2 : Avenge"}
{:message=>"Evaluating lead with ID against rules for Maestro Buyer 2 : Avenge"}
rules: #<ActiveRecord::Relation [#<MaestroBuyerRule id: 2, maestro_buyer_id: 2, left_operand: "weight", operator: "<", right_operand: "140", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">]>
{:message=>"Evaluating lead with ID for buyer 2 resulted in false"}
{:message=>"Evaluating lead with ID against Maestro Buyer 1 : Marchex"}
{:message=>"Evaluating lead with ID against rules for Maestro Buyer 1 : Marchex"}
rules: #<ActiveRecord::Relation [#<MaestroBuyerRule id: 1, maestro_buyer_id: 1, left_operand: "age", operator: "<", right_operand: "70", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">]>
{:message=>"Evaluating lead with ID for buyer 1 resulted in true"}
{:message=>"Evaluating lead with ID against Maestro Buyer 3 : Pinnacle"}
{:message=>"Evaluating lead with ID against rules for Maestro Buyer 3 : Pinnacle"}
rules: #<ActiveRecord::Relation [#<MaestroBuyerRule id: 3, maestro_buyer_id: 3, left_operand: "weight", operator: "<", right_operand: "160", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">, #<MaestroBuyerRule id: 4, maestro_buyer_id: 3, left_operand: "age", operator: "<", right_operand: "70", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">]>
{:message=>"Evaluating lead with ID for buyer 3 resulted in true"}
.{:message=>"Evaluating lead with ID against Maestro Campaign 2 : Health"}
{:message=>"Evaluating lead with ID against Maestro Buyer 5 : Avenge"}
{:message=>"Evaluating lead with ID against rules for Maestro Buyer 5 : Avenge"}
rules: #<ActiveRecord::Relation [#<MaestroBuyerRule id: 6, maestro_buyer_id: 5, left_operand: "weight", operator: "<", right_operand: "140", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">]>
{:message=>"Evaluating lead with ID for buyer 5 resulted in false"}
{:message=>"Evaluating lead with ID against Maestro Buyer 4 : Marchex"}
{:message=>"Evaluating lead with ID against rules for Maestro Buyer 4 : Marchex"}
rules: #<ActiveRecord::Relation [#<MaestroBuyerRule id: 5, maestro_buyer_id: 4, left_operand: "age", operator: "<", right_operand: "70", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">]>
{:message=>"Evaluating lead with ID for buyer 4 resulted in true"}
{:message=>"Evaluating lead with ID against Maestro Buyer 6 : Pinnacle"}
{:message=>"Evaluating lead with ID against rules for Maestro Buyer 6 : Pinnacle"}
rules: #<ActiveRecord::Relation [#<MaestroBuyerRule id: 7, maestro_buyer_id: 6, left_operand: "weight", operator: "<", right_operand: "160", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">, #<MaestroBuyerRule id: 8, maestro_buyer_id: 6, left_operand: "age", operator: "<", right_operand: "70", created_at: "2019-05-20 09:21:42", updated_at: "2019-05-20 09:21:42">]>
{:message=>"Evaluating lead with ID for buyer 6 resulted in true"}
..........................
Finished in 0.28359 seconds (files took 3.04 seconds to load)
27 examples, 0 failures
$
Also, recommend you include on the specific aws-sdk gems that’s needed instead of the whole thing. IE: aws-sdk-s3, aws-sdk-ec2, etc.