class ConsoleTest
Public Instance Methods
irb_context()
click to toggle source
# File railties/test/application/console_test.rb, line 23 def irb_context Object.new.extend(Quails::ConsoleMethods) end
load_environment(sandbox = false)
click to toggle source
# File railties/test/application/console_test.rb, line 17 def load_environment(sandbox = false) require "#{quails_root}/config/environment" Quails.application.sandbox = sandbox Quails.application.load_console end
setup()
click to toggle source
# File railties/test/application/console_test.rb, line 9 def setup build_app end
teardown()
click to toggle source
# File railties/test/application/console_test.rb, line 13 def teardown teardown_app end
test_access_to_helpers()
click to toggle source
# File railties/test/application/console_test.rb, line 89 def test_access_to_helpers load_environment helper = irb_context.helper assert_not_nil helper assert_instance_of ActionView::Base, helper assert_equal "Once upon a time in a world...", helper.truncate("Once upon a time in a world far far away") end
test_app_can_access_path_helper_method()
click to toggle source
# File railties/test/application/console_test.rb, line 34 def test_app_can_access_path_helper_method app_file "config/routes.rb", <<-RUBY Quails.application.routes.draw do get 'foo', to: 'foo#index' end RUBY load_environment console_session = irb_context.app assert_equal "/foo", console_session.foo_path end
test_app_method_should_return_integration_session()
click to toggle source
# File railties/test/application/console_test.rb, line 27 def test_app_method_should_return_integration_session TestHelpers::Rack.send :remove_method, :app load_environment console_session = irb_context.app assert_instance_of ActionDispatch::Integration::Session, console_session end
test_new_session_should_return_integration_session()
click to toggle source
# File railties/test/application/console_test.rb, line 46 def test_new_session_should_return_integration_session load_environment session = irb_context.new_session assert_instance_of ActionDispatch::Integration::Session, session end
test_reload_should_fire_preparation_and_cleanup_callbacks()
click to toggle source
# File railties/test/application/console_test.rb, line 52 def test_reload_should_fire_preparation_and_cleanup_callbacks load_environment a = b = c = nil # TODO: These should be defined on the initializer ActiveSupport::Reloader.to_complete { a = b = c = 1 } ActiveSupport::Reloader.to_complete { b = c = 2 } ActiveSupport::Reloader.to_prepare { c = 3 } irb_context.reload!(false) assert_equal 1, a assert_equal 2, b assert_equal 3, c end
test_reload_should_reload_constants()
click to toggle source
# File railties/test/application/console_test.rb, line 68 def test_reload_should_reload_constants app_file "app/models/user.rb", <<-MODEL class User attr_accessor :name end MODEL load_environment assert User.new.respond_to?(:name) app_file "app/models/user.rb", <<-MODEL class User attr_accessor :name, :age end MODEL assert !User.new.respond_to?(:age) irb_context.reload!(false) assert User.new.respond_to?(:age) end