Sha256: aa64f53aa8e0d09958676a80de41c49c8baaedc5400154e6d16664e329becaae

Contents?: true

Size: 1007 Bytes

Versions: 28

Compression:

Stored size: 1007 Bytes

Contents

require 'test_helper'

class ScreenUsingModel
  include SsciInc::Screening::Model

  attr_accessor :a, :b, :c

end

module SsciInc
  module Screening
    class ModelTest < Test::Unit::TestCase
      subject { ScreenUsingModel.new }

      context "#to_xml" do
        should "call as_xml and to_xml on that object" do
          xml = "<a>woot</a>"
          subject.expects(:as_xml).returns(mock(:to_xml => xml))
          assert_equal xml, subject.to_xml
        end
      end

      context "#builder" do
        should "build a Screening xml node with supplied attributes" do
          node = mock
          attributes = {:a => "a"}
          Nokogiri::XML::Builder.any_instance.expects(:Screening).
                                              with(attributes)
          Nokogiri::XML::Builder.any_instance.expects(:parent => mock(
                                                        :root => node))
          assert_equal node, subject.builder(attributes)
        end
      end

    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ssci_inc-0.1.7 test/unit/screening/model_test.rb
ssci_inc-0.1.6 test/unit/screening/model_test.rb
ssci_inc-0.1.5 test/unit/screening/model_test.rb
ssci_inc-0.1.4 test/unit/screening/model_test.rb
ssci_inc-0.1.3 test/unit/screening/model_test.rb
ssci_inc-0.1.2 test/unit/screening/model_test.rb
ssci_inc-0.1.1 test/unit/screening/model_test.rb
ssci_inc-0.1.0 test/unit/screening/model_test.rb