Skip to content

Commit

Permalink
Merge pull request #17215 from yrudman/remove-temporary-tokens-from-e…
Browse files Browse the repository at this point in the history
…xpression-after-substitution

Fixed error with dialog expression when virtual column involved
  • Loading branch information
gtanzillo authored Apr 5, 2018
2 parents f10ac92 + a199611 commit 54589f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/miq_expression/subst_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def exp_replace_qs_tokens(exp, tokens)
end
exp[key]["value"] = value # Replace the exp value with the proper qs value
end
exp.delete(:token)
end
end

Expand Down
12 changes: 12 additions & 0 deletions spec/lib/miq_expression/subst_mixin_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RSpec.describe MiqExpression::SubstMixin do
let(:test_class) { Class.new { include MiqExpression::SubstMixin } }
let(:test_obj) { test_class.new }

describe "#exp_replace_qs_tokens" do
it "removes :token key from passed expression" do
exp = {"and" => [{"=" => {"field" => "Vm-active", "value" => "true"}, :token => 1}, {"=" => {"field" => "Vm-archived", "value" => "true"}, :token => 2}]}
test_obj.exp_replace_qs_tokens(exp, {})
expect(exp).to eq("and" => [{"=" => {"field" => "Vm-active", "value" => "true"}}, {"=" => {"field" => "Vm-archived", "value" => "true"}}])
end
end
end

0 comments on commit 54589f6

Please sign in to comment.