require File.dirname(__FILE__) + '/../spec_helper' context "The PluginsController" do inherit Test::Unit::TestCase controller_name :plugins specify "should be a PluginsController" do controller.should_be_instance_of PluginsController end specify "should create an unsaved plugin record on GET to create" do get 'create' response.should_be_success response.should_not_be_redirect assigns('plugin').should_be_new_record end specify "should persist a new person and redirect to index on POST to create" do post 'create', :plugin => {:name => 'test_plugin', :root => 'http://some-server.com', :auto_updatable => true} Plugin.find_by_name('test_plugin').should_not_be_nil response.should_be_redirect response.redirect_url.should_equal 'http://test.host/plugins' end end context "Rendering /plugins" do inherit Test::Unit::TestCase controller_name :plugins setup do get 'index' end specify "should render 'list'" do response.should_render :list end specify "should not render 'index'" do lambda { response.should_render :index }.should_raise end specify "should find all plugins on GET to index" do get 'index' response.should_be_success assigns('people').should_equal [people(:lachie)] end specify "should display the list of plugins" do should_have_tag('p', :content => 'Finds me in app/views/person/list.rhtml') end end context "/plugins/" do setup do @plugin = PluginSpecHelper.saved_plugin get @plugin.version end specify "should display the latest version information for the plugin" do end end context "/plugins/" do specify "should redirect to the listing" do get '12435' end end context "/plugins//versions" do specify "should display a list of plugin versions" do end end context "/plugins//versions/" do specify "should display the details of a specific plugin version" do end end context "/plugins//versions/" do specify "should redirect to the plugin description if a non-existent version is requested" do end end