radiant 1.0.1 → 1.1.0.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of radiant might be problematic. Click here for more details.
- data/CHANGELOG.md +1 -1
- data/Gemfile +12 -2
- data/Gemfile.lock +1 -0
- data/README.md +1 -1
- data/app/models/standard_tags.rb +0 -75
- data/app/models/user_action_observer.rb +1 -1
- data/config/locales/en.yml +0 -11
- data/config/routes.rb +0 -1
- data/features/admin/configuration.feature +0 -1
- data/features/admin/layouts_management.feature +1 -1
- data/features/admin/user_permissions.feature +2 -39
- data/features/navigation_rendering.feature +1 -1
- data/features/step_definitions/admin/content_negotiation_steps.rb +0 -8
- data/features/step_definitions/admin/pagination_steps.rb +1 -19
- data/features/support/datasets_loader.rb +1 -1
- data/features/support/paths.rb +0 -6
- data/lib/generators/instance/templates/instance_environment.rb +2 -0
- data/lib/generators/instance/templates/instance_gemfile +11 -0
- data/lib/radiant.rb +3 -3
- data/lib/radiant/admin_ui.rb +1 -20
- data/radiant.gemspec +0 -10
- data/spec/controllers/admin/paginated_controller_spec.rb +3 -4
- data/spec/datasets/markup_pages_dataset.rb +14 -2
- data/spec/helpers/admin/pages_helper_spec.rb +0 -5
- data/spec/helpers/admin/references_helper_spec.rb +10 -8
- data/spec/helpers/application_helper_spec.rb +1 -2
- data/spec/lib/radiant/admin_ui/nav_tabs_spec.rb +3 -3
- data/spec/lib/radiant/admin_ui_spec.rb +2 -17
- data/spec/lib/radiant/initializer_spec.rb +4 -4
- data/spec/lib/radiant/taggable_spec.rb +1 -1
- data/spec/models/page_part_spec.rb +9 -8
- data/spec/models/page_spec.rb +19 -25
- data/spec/models/standard_tags_spec.rb +1 -60
- data/spec/models/text_filter_spec.rb +2 -2
- data/spec/models/user_action_observer_spec.rb +3 -5
- data/test/fixtures/extensions/basic/app/models/basic_extension_page.rb +2 -0
- metadata +789 -164
- data/app/controllers/admin/snippets_controller.rb +0 -8
- data/app/helpers/admin/snippets_helper.rb +0 -41
- data/app/models/snippet.rb +0 -23
- data/app/views/admin/snippets/_form.html.haml +0 -33
- data/app/views/admin/snippets/edit.html.haml +0 -9
- data/app/views/admin/snippets/index.html.haml +0 -33
- data/app/views/admin/snippets/new.html.haml +0 -7
- data/app/views/admin/snippets/remove.html.haml +0 -17
- data/features/admin/resource_pagination.feature +0 -27
- data/features/admin/snippets_management.feature +0 -57
- data/spec/controllers/admin/snippets_controller_spec.rb +0 -110
- data/spec/datasets/snippets_dataset.rb +0 -38
- data/spec/helpers/admin/snippets_helper_spec.rb +0 -4
- data/spec/models/snippet_spec.rb +0 -59
    
        data/radiant.gemspec
    CHANGED
    
    | @@ -40,16 +40,6 @@ a general purpose content managment system--not merely a blogging engine.} | |
| 40 40 | 
             
              s.add_dependency "will_paginate", "~> 2.3.11"
         | 
| 41 41 | 
             
              s.add_dependency "stringex",      "~> 1.3.0"
         | 
| 42 42 |  | 
| 43 | 
            -
              s.add_dependency "radiant-archive-extension",             "~> 1.0.7"
         | 
| 44 | 
            -
              s.add_dependency "radiant-clipped-extension",             "~> 1.0.16"
         | 
| 45 | 
            -
              s.add_dependency "radiant-debug-extension",               "~> 1.0.2"
         | 
| 46 | 
            -
              s.add_dependency "radiant-exporter-extension",            "~> 1.0.2"
         | 
| 47 | 
            -
              s.add_dependency "radiant-markdown_filter-extension",     "~> 1.0.2"
         | 
| 48 | 
            -
              s.add_dependency "radiant-sheets-extension",              "~> 1.0.9"
         | 
| 49 | 
            -
              s.add_dependency "radiant-site_templates-extension",      "~> 1.0.4"
         | 
| 50 | 
            -
              s.add_dependency "radiant-smarty_pants_filter-extension", "~> 1.0.2"
         | 
