Sha256: 2863000f7124af0a1774cc48c40af2cf6b15068416640ead9eb4bbefc2c5d5dd

Contents?: true

Size: 1.56 KB

Versions: 5

Compression:

Stored size: 1.56 KB

Contents

#!/usr/bin/env ruby

# Example of the basic structure of a directive unit test
# The location of lib/masterview code base and the mv test directory 
# depends on your development system configuration,
# as does the location of your directive implementation class.

# you need to customize these root dir references for your configuration
mv_installation_dir = File.expand_path(File.join( File.dirname(__FILE__), '../..' ))
directives_dir = File.join( mv_installation_dir, 'test/fixtures/directives' )

# standard imports for a directive unit test: Test::Unit, masterview, and 
# # your directive class along with the DirectiveTestHelpers test framework.
require 'test/unit'
require File.join( mv_installation_dir, 'lib/masterview' )  # masterview engine
require File.join( mv_installation_dir, 'test/directive_test_helper' )
DirectiveTestHelpers.load_directive('id_check', directives_dir)

class TestExample < Test::Unit::TestCase
  include DirectiveTestHelpers

  IdCheck = MasterView::DirectiveTests::IdCheck  # test subject

  ELEMENT_TAG = 'div'

  def test_metadata
    # addon directives map to the mvx: namespace by default
    assert_equal MasterView::ConfigSettings.namespace_prefix_extensions, IdCheck.namespace_prefix
    assert_equal MasterView::ConfigSettings.namespace_prefix_extensions, IdCheck.namespace_name+':'
    assert_equal 'id_check', IdCheck.attribute_name
    assert_equal "#{MasterView::ConfigSettings.namespace_prefix_extensions}id_check", IdCheck.attribute_qname
  end

  def test_something
    #put a test case to exercise your directive's processing here
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masterview-0.3.1 test/unit/example_test.rb
masterview-0.3.0 test/unit/example_test.rb
masterview-0.3.2 test/unit/example_test.rb
masterview-0.3.3 test/unit/example_test.rb
masterview-0.3.4 test/unit/example_test.rb