Permalink
Browse files

Added :condition modifier to cubicle DSL, allowing the formal specifi…

…cation of boolean conditions which control whether a value is emitted for each document during an aggregation, or if a null is emitted instead.
  • Loading branch information...
1 parent 24f459a commit 1883e41079685a6931addc5e304b6682cc2cd2a3 @PlasticLizard committed Mar 30, 2010
Showing with 7 additions and 3 deletions.
  1. +1 −1 cubicle.gemspec
  2. +1 −0 lib/cubicle/member.rb
  3. +5 −0 test/cubicle/cubicle_query_test.rb
  4. +0 −2 test/cubicle/duration_test.rb
View
@@ -5,7 +5,7 @@
Gem::Specification.new do |s|
s.name = %q{cubicle}
- s.version = "0.1.5"
+ s.version = "0.1.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nathan Stults"]
View
@@ -22,6 +22,7 @@ def initialize(*args)
@expression_type = :javascript
else
@expression = @name
+ @field_name = @name
@expression_type = :field_name
end
@@ -106,6 +106,7 @@ class CubicleQueryTest < ActiveSupport::TestCase
assert_equal "Sad Day Moonshine", @results[0]["product"]
assert_equal 3, @results[0]["total_defects"]
assert_equal 2, @results[0]["preventable_defects"]
+ assert_equal 2, @results[0]["conditioned_preventable"]
assert_equal 15.91, @results[0]["total_cost"]
assert_equal 15.91/3, @results[0]["avg_cost"]
assert_equal 2/3.0, @results[0]["preventable_pct"]
@@ -145,6 +146,7 @@ class CubicleQueryTest < ActiveSupport::TestCase
assert_equal "Sad Day Moonshine", @results[0]["product"]
assert_equal 3, @results[0]["total_defects"]
assert_equal 2, @results[0]["preventable_defects"]
+ assert_equal 2, @results[0]["conditioned_preventable"]
assert_in_delta 15.91, @results[0]["total_cost"],0.0001
assert_in_delta 15.91/3, @results[0]["avg_cost"],0.0001
assert_in_delta 2/3.0, @results[0]["preventable_pct"],0.0001
@@ -181,6 +183,7 @@ class CubicleQueryTest < ActiveSupport::TestCase
assert_equal "Sad Day Moonshine", @results[0]["product"]
assert_equal 3, @results[0]["total_defects"]
assert_equal 2, @results[0]["preventable_defects"]
+ assert_equal 2, @results[0]["conditioned_preventable"]
assert_in_delta 15.91, @results[0]["total_cost"],0.0001
assert_in_delta 15.91/3, @results[0]["avg_cost"],0.0001
assert_equal 2/3.0, @results[0]["preventable_pct"]
@@ -200,6 +203,7 @@ class CubicleQueryTest < ActiveSupport::TestCase
assert_equal "Sad Day Moonshine", @results[0]["product"]
assert_equal 3, @results[0]["total_defects"]
assert_equal 2, @results[0]["preventable_defects"]
+ assert_equal 2, @results[0]["conditioned_preventable"]
assert_equal 15.91, @results[0]["total_cost"]
assert_equal 15.91/3, @results[0]["avg_cost"]
assert_equal 2/3.0, @results[0]["preventable_pct"]
@@ -372,6 +376,7 @@ class CubicleQueryTest < ActiveSupport::TestCase
assert_equal "Sad Day Moonshine", results[0]["product"]
assert_equal 3, results[0]["total_defects"]
assert_equal 2, results[0]["preventable_defects"]
+ assert_equal 2, results[0]["conditioned_preventable"]
assert_in_delta 15.91, results[0]["total_cost"],0.0001
assert_in_delta 15.91/3, results[0]["avg_cost"],0.0001
assert_in_delta 2/3.0, results[0]["preventable_pct"],0.0001
@@ -47,7 +47,6 @@ class DurationTest < ActiveSupport::TestCase
results = DefectCubicle.query do
select :all_measures, :product
end
- puts results.inspect
results = results[0]
assert_equal((6+5)/2.0, results["ms3_to_now_average"])
@@ -58,7 +57,6 @@ class DurationTest < ActiveSupport::TestCase
results = DefectCubicle.query do
select :all_measures, :product
end
- puts results.inspect
results = results[0]
assert_equal((6+5)/2.0, results["avg_time_since_ms3"])

0 comments on commit 1883e41

Please sign in to comment.