Нет описания http://j1x-huginn.herokuapp.com

json_path_options_overwritable.rb 1.0KB

1234567891011121314151617181920212223242526272829303132
  1. require 'spec_helper'
  2. shared_examples_for JsonPathOptionsOverwritable do
  3. before(:each) do
  4. @valid_params = described_class.new.default_options
  5. @checker = described_class.new(:name => "somename", :options => @valid_params)
  6. @checker.user = users(:jane)
  7. @event = Event.new
  8. @event.agent = agents(:bob_weather_agent)
  9. @event.payload = { :room_name => 'test room', :message => 'Looks like its going to rain', username: "Huggin user"}
  10. @event.save!
  11. end
  12. describe "select_option" do
  13. it "should use the room_name_path if specified" do
  14. @checker.options['room_name_path'] = "$.room_name"
  15. @checker.send(:select_option, @event, :room_name).should == "test room"
  16. end
  17. it "should use the normal option when the path option is blank" do
  18. @checker.options['room_name'] = 'test'
  19. @checker.send(:select_option, @event, :room_name).should == "test"
  20. end
  21. end
  22. it "should merge all options" do
  23. @checker.send(:merge_json_path_options, @event).symbolize_keys.keys.should == @checker.send(:options_with_path)
  24. end
  25. end