test/exposure_test.rb in neo-rails-0.1.0 vs test/exposure_test.rb in neo-rails-0.1.1
- old
+ new
@@ -28,10 +28,15 @@
end
def expose_with_error
expose(:unknown) { "unknown" }
end
+
+ def expose_nil_value
+ expose(:a) { nil }
+ render :inline => [ exposed?(:a), exposed?(:b) ].inspect
+ end
end
class OtherExposureTestController < ExposureTestController
include Neo::Rails::Exposure
@@ -65,16 +70,18 @@
end
end
class ExposureTestApp < Rails::Application
routes.draw do
- match ":action" => ExposureTestController
- match "other/:action" => OtherExposureTestController
- match "a/:action" => ATestController
- match "b/:action" => BTestController
+ get ":action" => ExposureTestController
+ get "other/:action" => OtherExposureTestController
+ get "a/:action" => ATestController
+ get "b/:action" => BTestController
end
+ config.secret_key_base = "a" * 32
+ config.secret_token = "a" * 32
config.session_store :disabled
config.middleware.delete Rails::Rack::Logger
config.middleware.delete ActionDispatch::ShowExceptions
config.middleware.delete ActionDispatch::DebugExceptions
end
@@ -98,9 +105,14 @@
test "should raise an error when exposing an undeclared variable" do
assert_raises Neo::Rails::Exposure::UndeclaredVariableError do
get :expose_with_error
end
+ end
+
+ test "exposes nil value" do
+ get :expose_nil_value
+ assert_equal [ true, false ].inspect, last_response.body
end
test "exposes vars in subclass" do
get "other/bar"
assert_equal "a;b;c", last_response.body