Sha256: 6899eff7c28a96ea88cc05438e5a8b633bfc96a2b86848d31c3356bf4b71155f
Contents?: true
Size: 1.32 KB
Versions: 47
Compression:
Stored size: 1.32 KB
Contents
# -*- encoding : utf-8 -*- describe Card::Content::Chunk::QueryReference, "QueryReference" do context "syntax parsing" do before do @class = Card::Content::Chunk::QueryReference end subject { query_refs.first.name } let :query_refs do content = Card::Content.new @content, Card.new(type: "Search") content.find_chunks(Card::Content::Chunk::QueryReference) end it "handles simple search" do @content = '{"name":"Waldo"}' is_expected.to eq "Waldo" end it "handles operators" do @content = '{"name":["eq","Waldo"]}' is_expected.to eq "Waldo" end it "handles multiple values for operators" do @content = '{"name":["in","Where","Waldo"]}' expect(query_refs[1].name).to eq "Waldo" end it "handles plus attributes" do @content = '{"right_plus":["Waldo",{"content":"here"}]}' is_expected.to eq "Waldo" end it "handles nested query structures" do @content = '{"any":{"content":"Where", ' \ '"right_plus":["is",{"name":"Waldo"}]}}' expect(query_refs[0].name).to eq "Where" expect(query_refs[1].name).to eq "is" expect(query_refs[2].name).to eq "Waldo" end it "handles contextual names" do @content = '{"name":"_+Waldo"}' is_expected.to eq "_+Waldo" end end end
Version data entries
47 entries across 47 versions & 1 rubygems