| 51 | 
            -
              s.add_dependency "radiant-textile_filter-extension",      "~> 1.0.4"
         | 
| 52 | 
            -
             | 
| 53 43 | 
             
              s.add_development_dependency "cucumber-rails",    "~> 0.3.2"
         | 
| 54 44 | 
             
              s.add_development_dependency "database_cleaner",  "~> 0.6.5"
         | 
| 55 45 | 
             
              s.add_development_dependency "hoe",               "1.5.1"
         | 
| @@ -1,10 +1,9 @@ | |
| 1 1 | 
             
            require File.dirname(__FILE__) + "/../../spec_helper"
         | 
| 2 2 |  | 
| 3 | 
            -
            describe Admin:: | 
| 4 | 
            -
              dataset :users, :snippets
         | 
| 3 | 
            +
            describe Admin::UsersController do
         | 
| 5 4 |  | 
| 6 5 | 
             
              it "should be paginated" do
         | 
| 7 | 
            -
                Admin:: | 
| 6 | 
            +
                Admin::UsersController.paginated.should be_true
         | 
| 8 7 | 
             
                controller.paginated?.should be_true
         | 
| 9 8 | 
             
              end
         | 
| 10 9 |  | 
| @@ -13,7 +12,7 @@ describe Admin::SnippetsController do | |
| 13 12 | 
             
              # describe "with pagination settings from paginate_models" do
         | 
| 14 13 | 
             
              #   it "should override defaults" do
         | 
| 15 14 | 
             
              #     Radiant.config['admin.pagination.per_page'] = ""
         | 
| 16 | 
            -
              #     Admin:: | 
| 15 | 
            +
              #     Admin::UsersController.send :paginate_models, {:per_page => 5, :inner_window => 12}
         | 
| 17 16 | 
             
              #     controller.pagination_parameters.should == {:page => 1, :per_page => 5}
         | 
| 18 17 | 
             
              #     controller.will_paginate_options.should == {:inner_window => 12, :param_name => :p}
         | 
| 19 18 | 
             
              #   end
         | 
| @@ -1,12 +1,24 @@ | |
| 1 | 
            +
            class PseudoTextileFilter < TextFilter
         | 
| 2 | 
            +
              def filter(text)
         | 
| 3 | 
            +
                text + ' - Filtered with TEXTILE!'
         | 
| 4 | 
            +
              end
         | 
| 5 | 
            +
            end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            class PseudoMarkdownFilter < TextFilter
         | 
| 8 | 
            +
              def filter(text)
         | 
| 9 | 
            +
                text + ' - Filtered with MARKDOWN!'
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
            end
         | 
| 12 | 
            +
             | 
| 1 13 | 
             
            class MarkupPagesDataset < Dataset::Base
         | 
| 2 14 | 
             
              uses :home_page
         | 
| 3 15 |  | 
| 4 16 | 
             
              def load
         | 
| 5 17 | 
             
                create_page "Textile" do
         | 
| 6 | 
            -
                  create_page_part :textile_body, :name => "body", :filter_id => "Textile", :content => "Some *Textile* content."
         | 
| 18 | 
            +
                  create_page_part :textile_body, :name => "body", :filter_id => "Pseudo Textile", :content => "Some *Textile* content."
         | 
| 7 19 | 
             
                end
         | 
| 8 20 | 
             
                create_page "Markdown" do
         | 
| 9 | 
            -
                  create_page_part :markdown_body, :name => "body", :filter_id => "Markdown", :content => "Some **Markdown** content."
         | 
| 21 | 
            +
                  create_page_part :markdown_body, :name => "body", :filter_id => "Pseudo Markdown", :content => "Some **Markdown** content."
         | 
| 10 22 | 
             
                end
         | 
| 11 23 | 
             
              end
         | 
| 12 24 |  | 
| @@ -38,11 +38,6 @@ describe Admin::PagesHelper do | |
| 38 38 | 
             
                  helper.filter.should be_kind_of(TextFilter)
         | 
| 39 39 | 
             
                end
         | 
| 40 40 |  | 
| 41 | 
            -
                it "should render the filter reference" do
         | 
| 42 | 
            -
                  helper.stub!(:filter).and_return(TextileFilter)
         | 
| 43 | 
            -
                  helper.filter_reference.should == TextileFilter.description
         | 
| 44 | 
            -
                end
         | 
| 45 | 
            -
                
         | 
| 46 41 | 
             
                it "should render the filter reference for complex filter names" do
         | 
| 47 42 | 
             
                  MarkdownPlusFilter.stub!(:description).and_return("Markdown rocks!")
         | 
