2017-10-02 17:03:38 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ProcedurePresentation do
|
2017-09-28 11:04:18 +02:00
|
|
|
let (:procedure_presentation_id) {
|
|
|
|
ProcedurePresentation.create(
|
|
|
|
displayed_fields: [
|
|
|
|
{ "label" => "test1", "table" => "user" }.to_json,
|
2018-01-15 19:17:01 +01:00
|
|
|
{ "label" => "test2", "table" => "champs" }.to_json
|
|
|
|
],
|
2017-09-28 11:04:18 +02:00
|
|
|
sort: { "table" => "user","column" => "email","order" => "asc" }.to_json,
|
|
|
|
filters: { "a-suivre" => [], "suivis" => [{ "label" => "label1", "table" => "table1", "column" => "column1" }] }.to_json
|
|
|
|
).id
|
|
|
|
}
|
2017-10-02 17:03:38 +02:00
|
|
|
let (:procedure_presentation) { ProcedurePresentation.find(procedure_presentation_id) }
|
|
|
|
|
|
|
|
describe "#displayed_fields" do
|
2018-01-16 13:34:24 +01:00
|
|
|
it { expect(procedure_presentation.displayed_fields).to eq([{ "label" => "test1", "table" => "user" }, { "label" => "test2", "table" => "champs" }]) }
|
2017-10-02 17:03:38 +02:00
|
|
|
end
|
2017-09-27 15:16:07 +02:00
|
|
|
|
|
|
|
describe "#sort" do
|
|
|
|
it { expect(procedure_presentation.sort).to eq({ "table" => "user","column" => "email","order" => "asc" }) }
|
|
|
|
end
|
2017-09-28 11:04:18 +02:00
|
|
|
|
|
|
|
describe "#filters" do
|
|
|
|
it { expect(procedure_presentation.filters).to eq({ "a-suivre" => [], "suivis" => [{ "label" => "label1", "table" => "table1", "column" => "column1" }] }) }
|
|
|
|
end
|
2017-10-02 17:03:38 +02:00
|
|
|
end
|