Sha256: e6744aa80cf1eb6cf89d2069a75fb7b539c6f8d84055b35d70162bb4b01af0c9

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper'))
require 'meac_control/xml/get_request'

class Dev; end
class Cmd; end

describe MEACControl::XML::GetRequest do
  it "inherits from the MEACControl::XML::AbstractRequest class" do
    req = MEACControl::XML::GetRequest.new(:one, [:one, :two, :three])
    req.should be_kind_of(MEACControl::XML::AbstractRequest)
  end

  describe "#to_xml" do
    it "returns a xml string with 'getRequest' in the <Command> element" do
      device = mock(Dev, :id => 23)
      commands = [
        mock(Cmd, :hash_for => {:Command1 => 'ON'}),
        mock(Cmd, :hash_for => {:Command2 => 'ON'}),
        mock(Cmd, :hash_for => {:Command3  => 'ON'})
      ]
      req = MEACControl::XML::GetRequest.new(device, commands)
      xml = Nokogiri::XML(req.to_xml)
      xml.root.at('/Packet/Command').text.should == "getRequest"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
meac_control-1.0.0 spec/lib/meac_control/xml/get_request_spec.rb