axiom-optimizer 0.1.0 → 0.1.1
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.
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +4 -6
- data/Gemfile +6 -3
- data/Gemfile.devtools +26 -24
- data/Guardfile +18 -9
- data/README.md +2 -25
- data/axiom-optimizer.gemspec +1 -3
- data/config/devtools.yml +2 -0
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -1
- data/config/rubocop.yml +53 -0
- data/lib/axiom/optimizer.rb +1 -1
- data/lib/axiom/optimizer/algebra/difference.rb +1 -1
- data/lib/axiom/optimizer/algebra/join.rb +3 -1
- data/lib/axiom/optimizer/algebra/projection.rb +1 -1
- data/lib/axiom/optimizer/algebra/rename.rb +1 -1
- data/lib/axiom/optimizer/algebra/restriction.rb +1 -1
- data/lib/axiom/optimizer/algebra/summarization.rb +1 -1
- data/lib/axiom/optimizer/function/connective/binary.rb +1 -1
- data/lib/axiom/optimizer/optimizable.rb +5 -3
- data/lib/axiom/optimizer/relation/materialized.rb +1 -1
- data/lib/axiom/optimizer/relation/operation/combination.rb +1 -1
- data/lib/axiom/optimizer/relation/operation/limit.rb +2 -2
- data/lib/axiom/optimizer/support/predicate_partition.rb +1 -4
- data/lib/axiom/optimizer/version.rb +1 -1
- data/spec/integration/axiom/algebra/difference/optimize_spec.rb +15 -15
- data/spec/integration/axiom/algebra/intersection/optimize_spec.rb +15 -15
- data/spec/integration/axiom/algebra/join/optimize_spec.rb +11 -11
- data/spec/integration/axiom/algebra/product/optimize_spec.rb +13 -13
- data/spec/integration/axiom/algebra/projection/optimize_spec.rb +44 -44
- data/spec/integration/axiom/algebra/rename/optimize_spec.rb +70 -70
- data/spec/integration/axiom/algebra/restriction/optimize_spec.rb +23 -24
- data/spec/integration/axiom/algebra/summarization/optimize_spec.rb +8 -8
- data/spec/integration/axiom/algebra/union/optimize_spec.rb +21 -21
- data/spec/integration/axiom/function/connective/conjunction/optimize_spec.rb +26 -26
- data/spec/integration/axiom/function/connective/disjunction/optimize_spec.rb +27 -28
- data/spec/integration/axiom/function/connective/negation/optimize_spec.rb +2 -2
- data/spec/integration/axiom/function/optimize_spec.rb +1 -1
- data/spec/integration/axiom/function/predicate/equality/optimize_spec.rb +8 -8
- data/spec/integration/axiom/function/predicate/exclusion/optimize_spec.rb +19 -19
- data/spec/integration/axiom/function/predicate/greater_than/optimize_spec.rb +17 -17
- data/spec/integration/axiom/function/predicate/greater_than_or_equal_to/optimize_spec.rb +17 -17
- data/spec/integration/axiom/function/predicate/inclusion/optimize_spec.rb +19 -19
- data/spec/integration/axiom/function/predicate/inequality/optimize_spec.rb +8 -8
- data/spec/integration/axiom/function/predicate/less_than/optimize_spec.rb +17 -17
- data/spec/integration/axiom/function/predicate/less_than_or_equal_to/optimize_spec.rb +17 -17
- data/spec/integration/axiom/relation/empty/optimize_spec.rb +2 -2
- data/spec/integration/axiom/relation/materialized/optimize_spec.rb +3 -3
- data/spec/integration/axiom/relation/operation/limit/optimize_spec.rb +16 -16
- data/spec/integration/axiom/relation/operation/offset/optimize_spec.rb +14 -14
- data/spec/integration/axiom/relation/operation/order/optimize_spec.rb +11 -11
- data/spec/integration/axiom/relation/operation/reverse/optimize_spec.rb +9 -9
- data/spec/integration/axiom/relation/optimize_spec.rb +4 -4
- data/spec/shared/function_connective_binary_optimize_behavior.rb +18 -18
- data/spec/shared/optimize_method_behavior.rb +2 -2
- data/spec/spec_helper.rb +7 -8
- data/spec/support/add_method_missing.rb +3 -4
- data/spec/unit/axiom/optimizer/algebra/difference/empty_left/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/difference/empty_right/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/difference/equal_operands/optimize_spec.rb +7 -9
- data/spec/unit/axiom/optimizer/algebra/extension/extensions_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/extension/order_operand/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/extension/order_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/extension/unoptimized_operand/optimizable_predicate_spec.rb +10 -10
- data/spec/unit/axiom/optimizer/algebra/extension/unoptimized_operand/optimize_spec.rb +10 -10
- data/spec/unit/axiom/optimizer/algebra/intersection/empty_left/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/intersection/empty_right/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/intersection/equal_operands/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/join/disjoint_headers/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/join/disjoint_headers/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/join/equal_headers/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/join/equal_headers/optimize_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/algebra/join/materialized_left/optimizable_predicate_spec.rb +9 -9
- data/spec/unit/axiom/optimizer/algebra/join/materialized_left/optimize_spec.rb +12 -12
- data/spec/unit/axiom/optimizer/algebra/join/materialized_right/optimizable_predicate_spec.rb +9 -9
- data/spec/unit/axiom/optimizer/algebra/join/materialized_right/optimize_spec.rb +12 -12
- data/spec/unit/axiom/optimizer/algebra/product/table_dee_left/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/algebra/product/table_dee_left/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/product/table_dee_right/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/algebra/product/table_dee_right/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/projection/empty_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/projection/empty_operand/optimize_spec.rb +6 -8
- data/spec/unit/axiom/optimizer/algebra/projection/extension_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/projection/extension_operand/optimize_spec.rb +12 -6
- data/spec/unit/axiom/optimizer/algebra/projection/projection_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/projection/projection_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/projection/union_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/projection/union_operand/optimize_spec.rb +10 -10
- data/spec/unit/axiom/optimizer/algebra/projection/unoptimized_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/projection/unoptimized_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/aliases_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/empty_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/rename/empty_operand/optimize_spec.rb +5 -7
- data/spec/unit/axiom/optimizer/algebra/rename/limit_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/rename/limit_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/offset_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/rename/offset_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/order_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/rename/order_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/projection_operand/optimizable_predicate_spec.rb +12 -12
- data/spec/unit/axiom/optimizer/algebra/rename/projection_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/rename_operand/optimizable_predicate_spec.rb +9 -9
- data/spec/unit/axiom/optimizer/algebra/rename/rename_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/rename_operand_and_empty_aliases/optimizable_predicate_spec.rb +11 -11
- data/spec/unit/axiom/optimizer/algebra/rename/rename_operand_and_empty_aliases/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/rename/restriction_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/rename/restriction_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/rename/reverse_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/algebra/rename/reverse_operand/optimize_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/algebra/rename/set_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/rename/set_operand/optimize_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/algebra/rename/unoptimized_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/rename/unoptimized_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/restriction/combination_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/restriction/combination_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/restriction/contradiction/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/restriction/contradiction/optimize_spec.rb +7 -9
- data/spec/unit/axiom/optimizer/algebra/restriction/join_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/restriction/join_operand/optimize_spec.rb +17 -17
- data/spec/unit/axiom/optimizer/algebra/restriction/order_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/restriction/order_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/restriction/predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/restriction/product_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/restriction/product_operand/optimize_spec.rb +17 -17
- data/spec/unit/axiom/optimizer/algebra/restriction/restriction_operand/optimizable_predicate_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/restriction/restriction_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/restriction/set_operand/optimizable_predicate_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/restriction/set_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/restriction/tautology/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/algebra/restriction/tautology/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/restriction/unoptimized_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/algebra/restriction/unoptimized_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/summarization/empty_operand/class_methods/extension_default_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/algebra/summarization/empty_operand/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/summarization/empty_operand/optimize_spec.rb +13 -13
- data/spec/unit/axiom/optimizer/algebra/summarization/empty_summarize_per/optimizable_predicate_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/algebra/summarization/empty_summarize_per/optimize_spec.rb +5 -7
- data/spec/unit/axiom/optimizer/algebra/summarization/order_operand/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/summarization/order_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/summarization/summarize_per_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/summarization/summarizers_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/summarization/unoptimized_operand/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/summarization/unoptimized_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/algebra/union/empty_left/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/union/empty_right/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/algebra/union/equal_operands/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/class_methods/chain_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/function/binary/constant_operands/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/binary/left_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/binary/right_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/binary/unoptimized_operands/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/function/binary/unoptimized_operands/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/class_methods/optimize_functions_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/function/class_methods/optimize_operand_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/function/connective/binary/constant_operands/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/binary/equal_operands/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/binary/equal_operands/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/binary/left_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/function/connective/binary/redundant_left/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/connective/binary/redundant_left/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/connective/binary/redundant_right/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/connective/binary/redundant_right/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/connective/binary/right_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/function/connective/conjunction/contradiction/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/conjunction/contradiction/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/conjunction/optimizable_to_exclusion/optimizable_predicate_spec.rb +9 -9
- data/spec/unit/axiom/optimizer/function/connective/conjunction/optimizable_to_exclusion/optimize_spec.rb +17 -17
- data/spec/unit/axiom/optimizer/function/connective/conjunction/tautology_left/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/conjunction/tautology_left/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/conjunction/tautology_right/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/conjunction/tautology_right/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/disjunction/contradiction_left/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/disjunction/contradiction_left/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/disjunction/contradiction_right/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/disjunction/contradiction_right/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/disjunction/optimizable_to_inclusion/optimizable_predicate_spec.rb +9 -9
- data/spec/unit/axiom/optimizer/function/connective/disjunction/optimizable_to_inclusion/optimize_spec.rb +17 -17
- data/spec/unit/axiom/optimizer/function/connective/disjunction/tautology/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/disjunction/tautology/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/negation/constant_operand/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/negation/invertible_operand/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/connective/negation/invertible_operand/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/negation/operand_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/function/predicate/comparable/never_comparable/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/predicate/comparable/never_equivalent/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/function/predicate/comparable/normalizable_operands/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/predicate/comparable/normalizable_operands/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/predicate/constant_operands/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/predicate/contradiction/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/predicate/enumerable/class_methods/sort_by_value_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/predicate/enumerable/empty_right/optimizable_predicate_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/function/predicate/enumerable/one_right/optimizable_predicate_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/function/predicate/enumerable/unoptimized_operands/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/function/predicate/enumerable/unoptimized_operands/optimize_spec.rb +14 -14
- data/spec/unit/axiom/optimizer/function/predicate/equality/tautology/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/predicate/exclusion/empty_right/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/function/predicate/exclusion/one_right/optimize_spec.rb +9 -9
- data/spec/unit/axiom/optimizer/function/predicate/greater_than/contradiction/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/greater_than/tautology/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/greater_than_or_equal_to/contradiction/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/greater_than_or_equal_to/tautology/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/inclusion/empty_right/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/function/predicate/inclusion/one_right/optimize_spec.rb +9 -9
- data/spec/unit/axiom/optimizer/function/predicate/inequality/contradiction/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/predicate/less_than/contradiction/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/less_than/tautology/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/less_than_or_equal_to/contradiction/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/less_than_or_equal_to/tautology/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/function/predicate/tautology/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/unary/constant_operand/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/unary/operand_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/unary/unoptimized_operand/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/util/class_methods/max_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/util/class_methods/min_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/operation_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/optimizable/class_methods/optimizer_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/optimizable/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/optimizable_predicate_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/predicate_partition/left_spec.rb +18 -18
- data/spec/unit/axiom/optimizer/predicate_partition/remainder_spec.rb +19 -19
- data/spec/unit/axiom/optimizer/predicate_partition/right_spec.rb +18 -18
- data/spec/unit/axiom/optimizer/relation/materialized/empty_operand/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/materialized/empty_operand/optimize_spec.rb +5 -7
- data/spec/unit/axiom/optimizer/relation/operation/binary/empty_left/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/binary/empty_right/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/binary/equal_operands/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/binary/left_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/binary/materialized_operands/optimizable_predicate_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/binary/materialized_operands/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/relation/operation/binary/order_left/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/binary/order_left/optimize_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/relation/operation/binary/order_right/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/binary/order_right/optimize_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/relation/operation/binary/right_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/binary/unoptimized_operands/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/binary/unoptimized_operands/optimize_spec.rb +8 -8
- data/spec/unit/axiom/optimizer/relation/operation/combination/optimize_spec.rb +5 -7
- data/spec/unit/axiom/optimizer/relation/operation/limit/equal_limit_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/limit/equal_limit_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/limit/limit_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/limit/limit_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/limit/unoptimized_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/limit/zero_limit/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/limit/zero_limit/optimize_spec.rb +6 -8
- data/spec/unit/axiom/optimizer/relation/operation/offset/offset_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/offset/offset_operand/optimize_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/offset/unoptimized_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/offset/unoptimized_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/offset/zero_offset/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/offset/zero_offset/optimize_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/order/one_limit_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/order/one_limit_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/order/order_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/order/order_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/order/unoptimized_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/order/unoptimized_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/relation/operation/reverse/order_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/reverse/order_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/relation/operation/reverse/reverse_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/reverse/reverse_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/relation/operation/reverse/unoptimized_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/reverse/unoptimized_operand/optimize_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/relation/operation/unary/empty_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/unary/empty_operand/optimize_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/unary/header_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/unary/materialized_operand/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/unary/materialized_operand/optimize_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/unary/operand_spec.rb +7 -7
- data/spec/unit/axiom/optimizer/relation/operation/unary/order_operand/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/unary/order_operand/optimize_spec.rb +6 -6
- data/spec/unit/axiom/optimizer/relation/operation/unary/unchanged_header/optimizable_predicate_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/unary/unchanged_header/optimize_spec.rb +5 -5
- metadata +24 -289
- checksums.yaml +0 -7
- data/.gemtest +0 -0
- data/.rvmrc +0 -1
@@ -12,7 +12,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
12
12
|
|
13
13
|
context 'left and right are attributes' do
|
14
14
|
context 'and equivalent' do
|
15
|
-
it { should
|
15
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
16
16
|
|
17
17
|
it_should_behave_like 'an optimize method'
|
18
18
|
end
|
@@ -20,7 +20,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
20
20
|
context 'and are not joinable' do
|
21
21
|
let(:right) { Attribute::String.new(:other) }
|
22
22
|
|
23
|
-
it { should
|
23
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
24
24
|
|
25
25
|
it_should_behave_like 'an optimize method'
|
26
26
|
end
|
@@ -28,7 +28,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
28
28
|
context 'and are joinable' do
|
29
29
|
let(:right) { Attribute::Integer.new(:other) }
|
30
30
|
|
31
|
-
it { should
|
31
|
+
it { should be(object) }
|
32
32
|
|
33
33
|
it_should_behave_like 'an optimize method'
|
34
34
|
end
|
@@ -38,7 +38,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
38
38
|
context 'right is a valid value' do
|
39
39
|
let(:right) { 1 }
|
40
40
|
|
41
|
-
it { should
|
41
|
+
it { should be(object) }
|
42
42
|
|
43
43
|
it_should_behave_like 'an optimize method'
|
44
44
|
end
|
@@ -46,7 +46,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
46
46
|
context 'right is an invalid value' do
|
47
47
|
let(:right) { 'a' }
|
48
48
|
|
49
|
-
it { should
|
49
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
50
50
|
|
51
51
|
it_should_behave_like 'an optimize method'
|
52
52
|
end
|
@@ -64,7 +64,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
64
64
|
context 'left is an invalid value' do
|
65
65
|
let(:left) { 'a' }
|
66
66
|
|
67
|
-
it { should
|
67
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
68
68
|
|
69
69
|
it_should_behave_like 'an optimize method'
|
70
70
|
end
|
@@ -75,7 +75,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
75
75
|
let(:left) { 1 }
|
76
76
|
let(:right) { 2 }
|
77
77
|
|
78
|
-
it { should
|
78
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
79
79
|
|
80
80
|
it_should_behave_like 'an optimize method'
|
81
81
|
end
|
@@ -84,7 +84,7 @@ describe Function::Predicate::Inequality, '#optimize' do
|
|
84
84
|
let(:left) { 1 }
|
85
85
|
let(:right) { 1 }
|
86
86
|
|
87
|
-
it { should
|
87
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
88
88
|
|
89
89
|
it_should_behave_like 'an optimize method'
|
90
90
|
end
|
@@ -5,14 +5,14 @@ require 'spec_helper'
|
|
5
5
|
describe Function::Predicate::LessThan, '#optimize' do
|
6
6
|
subject { object.optimize }
|
7
7
|
|
8
|
-
let(:attribute) { Attribute::Integer.new(:id, :
|
9
|
-
let(:left) { attribute
|
10
|
-
let(:right) { attribute
|
11
|
-
let(:object) { described_class.new(left, right)
|
8
|
+
let(:attribute) { Attribute::Integer.new(:id, required: false, size: 1..2**31 - 1) }
|
9
|
+
let(:left) { attribute }
|
10
|
+
let(:right) { attribute }
|
11
|
+
let(:object) { described_class.new(left, right) }
|
12
12
|
|
13
13
|
context 'left and right are attributes' do
|
14
14
|
context 'and equivalent' do
|
15
|
-
it { should
|
15
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
16
16
|
|
17
17
|
it_should_behave_like 'an optimize method'
|
18
18
|
end
|
@@ -20,25 +20,25 @@ describe Function::Predicate::LessThan, '#optimize' do
|
|
20
20
|
context 'and are not comparable' do
|
21
21
|
let(:right) { Attribute::Float.new(:float) }
|
22
22
|
|
23
|
-
it { should
|
23
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
24
24
|
|
25
25
|
it_should_behave_like 'an optimize method'
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'and left is always less than right' do
|
29
|
-
let(:left) { attribute
|
30
|
-
let(:right) { Attribute::Integer.new(:right, :
|
29
|
+
let(:left) { attribute }
|
30
|
+
let(:right) { Attribute::Integer.new(:right, size: 2**31..2**31) }
|
31
31
|
|
32
|
-
it { should
|
32
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
33
33
|
|
34
34
|
it_should_behave_like 'an optimize method'
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'and left is always greater than or equal to right' do
|
38
|
-
let(:left) { attribute
|
39
|
-
let(:right) { Attribute::Integer.new(:right, :
|
38
|
+
let(:left) { attribute }
|
39
|
+
let(:right) { Attribute::Integer.new(:right, size: 0..0) }
|
40
40
|
|
41
|
-
it { should
|
41
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
42
42
|
|
43
43
|
it_should_behave_like 'an optimize method'
|
44
44
|
end
|
@@ -48,7 +48,7 @@ describe Function::Predicate::LessThan, '#optimize' do
|
|
48
48
|
context 'right is a valid value' do
|
49
49
|
let(:right) { 2 }
|
50
50
|
|
51
|
-
it { should
|
51
|
+
it { should be(object) }
|
52
52
|
|
53
53
|
it_should_behave_like 'an optimize method'
|
54
54
|
end
|
@@ -56,7 +56,7 @@ describe Function::Predicate::LessThan, '#optimize' do
|
|
56
56
|
context 'right is an invalid primitive' do
|
57
57
|
let(:right) { nil }
|
58
58
|
|
59
|
-
it { should
|
59
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
60
60
|
|
61
61
|
it_should_behave_like 'an optimize method'
|
62
62
|
end
|
@@ -74,7 +74,7 @@ describe Function::Predicate::LessThan, '#optimize' do
|
|
74
74
|
context 'left is an invalid primitive' do
|
75
75
|
let(:left) { nil }
|
76
76
|
|
77
|
-
it { should
|
77
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
78
78
|
|
79
79
|
it_should_behave_like 'an optimize method'
|
80
80
|
end
|
@@ -85,7 +85,7 @@ describe Function::Predicate::LessThan, '#optimize' do
|
|
85
85
|
let(:left) { 1 }
|
86
86
|
let(:right) { 2 }
|
87
87
|
|
88
|
-
it { should
|
88
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
89
89
|
|
90
90
|
it_should_behave_like 'an optimize method'
|
91
91
|
end
|
@@ -94,7 +94,7 @@ describe Function::Predicate::LessThan, '#optimize' do
|
|
94
94
|
let(:left) { 1 }
|
95
95
|
let(:right) { 1 }
|
96
96
|
|
97
|
-
it { should
|
97
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
98
98
|
|
99
99
|
it_should_behave_like 'an optimize method'
|
100
100
|
end
|
@@ -5,14 +5,14 @@ require 'spec_helper'
|
|
5
5
|
describe Function::Predicate::LessThanOrEqualTo, '#optimize' do
|
6
6
|
subject { object.optimize }
|
7
7
|
|
8
|
-
let(:attribute) { Attribute::Integer.new(:id, :
|
9
|
-
let(:left) { attribute
|
10
|
-
let(:right) { attribute
|
11
|
-
let(:object) { described_class.new(left, right)
|
8
|
+
let(:attribute) { Attribute::Integer.new(:id, required: false, size: 1..2**31 - 1) }
|
9
|
+
let(:left) { attribute }
|
10
|
+
let(:right) { attribute }
|
11
|
+
let(:object) { described_class.new(left, right) }
|
12
12
|
|
13
13
|
context 'left and right are attributes' do
|
14
14
|
context 'and equivalent' do
|
15
|
-
it { should
|
15
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
16
16
|
|
17
17
|
it_should_behave_like 'an optimize method'
|
18
18
|
end
|
@@ -20,25 +20,25 @@ describe Function::Predicate::LessThanOrEqualTo, '#optimize' do
|
|
20
20
|
context 'and are not comparable' do
|
21
21
|
let(:right) { Attribute::Float.new(:float) }
|
22
22
|
|
23
|
-
it { should
|
23
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
24
24
|
|
25
25
|
it_should_behave_like 'an optimize method'
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'and left is always less than right' do
|
29
|
-
let(:left) { attribute
|
30
|
-
let(:right) { Attribute::Integer.new(:right, :
|
29
|
+
let(:left) { attribute }
|
30
|
+
let(:right) { Attribute::Integer.new(:right, size: 2**31..2**31) }
|
31
31
|
|
32
|
-
it { should
|
32
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
33
33
|
|
34
34
|
it_should_behave_like 'an optimize method'
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'and left is always greater than right' do
|
38
|
-
let(:left) { attribute
|
39
|
-
let(:right) { Attribute::Integer.new(:right, :
|
38
|
+
let(:left) { attribute }
|
39
|
+
let(:right) { Attribute::Integer.new(:right, size: -1..-1) }
|
40
40
|
|
41
|
-
it { should
|
41
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
42
42
|
|
43
43
|
it_should_behave_like 'an optimize method'
|
44
44
|
end
|
@@ -48,7 +48,7 @@ describe Function::Predicate::LessThanOrEqualTo, '#optimize' do
|
|
48
48
|
context 'right is a valid value' do
|
49
49
|
let(:right) { 1 }
|
50
50
|
|
51
|
-
it { should
|
51
|
+
it { should be(object) }
|
52
52
|
|
53
53
|
it_should_behave_like 'an optimize method'
|
54
54
|
end
|
@@ -56,7 +56,7 @@ describe Function::Predicate::LessThanOrEqualTo, '#optimize' do
|
|
56
56
|
context 'right is an invalid primitive' do
|
57
57
|
let(:right) { nil }
|
58
58
|
|
59
|
-
it { should
|
59
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
60
60
|
|
61
61
|
it_should_behave_like 'an optimize method'
|
62
62
|
end
|
@@ -74,7 +74,7 @@ describe Function::Predicate::LessThanOrEqualTo, '#optimize' do
|
|
74
74
|
context 'left is an invalid primitive' do
|
75
75
|
let(:left) { nil }
|
76
76
|
|
77
|
-
it { should
|
77
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
78
78
|
|
79
79
|
it_should_behave_like 'an optimize method'
|
80
80
|
end
|
@@ -85,7 +85,7 @@ describe Function::Predicate::LessThanOrEqualTo, '#optimize' do
|
|
85
85
|
let(:left) { 1 }
|
86
86
|
let(:right) { 1 }
|
87
87
|
|
88
|
-
it { should
|
88
|
+
it { should be(Function::Proposition::Tautology.instance) }
|
89
89
|
|
90
90
|
it_should_behave_like 'an optimize method'
|
91
91
|
end
|
@@ -94,7 +94,7 @@ describe Function::Predicate::LessThanOrEqualTo, '#optimize' do
|
|
94
94
|
let(:left) { 2 }
|
95
95
|
let(:right) { 1 }
|
96
96
|
|
97
|
-
it { should
|
97
|
+
it { should be(Function::Proposition::Contradiction.instance) }
|
98
98
|
|
99
99
|
it_should_behave_like 'an optimize method'
|
100
100
|
end
|
@@ -5,9 +5,9 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Empty, '#optimize' do
|
6
6
|
subject { object.optimize }
|
7
7
|
|
8
|
-
let(:object) { described_class.new([
|
8
|
+
let(:object) { described_class.new([[:id, Integer]]) }
|
9
9
|
|
10
|
-
it { should
|
10
|
+
it { should be(object) }
|
11
11
|
|
12
12
|
it_should_behave_like 'an optimize method'
|
13
13
|
end
|
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Materialized, '#optimize' do
|
6
6
|
subject { object.optimize }
|
7
7
|
|
8
|
-
let(:object) { described_class.new([
|
8
|
+
let(:object) { described_class.new([[:id, Integer]], body) }
|
9
9
|
|
10
10
|
context 'with an empty Array' do
|
11
11
|
let(:body) { [] }
|
@@ -20,9 +20,9 @@ describe Relation::Materialized, '#optimize' do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
context 'with an nonempty Array' do
|
23
|
-
let(:body) { [
|
23
|
+
let(:body) { [[1]] }
|
24
24
|
|
25
|
-
it { should
|
25
|
+
it { should be(object) }
|
26
26
|
|
27
27
|
it_should_behave_like 'an optimize method'
|
28
28
|
end
|
@@ -5,13 +5,13 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Limit, '#optimize' do
|
6
6
|
subject { object.optimize }
|
7
7
|
|
8
|
-
let(:body) { LazyEnumerable.new([
|
9
|
-
let(:relation) { Relation.new([
|
10
|
-
let(:directions) { [
|
11
|
-
let(:order) { relation.sort_by { directions }
|
12
|
-
let(:operand) { order
|
13
|
-
let(:limit) { 1
|
14
|
-
let(:object) { described_class.new(operand, limit)
|
8
|
+
let(:body) { LazyEnumerable.new([[1], [2], [3]]) }
|
9
|
+
let(:relation) { Relation.new([[:id, Integer]], body) }
|
10
|
+
let(:directions) { [relation[:id]] }
|
11
|
+
let(:order) { relation.sort_by { directions } }
|
12
|
+
let(:operand) { order }
|
13
|
+
let(:limit) { 1 }
|
14
|
+
let(:object) { described_class.new(operand, limit) }
|
15
15
|
|
16
16
|
context 'when the limit is 0' do
|
17
17
|
let(:limit) { 0 }
|
@@ -31,7 +31,7 @@ describe Relation::Operation::Limit, '#optimize' do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'containing an order operation' do
|
34
|
-
it { should
|
34
|
+
it { should be(object) }
|
35
35
|
|
36
36
|
it 'does not execute body#each' do
|
37
37
|
body.should_not_receive(:each)
|
@@ -46,7 +46,7 @@ describe Relation::Operation::Limit, '#optimize' do
|
|
46
46
|
|
47
47
|
it { should be_kind_of(described_class) }
|
48
48
|
|
49
|
-
its(:operand) { should
|
49
|
+
its(:operand) { should be(order) }
|
50
50
|
|
51
51
|
its(:limit) { should == 1 }
|
52
52
|
|
@@ -68,10 +68,10 @@ describe Relation::Operation::Limit, '#optimize' do
|
|
68
68
|
|
69
69
|
it { should be_kind_of(described_class) }
|
70
70
|
|
71
|
-
its(:operand) { should
|
71
|
+
its(:operand) { should be(order) }
|
72
72
|
|
73
73
|
it 'uses the more restrictive object' do
|
74
|
-
subject.limit.
|
74
|
+
expect(subject.limit).to be(5)
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'returns an equivalent relation to the unoptimized operation' do
|
@@ -92,10 +92,10 @@ describe Relation::Operation::Limit, '#optimize' do
|
|
92
92
|
|
93
93
|
it { should be_kind_of(described_class) }
|
94
94
|
|
95
|
-
its(:operand) { should
|
95
|
+
its(:operand) { should be(order) }
|
96
96
|
|
97
97
|
it 'uses the more restrictive object' do
|
98
|
-
subject.limit.
|
98
|
+
expect(subject.limit).to be(5)
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'returns an equivalent relation to the unoptimized operation' do
|
@@ -114,7 +114,7 @@ describe Relation::Operation::Limit, '#optimize' do
|
|
114
114
|
let(:operand) { order.take(10) }
|
115
115
|
let(:limit) { 10 }
|
116
116
|
|
117
|
-
it { should
|
117
|
+
it { should be(operand) }
|
118
118
|
|
119
119
|
it 'returns an equivalent relation to the unoptimized operation' do
|
120
120
|
should == object
|
@@ -129,9 +129,9 @@ describe Relation::Operation::Limit, '#optimize' do
|
|
129
129
|
end
|
130
130
|
|
131
131
|
context 'containing a materialized relation' do
|
132
|
-
let(:relation) { Relation.new([
|
132
|
+
let(:relation) { Relation.new([[:id, Integer]], [[1], [2], [3]]) }
|
133
133
|
|
134
|
-
it { should eql(Relation::Materialized.new([
|
134
|
+
it { should eql(Relation::Materialized.new([[:id, Integer]], [[1]])) }
|
135
135
|
|
136
136
|
it 'returns an equivalent relation to the unoptimized operation' do
|
137
137
|
should == object
|
@@ -5,18 +5,18 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Offset, '#optimize' do
|
6
6
|
subject { object.optimize }
|
7
7
|
|
8
|
-
let(:body) { LazyEnumerable.new([
|
9
|
-
let(:relation) { Relation.new([
|
10
|
-
let(:directions) { [
|
11
|
-
let(:order) { relation.sort_by { directions }
|
12
|
-
let(:operand) { order
|
13
|
-
let(:offset) { 1
|
14
|
-
let(:object) { described_class.new(operand, offset)
|
8
|
+
let(:body) { LazyEnumerable.new([[1], [2], [3]]) }
|
9
|
+
let(:relation) { Relation.new([[:id, Integer]], body) }
|
10
|
+
let(:directions) { [relation[:id]] }
|
11
|
+
let(:order) { relation.sort_by { directions } }
|
12
|
+
let(:operand) { order }
|
13
|
+
let(:offset) { 1 }
|
14
|
+
let(:object) { described_class.new(operand, offset) }
|
15
15
|
|
16
16
|
context 'with an object of 0' do
|
17
17
|
let(:offset) { 0 }
|
18
18
|
|
19
|
-
it { should
|
19
|
+
it { should be(order) }
|
20
20
|
|
21
21
|
it 'returns an equivalent relation to the unoptimized operation' do
|
22
22
|
should == object
|
@@ -31,7 +31,7 @@ describe Relation::Operation::Offset, '#optimize' do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'containing an order operation' do
|
34
|
-
it { should
|
34
|
+
it { should be(object) }
|
35
35
|
|
36
36
|
it 'does not execute body#each' do
|
37
37
|
body.should_not_receive(:each)
|
@@ -46,7 +46,7 @@ describe Relation::Operation::Offset, '#optimize' do
|
|
46
46
|
|
47
47
|
it { should be_kind_of(described_class) }
|
48
48
|
|
49
|
-
its(:operand) { should
|
49
|
+
its(:operand) { should be(order) }
|
50
50
|
|
51
51
|
its(:offset) { should == 1 }
|
52
52
|
|
@@ -68,10 +68,10 @@ describe Relation::Operation::Offset, '#optimize' do
|
|
68
68
|
|
69
69
|
it { should be_kind_of(described_class) }
|
70
70
|
|
71
|
-
its(:operand) { should
|
71
|
+
its(:operand) { should be(order) }
|
72
72
|
|
73
73
|
it 'adds the object of the operations' do
|
74
|
-
subject.offset.
|
74
|
+
expect(subject.offset).to be(15)
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'returns an equivalent relation to the unoptimized operation' do
|
@@ -87,9 +87,9 @@ describe Relation::Operation::Offset, '#optimize' do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
context 'containing a materialized relation' do
|
90
|
-
let(:relation) { Relation.new([
|
90
|
+
let(:relation) { Relation.new([[:id, Integer]], [[1], [2], [3]]) }
|
91
91
|
|
92
|
-
it { should eql(Relation::Materialized.new([
|
92
|
+
it { should eql(Relation::Materialized.new([[:id, Integer]], [[2], [3]])) }
|
93
93
|
|
94
94
|
it 'returns an equivalent relation to the unoptimized operation' do
|
95
95
|
should == object
|
@@ -5,14 +5,14 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Order, '#optimize' do
|
6
6
|
subject { object.optimize }
|
7
7
|
|
8
|
-
let(:body) { LazyEnumerable.new([
|
9
|
-
let(:relation) { Relation.new([
|
10
|
-
let(:operand) { relation
|
11
|
-
let(:directions) { [
|
12
|
-
let(:object) { described_class.new(operand, directions)
|
8
|
+
let(:body) { LazyEnumerable.new([[1], [2], [3]]) }
|
9
|
+
let(:relation) { Relation.new([[:id, Integer]], body) }
|
10
|
+
let(:operand) { relation }
|
11
|
+
let(:directions) { [relation[:id]] }
|
12
|
+
let(:object) { described_class.new(operand, directions) }
|
13
13
|
|
14
14
|
context 'containing a relation' do
|
15
|
-
it { should
|
15
|
+
it { should be(object) }
|
16
16
|
|
17
17
|
it 'does not execute body#each' do
|
18
18
|
body.should_not_receive(:each)
|
@@ -40,7 +40,7 @@ describe Relation::Operation::Order, '#optimize' do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'containing an object operation' do
|
43
|
-
let(:operand) { relation.sort_by { |r| [
|
43
|
+
let(:operand) { relation.sort_by { |r| [r.id.desc] } }
|
44
44
|
|
45
45
|
it { should eql(relation.sort_by { directions }) }
|
46
46
|
|
@@ -76,7 +76,7 @@ describe Relation::Operation::Order, '#optimize' do
|
|
76
76
|
context 'containing a limit(1) operation' do
|
77
77
|
let(:operand) { relation.sort_by { |r| r.id }.take(1) }
|
78
78
|
|
79
|
-
it { should
|
79
|
+
it { should be(operand) }
|
80
80
|
|
81
81
|
it 'returns an equivalent relation to the unoptimized operation' do
|
82
82
|
should == object
|
@@ -91,10 +91,10 @@ describe Relation::Operation::Order, '#optimize' do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
context 'containing a materialized relation' do
|
94
|
-
let(:relation) { Relation.new([
|
95
|
-
let(:object) { described_class.new(relation, directions)
|
94
|
+
let(:relation) { Relation.new([[:id, Integer]], [[1], [2], [3]]) }
|
95
|
+
let(:object) { described_class.new(relation, directions) }
|
96
96
|
|
97
|
-
it { should eql(Relation::Materialized.new([
|
97
|
+
it { should eql(Relation::Materialized.new([[:id, Integer]], [[1], [2], [3]])) }
|
98
98
|
|
99
99
|
it 'returns an equivalent relation to the unoptimized operation' do
|
100
100
|
should == object
|