Skip to content

Commit

Permalink
fixed filter_for_schedule to return Hash and added rspec for it
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Aug 7, 2019
1 parent 962897c commit b989704
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/miq_widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def self.sync_from_hash(attrs)
end

def filter_for_schedule
%["=" => {"field" => "MiqWidget-id", "value" => #{id}}]
{"=" => {"field" => "MiqWidget-id", "value" => id}}
end

def sync_schedule(schedule_info)
Expand Down
7 changes: 7 additions & 0 deletions spec/models/miq_widget_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
'))
end

describe "#filter_for_schedule" do
it "returns Hash object representing valid MiqExpression" do
exp = MiqExpression.new(@widget_chart_vendor_and_guest_os.filter_for_schedule)
expect(exp.valid?).to be_truthy
end
end

describe "#sync_schedule" do
let(:schedule) do
filter = @widget_chart_vendor_and_guest_os.filter_for_schedule
Expand Down

0 comments on commit b989704

Please sign in to comment.