Sha256: b034ed86adf81524f69c3eaad752e31025210c4e90ac9dbc54f00fd23cc7d093

Contents?: true

Size: 1.35 KB

Versions: 12

Compression:

Stored size: 1.35 KB

Contents

module Zena
  module Controller
    class TestCase < ActionController::TestCase
      include Zena::Use::Fixtures
      include Zena::Use::TestHelper
      include Zena::Acts::Secure
      include ::Authlogic::TestCase

      def setup
        activate_authlogic
      end

      def login(fixture)
        super
        if defined?(@controller)
          @controller.class_eval do
            def set_visitor
              # do nothing
            end
          end
        end
      end

      %w{get post put delete}.each do |method|
        class_eval <<-END_TXT
          def #{method}_subject
            without_files('test.host/zafu') do
              #{method} subject.delete(:action), subject
              if block_given?
                yield
              end
            end
          end
        END_TXT
      end

      def assert_match(match, target)
        return super if match.kind_of?(Regexp)
        target = Hpricot(target)
        assert !target.search(match).empty?,
          "expected tag, but no tag found matching #{match.inspect} in:\n#{target.inspect}"
      end

      def assert_no_match(match, target)
        return super if match.kind_of?(Regexp)
        target = Hpricot(target)
        assert target.search(match).empty?,
          "expected not tag, but tag found matching #{match.inspect} in:\n#{target.inspect}"
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
zena-1.2.5 lib/zena/controller/test_case.rb
zena-1.2.4 lib/zena/controller/test_case.rb
zena-1.2.3 lib/zena/controller/test_case.rb
zena-1.2.2 lib/zena/controller/test_case.rb
zena-1.2.1 lib/zena/controller/test_case.rb
zena-1.2.0 lib/zena/controller/test_case.rb
zena-1.1.3 lib/zena/controller/test_case.rb
zena-1.1.2 lib/zena/controller/test_case.rb
zena-1.1.1 lib/zena/controller/test_case.rb
zena-1.1.0 lib/zena/controller/test_case.rb
zena-1.0.0 lib/zena/controller/test_case.rb
zena-1.0.0.rc3 lib/zena/controller/test_case.rb