test/unit/server_tests.rb in sanford-0.11.1 vs test/unit/server_tests.rb in sanford-0.12.0
- old
+ new
@@ -21,12 +21,11 @@
should have_imeths :configuration
should have_imeths :name, :ip, :port, :pid_file
should have_imeths :receives_keep_alive
should have_imeths :verbose_logging, :logger
should have_imeths :init, :error
- should have_imeths :router
- should have_imeths :template_source, :build_template_source
+ should have_imeths :router, :template_source
should "know its configuration" do
config = subject.configuration
assert_instance_of Configuration, config
assert_same config, subject.configuration
@@ -115,24 +114,10 @@
subject.template_source(new_template_source)
assert_equal new_template_source, subject.configuration.template_source
assert_equal new_template_source, subject.template_source
end
- should "allow setting its template source with a path and block" do
- new_path = Factory.string
- yielded = nil
- subject.build_template_source(new_path){ |s| yielded = s }
- assert_equal new_path, subject.configuration.template_source.path
- assert_equal subject.configuration.template_source, yielded
- end
-
- should "allow setting its template source with only a path" do
- new_path = Factory.string
- subject.build_template_source(new_path)
- assert_equal new_path, subject.configuration.template_source.path
- end
-
end
class InitTests < UnitTests
desc "when init"
setup do
@@ -446,16 +431,15 @@
assert_equal subject.router.routes, subject.routes
subject.router.service(Factory.string, TestHandler.to_s)
assert_equal subject.router.routes, subject.routes
end
- should "include its routes, error procs and template source in its hash" do
+ should "include its init/error procs and router/routes in its `to_hash`" do
config_hash = subject.to_hash
+ assert_equal subject.init_procs, config_hash[:init_procs]
assert_equal subject.error_procs, config_hash[:error_procs]
+ assert_equal subject.router, config_hash[:router]
assert_equal subject.routes, config_hash[:routes]
- template_source = subject.template_source
- assert_instance_of template_source.class, config_hash[:template_source]
- assert_equal template_source.path, config_hash[:template_source].path
end
should "call its init procs when validated" do
called = false
subject.init_procs << proc{ called = true }