spec/models/data_grid_spec.rb in marty-2.0.2 vs spec/models/data_grid_spec.rb in marty-2.0.3
- old
+ new
@@ -195,23 +195,10 @@
}.to raise_error(RuntimeError)
end
end
describe "validations" do
- it "a basic data grid should load ok" do
- dg_from_import("G1", G1)
- dg_from_import("G2", G2)
- dg_from_import("G3", G3)
- dg_from_import("G8", G8)
- dg_from_import("Ga", Ga)
-
- inc = {"include_attrs"=>"name"}
- expect(Marty::DataGrid.lookup('infinity', "G1", inc).name).to eq "G1"
- expect(Marty::DataGrid.lookup('infinity', "G2", inc).name).to eq "G2"
- expect(Marty::DataGrid.lookup('infinity', "G3", inc).name).to eq "G3"
- end
-
it "should not allow bad axis types" do
expect {
dg_from_import("Gi", Gi)
}.to raise_error(/unknown metadata type float/)
expect {
@@ -414,11 +401,11 @@
},
)
expect(res).to eq [5.6,"G2"]
}
- dg = Marty::DataGrid.lookup('infinity', "G1", {"no_convert"=>true})
+ dg = Marty::DataGrid.find_by(obsoleted_dt: 'infinity', name: "G1")
h = {
"fico" => 600,
"state" => "RI",
"ltv" => 10,
@@ -579,11 +566,11 @@
)
expect(g1_res).to eq res
end
it "should handle DataGrid typed data grids" do
- g1 = Marty::DataGrid.lookup('infinity', "G1", {"no_convert"=>true})
+ g1 = Marty::DataGrid.find_by(obsoleted_dt: 'infinity', name: "G1")
res = lookup_grid_helper('infinity',
"Ga",
{"dg" => g1,
},
@@ -714,23 +701,19 @@
# right single, left double, right double
quotes = ["'", '"', '\\', '`', "\u00b4", "\u2018", "\u2019",
"\u201C", "\u201D"]
100.times do
st = 30.times.map{quotes[rand(9)]}.join
- res = Marty::DataGrid.lookup_grid_distinct_entry_h(pt, { "ltv" => 10,
- "fico" => 690,
- "state" => st }, dgh, nil,
- false, true)
+ res = Marty::DataGrid.lookup_grid_distinct_entry_h(
+ pt, {"ltv" => 10, "fico" => 690, "state" => st}, dgh, nil, false, true)
end
end
it "should handle quote chars in object name" do
dgh = Marty::DataGrid.lookup_h(pt, 'G1')
st = Gemini::State.new(name: "'\\")
- res = Marty::DataGrid.lookup_grid_distinct_entry_h(pt, { "ltv" => 10,
- "fico" => 690,
- "state" => st }, dgh, nil,
- false, true)
+ res = Marty::DataGrid.lookup_grid_distinct_entry_h(
+ pt, {"ltv" => 10, "fico" => 690, "state" => st}, dgh, nil, false, true)
end
end
describe "exports" do
it 'should export lenient grids correctly' do
@@ -812,22 +795,16 @@
expect(sum).to eq({same: 1})
res11 = res.sub(/G1/, "G11")
- sum = do_import_summary(Marty::DataGrid,
- res11,
- 'infinity',
- nil,
- nil,
- ",",
- )
+ sum = do_import_summary(
+ Marty::DataGrid, res11, 'infinity', nil, nil, ",")
expect(sum).to eq({create: 1})
- nc = {"no_convert"=>true}
- g1 = Marty::DataGrid.lookup('infinity', "G1", nc)
- g11 = Marty::DataGrid.lookup('infinity', "G11", nc)
+ g1 = Marty::DataGrid.find_by(obsoleted_dt: 'infinity', name: "G1")
+ g11 = Marty::DataGrid.find_by(obsoleted_dt: 'infinity', name: "G11")
expect(g1.export).to eq g11.export
end
end
end