| 48 43 | 
             
                  helper.stub!(:filter).and_return(MarkdownPlusFilter)
         | 
| @@ -1,6 +1,7 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe Admin::ReferencesHelper do
         | 
| 4 | 
            +
              class BasicFilter < TextFilter; end
         | 
| 4 5 | 
             
              class CustomFilter < TextFilter
         | 
| 5 6 | 
             
                filter_name "Really Custom"
         | 
| 6 7 | 
             
              end
         | 
| @@ -35,8 +36,8 @@ describe Admin::ReferencesHelper do | |
| 35 36 | 
             
                end
         | 
| 36 37 |  | 
| 37 38 | 
             
                it "should return the filter object for the named filter" do
         | 
| 38 | 
            -
                  params[:filter_name] = " | 
| 39 | 
            -
                  helper.filter.should ==  | 
| 39 | 
            +
                  params[:filter_name] = "Basic"
         | 
| 40 | 
            +
                  helper.filter.should == BasicFilter
         | 
| 40 41 | 
             
                end
         | 
| 41 42 |  | 
| 42 43 | 
             
                it "should return the filter object for a custom named filter" do
         | 
| @@ -58,8 +59,8 @@ describe Admin::ReferencesHelper do | |
| 58 59 | 
             
                  end
         | 
| 59 60 |  | 
| 60 61 | 
             
                  it "should return the name of the set filter" do
         | 
| 61 | 
            -
                    params[:filter_name] = " | 
| 62 | 
            -
                    helper._display_name.should == " | 
| 62 | 
            +
                    params[:filter_name] = "Basic"
         | 
| 63 | 
            +
                    helper._display_name.should == "Basic"
         | 
| 63 64 | 
             
                  end
         | 
| 64 65 |  | 
| 65 66 | 
             
                  it "should return <none> when no filter is set" do
         | 
| @@ -90,16 +91,17 @@ describe Admin::ReferencesHelper do | |
| 90 91 | 
             
                before :each do
         | 
| 91 92 | 
             
                  helper.send(:instance_variable_set, :@filter, nil)
         | 
| 92 93 | 
             
                  params[:type] = 'filters'
         | 
| 93 | 
            -
                  params[:filter_name] = ' | 
| 94 | 
            +
                  params[:filter_name] = 'Basic'
         | 
| 94 95 | 
             
                end
         | 
| 95 96 |  | 
| 96 97 | 
             
                it "should render a helpful message when the description is blank" do
         | 
| 97 | 
            -
                   | 
| 98 | 
            +
                  BasicFilter.should_receive(:description).and_return('')
         | 
| 98 99 | 
             
                  helper.filter_reference.should == "There is no documentation on this filter."
         | 
| 99 100 | 
             
                end
         | 
| 100 101 |  | 
| 101 102 | 
             
                it "should render the filter's description when available" do
         | 
| 102 | 
            -
                   | 
| 103 | 
            +
                  BasicFilter.should_receive(:description).at_least(:once).and_return('This is basic stuff.')
         | 
| 104 | 
            +
                  helper.filter_reference.should == BasicFilter.description
         | 
| 103 105 | 
             
                end
         | 
| 104 106 |  | 
| 105 107 | 
             
                it "should render a helpful message when no filter is selected" do
         | 
| @@ -94,7 +94,6 @@ describe ApplicationHelper do | |
| 94 94 | 
             
                helper.stub!(:request).and_return(request)
         | 
| 95 95 | 
             
                request.stub!(:request_uri).and_return("/admin/pages")
         | 
| 96 96 | 
             
                helper.nav_link_to("Pages", "/admin/pages").should =~ /<strong>/
         | 
| 97 | 
            -
                helper.nav_link_to("Snippets", "/admin/snippets").should_not =~ /<strong>/
         | 
| 98 97 | 
             
              end
         | 
| 99 98 |  | 
| 100 99 | 
             
              it "should render an admin link without translation" do
         | 
| @@ -175,7 +174,7 @@ describe ApplicationHelper do | |
| 175 174 |  | 
| 176 175 | 
             
              it "should return filter options for select" do
         | 
