Sha256: 6d7eef667897d4ada0809e980ca792e3904314d7784a320e8ddcd2a1dd4fcad5

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

class CssProxyTest < Test::Unit::TestCase
  it "should have method_missing as private" do
    methods = Markaby::CssProxy.private_instance_methods.dup
    methods.map! { |m| m.to_sym }

    methods.should include(:method_missing)
  end

  def mock_builder
    mock_builder = Class.new do
      def tag!(*args); end
    end.new
  end

  def test_responds_to_everything
    proxy = Markaby::CssProxy.new(mock_builder, 'stream', :sym)

    assert proxy.respond_to?(:any_method)
    assert proxy.respond_to?(:foobarbazasdfasdfadfs)
  end

  def test_does_not_respond_to_method_missing
    proxy = Markaby::CssProxy.new(mock_builder, 'stream', :sym)

    assert !proxy.respond_to?(:method_missing)
  end

  def test_does_respond_to_private_instance_methods_with_private_flag_set_to_true
    proxy = Markaby::CssProxy.new(mock_builder, 'stream', :sym)

    assert proxy.respond_to?(:method_missing, true)
  end

  def test_does_not_respond_to_private_instance_methods_with_private_flag_set_to_false
    proxy = Markaby::CssProxy.new(mock_builder, 'stream', :sym)

    assert !proxy.respond_to?(:method_missing, false)
  end

  def test_respond_to_should_always_return_boolean
    proxy = Markaby::CssProxy.new(mock_builder, 'stream', :sym)

    assert_equal proxy.respond_to?(:method_missing, :a_value), true
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mab-0.0.2 markaby/spec/markaby/css_proxy_test.rb
markaby-0.7.2 spec/markaby/css_proxy_test.rb
markaby-0.7.1 spec/markaby/css_proxy_spec.rb
markaby-0.7.0 spec/markaby/css_proxy_spec.rb
markaby-0.6.10 spec/markaby/css_proxy_spec.rb
markaby-0.6.9 spec/markaby/css_proxy_spec.rb
markaby-0.6.8 spec/markaby/css_proxy_spec.rb
markaby-0.6.7 spec/markaby/css_proxy_spec.rb
markaby-0.6.6 spec/markaby/css_proxy_spec.rb