Sha256: 8b1bbdc2b2684356a681e03c08539ae3d51ecb227020523db30a93f1090001a0

Contents?: true

Size: 1.67 KB

Versions: 48

Compression:

Stored size: 1.67 KB

Contents

require 'test_helper'

class SessionExtensionsTest < ActionDispatch::IntegrationTest

  VIEW_METHODS = [
      :user_id_cookie,
      :user_token_cookie,
      :current_user,
      :current_user?,
      :logged_in?,
      :system_admin?
  ]

  CONTROLLER_METHODS = [
      :log_in,
      :log_out,
      :remember,
      :forget
  ]

  # A broken mailer just to check for methods.
  class TestMailer < ActionMailer::Base

    def self.create_instance
      new
    end

  end

  test 'test has correct methods' do
    VIEW_METHODS.each do |m|
      assert respond_to?(m), "Test should respond to #{m.inspect}."
    end
    CONTROLLER_METHODS.each do |m|
      assert_not respond_to?(m), "Test should not respond to #{m.inspect}."
    end
  end

  test 'view has correct methods' do
    view = ActionView::Base.new
    VIEW_METHODS.each do |m|
      assert view.respond_to?(m), "View should respond to #{m.inspect}."
    end
    CONTROLLER_METHODS.each do |m|
      assert_not view.respond_to?(m), "View should not respond to #{m.inspect}."
    end
  end

  test 'controller has correct methods' do
    ctrlr = ActionController::Base.new
    VIEW_METHODS.each do |m|
      assert ctrlr.respond_to?(m), "Controller should respond to #{m.inspect}."
    end
    CONTROLLER_METHODS.each do |m|
      assert ctrlr.respond_to?(m), "Controller should respond to #{m.inspect}."
    end
  end

  test 'mailer has correct methods' do
    mailer = TestMailer.create_instance
    VIEW_METHODS.each do |m|
      assert mailer.respond_to?(m), "Mailer should respond to #{m.inspect}."
    end
    CONTROLLER_METHODS.each do |m|
      assert_not mailer.respond_to?(m), "Mailer should not respond to #{m.inspect}."
    end
  end

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
incline-0.3.14 test/extensions/session_extensions_test.rb
incline-0.3.13 test/extensions/session_extensions_test.rb
incline-0.3.12 test/extensions/session_extensions_test.rb
incline-0.3.11 test/extensions/session_extensions_test.rb
incline-0.3.10 test/extensions/session_extensions_test.rb
incline-0.3.9 test/extensions/session_extensions_test.rb
incline-0.3.8 test/extensions/session_extensions_test.rb
incline-0.3.7 test/extensions/session_extensions_test.rb
incline-0.3.6 test/extensions/session_extensions_test.rb
incline-0.3.5 test/extensions/session_extensions_test.rb
incline-0.3.4 test/extensions/session_extensions_test.rb
incline-0.3.3 test/extensions/session_extensions_test.rb
incline-0.3.2 test/extensions/session_extensions_test.rb
incline-0.3.1 test/extensions/session_extensions_test.rb
incline-0.3.0 test/extensions/session_extensions_test.rb
incline-0.2.36 test/extensions/session_extensions_test.rb
incline-0.2.35 test/extensions/session_extensions_test.rb
incline-0.2.34 test/extensions/session_extensions_test.rb
incline-0.2.28 test/extensions/session_extensions_test.rb
incline-0.2.27 test/extensions/session_extensions_test.rb