spec/exposure_spec.rb in exposure-0.0.6 vs spec/exposure_spec.rb in exposure-0.0.7
- old
+ new
@@ -1,19 +1,29 @@
require File.dirname(__FILE__) + '/spec_helper.rb'
describe "exposure", :type => :controller do
- class ShipTypesController < ActionController::Base
- expose_many(:ship_types)
- end
+ setup = lambda {
+ class ShipTypesController < ActionController::Base
+ expose_many(:ship_types)
+ end
+ }
+ setup.call
controller_name :ship_types
+ Object.remove_class(ShipTypesController)
+ ActionController::Routing::Routes.draw do |map|
+ map.resources :ship_types
+ end
+
before(:each) do
+ setup.call
@controller = ShipTypesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
- ActionController::Routing::Routes.draw do |map|
- map.resources :ship_types
- end
+ end
+
+ after(:each) do
+ Object.remove_class(ShipTypesController)
end
describe "parent models" do
it "should constantize resource name" do
ShipTypesController.resources_name.should == "ship_types"