| 177 176 | 
             
                helper.filter_options_for_select.should =~ %r{<option value=\"\"><none></option>}
         | 
| 178 | 
            -
                helper.filter_options_for_select.should =~ %r{<option value=\" | 
| 177 | 
            +
                helper.filter_options_for_select.should =~ %r{<option value=\"Basic\">Basic</option>}
         | 
| 179 178 | 
             
              end 
         | 
| 180 179 |  | 
| 181 180 | 
             
              it "should include the regions helper" do
         | 
| @@ -30,10 +30,10 @@ describe Radiant::AdminUI::NavTab do | |
| 30 30 | 
             
              describe "inserting sub-items in specific places" do
         | 
| 31 31 | 
             
                before :each do
         | 
| 32 32 | 
             
                  @pages    = Radiant::AdminUI::NavSubItem.new("Pages",    "/admin/pages")
         | 
| 33 | 
            -
                  @ | 
| 33 | 
            +
                  @things   = Radiant::AdminUI::NavSubItem.new("Things",   "/admin/things")
         | 
| 34 34 | 
             
                  @comments = Radiant::AdminUI::NavSubItem.new("Comments", "/admin/comments")
         | 
| 35 35 | 
             
                  @tab << @pages
         | 
| 36 | 
            -
                  @tab << @ | 
| 36 | 
            +
                  @tab << @things
         | 
| 37 37 | 
             
                end
         | 
| 38 38 |  | 
| 39 39 | 
             
                it "should insert at the end by default" do
         | 
| @@ -42,7 +42,7 @@ describe Radiant::AdminUI::NavTab do | |
| 42 42 | 
             
                end
         | 
| 43 43 |  | 
| 44 44 | 
             
                it "should insert before the specified sub-item" do
         | 
| 45 | 
            -
                  @tab.add(@comments, :before => : | 
| 45 | 
            +
                  @tab.add(@comments, :before => :things)
         | 
| 46 46 | 
             
                  @tab[1].should == @comments
         | 
| 47 47 | 
             
                end
         | 
| 48 48 |  | 
| @@ -26,12 +26,12 @@ describe Radiant::AdminUI do | |
| 26 26 | 
             
                @admin.initialize_nav
         | 
| 27 27 | 
             
                @admin.nav.should have(3).items
         | 
| 28 28 | 
             
                @admin.nav[:content].should have(1).items
         | 
| 29 | 
            -
                @admin.nav[:design].should have( | 
| 29 | 
            +
                @admin.nav[:design].should have(1).items
         | 
| 30 30 | 
             
                @admin.nav[:settings].should have(4).items
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| 33 33 | 
             
              it "should have collections of Region Sets for every controller" do
         | 
| 34 | 
            -
                %w{page  | 
| 34 | 
            +
                %w{page layout user}.each do |collection|
         | 
| 35 35 | 
             
                  @admin.should respond_to(collection)
         | 
| 36 36 | 
             
                  @admin.should respond_to(collection.pluralize)
         | 
| 37 37 | 
             
                  @admin.send(collection).should_not be_nil
         | 
| @@ -62,21 +62,6 @@ describe Radiant::AdminUI do | |
| 62 62 | 
             
                page.new.should === page.edit
         | 
| 63 63 | 
             
              end
         | 
| 64 64 |  | 
| 65 | 
            -
              it "should load the default snippet regions" do
         | 
| 66 | 
            -
                snippet = @admin.snippet
         | 
| 67 | 
            -
                snippet.edit.should_not be_nil
         | 
| 68 | 
            -
                snippet.edit.main.should == %w{edit_header edit_form}
         | 
| 69 | 
            -
                snippet.edit.form.should == %w{edit_title edit_content edit_filter}
         | 
| 70 | 
            -
                snippet.edit.form_bottom.should == %w{edit_buttons edit_timestamp}
         | 
| 71 | 
            -
                snippet.index.should_not be_nil
         | 
| 72 | 
            -
                snippet.index.top.should == %w{}
         | 
| 73 | 
            -
                snippet.index.thead.should == %w{title_header actions_header}
         | 
| 74 | 
            -
                snippet.index.tbody.should == %w{title_cell actions_cell}
         | 
| 75 | 
            -
                snippet.index.bottom.should == %w{new_button}
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                snippet.new.should == snippet.edit
         | 
| 78 | 
            -
              end
         | 
| 79 | 
            -
             | 
| 80 65 | 
             
              it "should load the default layout regions" do
         | 
| 81 66 | 
             
                layout = @admin.layout
         | 
| 82 67 | 
             
                layout.edit.should_not be_nil
         | 
| @@ -33,18 +33,18 @@ describe Radiant::Configuration do | |
| 33 33 | 
             
              end
         | 
| 34 34 |  | 
| 35 35 | 
             
              it "should expand the extension list" do
         | 
| 36 | 
            -
                @configuration.extensions = [: | 
| 37 | 
            -
                @configuration.enabled_extensions.should include(: | 
| 36 | 
            +
                @configuration.extensions = [:routed, :all, :basic]
         | 
| 37 | 
            +
                @configuration.enabled_extensions.should include(:load_order_blue)
         | 
| 38 38 | 
             
              end
         | 
| 39 39 |  | 
| 40 40 | 
             
              it "should throw a LoadError if configured extensions do not exist" do
         | 
| 41 | 
            -
                @configuration.extensions = [: | 
| 41 | 
            +
                @configuration.extensions = [:routed, :bogus, :basic]
         | 
| 42 42 | 
             
                lambda {@configuration.enabled_extensions}.should raise_error(LoadError)
         | 
| 43 43 | 
             
              end  
         | 
| 44 44 |  | 
| 45 45 | 
             
              it "should default to the list of all discovered extensions" do
         | 
| 46 46 | 
             
                @configuration.extensions = nil
         | 
| 47 | 
            -
                @configuration.enabled_extensions.should include(: | 
| 47 | 
            +
                @configuration.enabled_extensions.should include(:routed)
         | 
| 48 48 | 
             
              end  
         | 
| 49 49 |  | 
| 50 50 | 
             
              it "should have access to the AdminUI" do
         | 
| @@ -122,7 +122,7 @@ describe Radiant::Taggable, "when included in a module with defined tags" do | |
| 122 122 | 
             
            end
         | 
| 123 123 |  | 
| 124 124 | 
             
            describe Radiant::Taggable, "when included in a module with defined tags which is included in the Page model" do
         | 
| 125 | 
            -
              dataset :users_and_pages, :file_not_found | 
| 125 | 
            +
              dataset :users_and_pages, :file_not_found
         | 
| 126 126 |  | 
| 127 127 | 
             
              module CustomTags
         | 
| 128 128 | 
             
                include Radiant::Taggable
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe PagePart do
         | 
| 4 4 | 
             
              dataset :home_page
         | 
| @@ -15,16 +15,17 @@ describe PagePart do | |
| 15 15 | 
             
              end
         | 
| 16 16 |  | 
| 17 17 | 
             
              it "should take the filter from the default filter" do
         | 
| 18 | 
            -
                Radiant::Config['defaults.page.filter'] = "Textile"
         | 
| 18 | 
            +
                Radiant::Config['defaults.page.filter'] = "Pseudo Textile"
         | 
| 19 19 | 
             
                part = PagePart.new :name => 'new-part'
         | 
| 20 | 
            -
                part.filter_id.should == "Textile"
         | 
| 20 | 
            +
                part.filter_id.should == "Pseudo Textile"
         | 
| 21 21 | 
             
              end
         | 
| 22 22 |  | 
| 23 23 | 
             
              it "shouldn't override existing page_parts filters with the default filter" do
         | 
| 24 24 | 
             
                part = PagePart.find(:first, :conditions => {:filter_id => nil})
         | 
| 25 | 
            -
                 | 
| 25 | 
            +
                selected_filter_name = TextFilter.descendants.first.filter_name
         | 
| 26 | 
            +
                Radiant::Config['defaults.page.filter'] = selected_filter_name
         | 
| 26 27 | 
             
                part.reload
         | 
| 27 | 
            -
                part.filter_id.should_not ==  | 
| 28 | 
            +
                part.filter_id.should_not == selected_filter_name
         | 
| 28 29 | 
             
              end
         | 
| 29 30 |  | 
| 30 31 | 
             
              it 'should validate length of' do
         | 
| @@ -50,11 +51,11 @@ describe PagePart, 'filter' do | |
| 50 51 | 
             
              specify 'getting and setting' do
         | 
| 51 52 | 
             
                @part = page_parts(:textile_body)
         | 
| 52 53 | 
             
                original = @part.filter
         | 
| 53 | 
            -
                original.should be_kind_of( | 
| 54 | 
            +
                original.should be_kind_of(PseudoTextileFilter)
         | 
| 54 55 |  | 
| 55 56 | 
             
                @part.filter.should equal(original)
         | 
| 56 57 |  | 
| 57 | 
            -
                @part.filter_id = 'Markdown'
         | 
| 58 | 
            -
                @part.filter.should be_kind_of( | 
| 58 | 
            +
                @part.filter_id = 'Pseudo Markdown'
         | 
| 59 | 
            +
                @part.filter.should be_kind_of(PseudoMarkdownFilter)
         | 
| 59 60 | 
             
              end
         | 
| 60 61 | 
             
            end
         | 
    
        data/spec/models/page_spec.rb
    CHANGED
    
    | @@ -24,6 +24,12 @@ class PageSpecTestPage < Page | |
| 24 24 | 
             
              end
         | 
| 25 25 | 
             
            end
         | 
| 26 26 |  | 
| 27 | 
            +
            class VirtualSpecPage < Page
         | 
| 28 | 
            +
              def virtual?
         | 
| 29 | 
            +
                true
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| 27 33 | 
             
            describe Page, 'validations' do
         | 
| 28 34 | 
             
              dataset :pages
         | 
| 29 35 | 
             
              test_helper :validations
         | 
| @@ -82,9 +88,9 @@ describe Page, 'validations' do | |
| 82 88 | 
             
              end
         | 
| 83 89 |  | 
| 84 90 | 
             
              it 'should allow mass assignment for class name' do
         | 
| 85 | 
            -
                @page.attributes = { :class_name => ' | 
| 91 | 
            +
                @page.attributes = { :class_name => 'PageSpecTestPage' }
         | 
| 86 92 | 
             
                assert_valid @page
         | 
| 87 | 
            -
                @page.class_name.should == ' | 
| 93 | 
            +
                @page.class_name.should == 'PageSpecTestPage'
         | 
| 88 94 | 
             
              end
         | 
| 89 95 |  | 
| 90 96 | 
             
              it 'should not be valid when class name is not a descendant of page' do
         | 
| @@ -103,7 +109,7 @@ describe Page, 'validations' do | |
| 103 109 |  | 
| 104 110 | 
             
              it 'should be valid when class name is page or empty or nil' do
         | 
| 105 111 | 
             
                [nil, '', 'Page'].each do |value|
         | 
| 106 | 
            -
                  @page =  | 
| 112 | 
            +
                  @page = PageSpecTestPage.new(page_params)
         | 
| 107 113 | 
             
                  @page.class_name = value
         | 
| 108 114 | 
             
                  assert_valid @page
         | 
| 109 115 | 
             
                  @page.class_name.should == value
         | 
| @@ -356,8 +362,8 @@ describe Page do | |
| 356 362 | 
             
                end
         | 
| 357 363 |  | 
| 358 364 | 
             
                it 'should return a collection containing the default_child and ordered by name Page descendants that are in_menu' do
         | 
| 359 | 
            -
                  Page.should_receive(:descendants).and_return([ | 
| 360 | 
            -
                  page.allowed_children_lookup.should == [Page,  | 
| 365 | 
            +
                  Page.should_receive(:descendants).and_return([PageSpecTestPage, CustomFileNotFoundPage])
         | 
| 366 | 
            +
                  page.allowed_children_lookup.should == [Page, CustomFileNotFoundPage, PageSpecTestPage]
         | 
| 361 367 | 
             
                end
         | 
| 362 368 | 
             
              end
         | 
| 363 369 | 
             
            end
         | 
| @@ -366,12 +372,12 @@ describe Page, "before save filter" do | |
| 366 372 | 
             
              dataset :home_page
         | 
| 367 373 |  | 
| 368 374 | 
             
              before :each do
         | 
| 369 | 
            -
                Page.create(page_params(:title =>"Month Index", :class_name => " | 
| 375 | 
            +
                Page.create(page_params(:title =>"Month Index", :class_name => "VirtualSpecPage"))
         | 
| 370 376 | 
             
                @page = Page.find_by_title("Month Index")
         | 
| 371 377 | 
             
              end
         | 
| 372 378 |  | 
| 373 379 | 
             
              it 'should set the class name correctly' do
         | 
| 374 | 
            -
                @page.should be_kind_of( | 
| 380 | 
            +
                @page.should be_kind_of(VirtualSpecPage)
         | 
| 375 381 | 
             
              end
         | 
| 376 382 |  | 
| 377 383 | 
             
              it 'should set the virtual bit correctly' do
         | 
| @@ -381,14 +387,14 @@ describe Page, "before save filter" do | |
| 381 387 |  | 
| 382 388 | 
             
              it 'should update virtual based on new class name' do
         | 
| 383 389 | 
             
                # turn a regular page into a virtual page
         | 
| 384 | 
            -
                @page.class_name = " | 
| 390 | 
            +
                @page.class_name = "VirtualSpecPage"
         | 
| 385 391 | 
             
                @page.save.should == true
         | 
| 386 392 | 
             
                @page.virtual?.should == true
         | 
| 387 393 | 
             
                @page.send(:read_attribute, :virtual).should == true
         | 
| 388 394 |  | 
| 389 395 | 
             
               # turn a virtual page into a non-virtual one
         | 
| 390 396 | 
             
               ["", nil, "Page", "PageSpecTestPage"].each do |value|
         | 
| 391 | 
            -
                  @page =  | 
| 397 | 
            +
                  @page = PageSpecTestPage.create(page_params)
         | 
| 392 398 | 
             
                  @page.class_name = value
         | 
| 393 399 | 
             
                  @page.save.should == true
         | 
| 394 400 | 
             
                  @page = Page.find @page.id
         | 
| @@ -400,7 +406,7 @@ describe Page, "before save filter" do | |
| 400 406 | 
             
            end
         | 
| 401 407 |  | 
| 402 408 | 
             
            describe Page, "rendering" do
         | 
| 403 | 
            -
              dataset :pages, :markup_pages, : | 
| 409 | 
            +
              dataset :pages, :markup_pages, :layouts
         | 
| 404 410 | 
             
              test_helper :render
         | 
| 405 411 |  | 
| 406 412 | 
             
              before :each do
         | 
| @@ -412,7 +418,7 @@ describe Page, "rendering" do | |
| 412 418 | 
             
              end
         | 
| 413 419 |  | 
| 414 420 | 
             
              it 'should render with a filter' do
         | 
| 415 | 
            -
                pages(:textile).render.should == ' | 
| 421 | 
            +
                pages(:textile).render.should == 'Some *Textile* content. - Filtered with TEXTILE!'
         | 
| 416 422 | 
             
              end
         | 
| 417 423 |  | 
| 418 424 | 
             
              it 'should render with tags' do
         | 
| @@ -432,18 +438,6 @@ describe Page, "rendering" do | |
| 432 438 | 
             
                @page.render_part(:empty).should == ''
         | 
| 433 439 | 
             
              end
         | 
| 434 440 |  | 
| 435 | 
            -
              it 'should render a snippet' do
         | 
| 436 | 
            -
                @page.render_snippet(snippets(:first)).should == 'test'
         | 
| 437 | 
            -
              end
         | 
| 438 | 
            -
             | 
| 439 | 
            -
              it 'should render a snippet with a filter' do
         | 
| 440 | 
            -
                @page.render_snippet(snippets(:markdown)).should match(%r{<p><strong>markdown</strong></p>})
         | 
| 441 | 
            -
              end
         | 
| 442 | 
            -
             | 
| 443 | 
            -
              it 'should render a snippet with a tag' do
         | 
| 444 | 
            -
                @page.render_snippet(snippets(:radius)).should == 'Home'
         | 
| 445 | 
            -
              end
         | 
| 446 | 
            -
             | 
| 447 441 | 
             
              it 'should render custom pages with tags' do
         | 
| 448 442 | 
             
                create_page "Test Page", :body => "<r:test1 /> <r:test2 />", :class_name => "PageSpecTestPage"
         | 
| 449 443 | 
             
                pages(:test_page).should render_as('Hello world! Another test. body.')
         | 
| @@ -614,11 +608,11 @@ end | |
| 614 608 |  | 
| 615 609 | 
             
            describe Page, 'loading subclasses after bootstrap' do
         | 
| 616 610 | 
             
              it "should find subclasses in extensions" do
         | 
| 617 | 
            -
                defined?( | 
| 611 | 
            +
                defined?(BasicExtensionPage).should_not be_nil
         | 
| 618 612 | 
             
              end
         | 
| 619 613 |  | 
| 620 614 | 
             
              it "should not adjust the display name of subclasses found in extensions" do
         | 
| 621 | 
            -
                 | 
| 615 | 
            +
                BasicExtensionPage.display_name.should_not match(/not installed/)
         | 
| 622 616 | 
             
              end
         | 
| 623 617 | 
             
            end
         | 
| 624 618 |  | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            require File.dirname(__FILE__) + '/../spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe "Standard Tags" do
         | 
| 4 | 
            -
              dataset :users_and_pages, :file_not_found | 
| 4 | 
            +
              dataset :users_and_pages, :file_not_found
         | 
| 5 5 |  | 
| 6 6 | 
             
              it '<r:page> should allow access to the current page' do
         | 
| 7 7 | 
             
                page(:home)
         | 
| @@ -677,65 +677,6 @@ describe "Standard Tags" do | |
| 677 677 | 
             
                end
         | 
| 678 678 | 
             
              end
         | 
| 679 679 |  | 
| 680 | 
            -
              describe "<r:snippet>" do
         | 
| 681 | 
            -
                it "should render the contents of the specified snippet" do
         | 
| 682 | 
            -
                  page.should render('<r:snippet name="first" />').as('test')
         | 
| 683 | 
            -
                end
         | 
| 684 | 
            -
             | 
| 685 | 
            -
                it "should render an error when the snippet does not exist" do
         | 
| 686 | 
            -
                  page.should render('<r:snippet name="non-existant" />').with_error("snippet 'non-existant' not found")
         | 
| 687 | 
            -
                end
         | 
| 688 | 
            -
             | 
| 689 | 
            -
                it "should render an error when not given a 'name' attribute" do
         | 
| 690 | 
            -
                  page.should render('<r:snippet />').with_error("`snippet' tag must contain a `name' attribute.")
         | 
| 691 | 
            -
                end
         | 
| 692 | 
            -
             | 
| 693 | 
            -
                it "should filter the snippet with its assigned filter" do
         | 
| 694 | 
            -
                  page.should render('<r:page><r:snippet name="markdown" /></r:page>').matching(%r{<p><strong>markdown</strong></p>})
         | 
| 695 | 
            -
                end
         | 
| 696 | 
            -
             | 
| 697 | 
            -
                it "should maintain the global page inside the snippet" do
         | 
| 698 | 
            -
                  page(:parent).should render('<r:snippet name="global_page_cascade" />').as("#{@page.title} " * @page.children.count)
         | 
| 699 | 
            -
                end
         | 
| 700 | 
            -
             | 
| 701 | 
            -
                it "should maintain the global page when the snippet renders recursively" do
         | 
| 702 | 
            -
                  page(:child).should render('<r:snippet name="recursive" />').as("Great GrandchildGrandchildChild")
         | 
| 703 | 
            -
                end
         | 
| 704 | 
            -
             | 
| 705 | 
            -
                it "should render the specified snippet when called as an empty double-tag" do
         | 
| 706 | 
            -
                  page.should render('<r:snippet name="first"></r:snippet>').as('test')
         | 
| 707 | 
            -
                end
         | 
| 708 | 
            -
             | 
| 709 | 
            -
                it "should capture contents of a double tag, substituting for <r:yield/> in snippet" do
         | 
| 710 | 
            -
                  page.should render('<r:snippet name="yielding">inner</r:snippet>').
         | 
| 711 | 
            -
                    as('Before...inner...and after')
         | 
| 712 | 
            -
                end
         | 
| 713 | 
            -
             | 
| 714 | 
            -
                it "should do nothing with contents of double tag when snippet doesn't yield" do
         | 
| 715 | 
            -
                  page.should render('<r:snippet name="first">content disappears!</r:snippet>').
         | 
| 716 | 
            -
                    as('test')
         | 
| 717 | 
            -
                end
         | 
| 718 | 
            -
             | 
| 719 | 
            -
                it "should render nested yielding snippets" do
         | 
| 720 | 
            -
                  page.should render('<r:snippet name="div_wrap"><r:snippet name="yielding">Hello, World!</r:snippet></r:snippet>').
         | 
| 721 | 
            -
                  as('<div>Before...Hello, World!...and after</div>')
         | 
| 722 | 
            -
                end
         | 
| 723 | 
            -
             | 
| 724 | 
            -
                it "should render double-tag snippets called from within a snippet" do
         | 
| 725 | 
            -
                  page.should render('<r:snippet name="nested_yields">the content</r:snippet>').
         | 
| 726 | 
            -
                    as('<snippet name="div_wrap">above the content below</snippet>')
         | 
| 727 | 
            -
                end
         | 
| 728 | 
            -
             | 
| 729 | 
            -
                it "should render contents each time yield is called" do
         | 
| 730 | 
            -
                  page.should render('<r:snippet name="yielding_often">French</r:snippet>').
         | 
| 731 | 
            -
                    as('French is Frencher than French')
         | 
| 732 | 
            -
                end
         | 
| 733 | 
            -
              end
         | 
| 734 | 
            -
             | 
| 735 | 
            -
              it "should do nothing when called from page body" do
         | 
| 736 | 
            -
                page.should render('<r:yield/>').as("")
         | 
| 737 | 
            -
              end
         | 
| 738 | 
            -
             | 
| 739 680 | 
             
              it '<r:random> should render a randomly selected contained <r:option>' do
         | 
| 740 681 | 
             
                page.should render("<r:random> <r:option>1</r:option> <r:option>2</r:option> <r:option>3</r:option> </r:random>").matching(/^(1|2|3)$/)
         | 
| 741 682 | 
             
              end
         |