OSDN Git Service

Add Unit model, and many fixes to use it
[mint/mint-server.git] / spec / factories / problem.rb
index 731e426..f25ddcf 100644 (file)
@@ -1,13 +1,12 @@
 Factory.define :problem do |m|
   m.label "label"
-  m.unit "unit"
   m.level 1
   m.amount 2
   m.options({ :term_number => 2, :operators => %w[+ - * div] }.to_json)
 end
 
-Factory.define :ordinary_arithmetic, :parent => :problem do |m|
-  m.unit "ordinary_arithmetic"
+Factory.define :ordinary_arithmetic_level_1, :parent => :problem do |m|
+  m.unit{|u| u.association(:ordinary_arithmetic) }
   m.level 1
   m.options({
               :minus => true, :min => 0, :max => 100,
@@ -16,8 +15,8 @@ Factory.define :ordinary_arithmetic, :parent => :problem do |m|
             }.to_json)
 end
 
-Factory.define :decimal_arithmetic, :parent => :problem do |m|
-  m.unit "decimal_arithmetic"
+Factory.define :decimal_arithmetic_level_1, :parent => :problem do |m|
+  m.unit{|u| u.association "decimal_arithmetic" }
   m.level 1
   m.options({
               :minus => true, :digits => 2, :min => 0, :max => 10.0,
@@ -26,8 +25,8 @@ Factory.define :decimal_arithmetic, :parent => :problem do |m|
             }.to_json)
 end
 
-Factory.define :fractional_arithmetic, :parent => :problem do |m|
-  m.unit "fractional_arithmetic"
+Factory.define :fractional_arithmetic_level_1, :parent => :problem do |m|
+  m.unit{ u.association "fractional_arithmetic" }
   m.level 1
   m.options({
               :minus => true,
@@ -36,8 +35,8 @@ Factory.define :fractional_arithmetic, :parent => :problem do |m|
             }.to_json)
 end
 
-Factory.define :factorization, :parent => :problem do |m|
-  m.unit "factorization"
+Factory.define :factorization_level_1, :parent => :problem do |m|
+  m.unit{|u| u.association  "factorization" }
   m.level 1
   m.options({
               :order_min => 2, :order_max => 3, :x => %w[x y z],
@@ -45,8 +44,8 @@ Factory.define :factorization, :parent => :problem do |m|
             }.to_json)
 end
 
-Factory.define :expansion, :parent => :problem do |m|
-  m.unit "expansion"
+Factory.define :expansion_level_1, :parent => :problem do |m|
+  m.unit{|u| u.association "expansion" }
   m.level 1
   m.options({
               :order_min => 2, :order_max => 3, :x => %w[x y z],