Sha256: 74f79abf4222e8a2f3b3ac6dac0a9baf0b17437e906ab7c59ba6f66841a6e00c
Contents?: true
Size: 1.07 KB
Versions: 46
Compression:
Stored size: 1.07 KB
Contents
require "rails_helper" module Dorsale describe SmallData::Filter do let(:jar) { {} } let(:filter) { {"name" => "bidule"} } let(:f) { Dorsale::SmallData::Filter.new(jar) } describe "store" do it "should store the provided hash as json in the jar" do f.store(filter) expect(jar["filters"]).to eq filter.to_json end end describe "read" do it "should read stored filters" do f.store(filter) expect(f.read).to eq(filter) end it "should return empty hash by default" do expect(f.read).to eq({}) end it "should return empty hash on invalid json" do jar["filters"] = "ce json est invalide" expect(f.read).to eq({}) end end describe "get" do it "should return the value" do f.store(filter) expect(f.get("name")).to eq("bidule") end end describe "set" do it "should set the value" do f.store(filter) f.set("new", "truc") expect(f.get("new")).to eq("truc") end end end end
Version data entries
46 entries across 46 versions & 1 rubygems