Sha256: 31178f788663d2d09dab3e18ec79a86f005d225d9f87538e624c94ec94b1b0ed

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe GoogleAppsOauth2::Atom::Node do
  let (:node_class) { class TestNode < BasicObject; include ::GoogleAppsOauth2::Atom::Node; end }
  let (:node) { node_class.new }
  let (:document) { LibXML::XML::Document.file('spec/fixture_xml/users_feed.xml') }

  describe "#create_node" do
    it "Creates a LibXML::XML::Node with the given attributes" do
      sample = node.create_node type: 'apps:nickname', attrs: [['name', 'Bob']]

      sample.to_s.should include 'apps:nickname name="Bob"'
    end

    it "Creates a Node with multiple attributes" do
      sample = node.create_node type: 'apps:nickname', attrs: [['name', 'Lou'], ['type', 'fake']]

      sample.to_s.should include 'apps:nickname name="Lou" type="fake"'
    end

    it "Creates a LibXML::XML::Node without attributes if none are given" do
      (node.create_node type: 'apps:nickname').to_s.should include 'apps:nickname'
    end
  end

  describe "#add_attributes" do
    it "Adds the specified attributes to the given node" do
      test = LibXML::XML::Node.new 'apps:test'
      node.add_attributes(test, [['name', 'frank'], ['title', 'captain']])

      test.to_s.should include 'name="frank" title="captain"'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google_apps_oauth2-0.1 spec/google_apps_oauth2/atom/node_spec.rb