radiant 0.6.0 → 0.6.1
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 +20 -6
- data/CONTRIBUTORS +4 -0
- data/app/controllers/admin/page_controller.rb +33 -33
- data/app/controllers/application.rb +2 -0
- data/app/controllers/site_controller.rb +2 -2
- data/app/helpers/admin/page_helper.rb +2 -1
- data/app/models/page.rb +12 -7
- data/app/models/response_cache.rb +2 -2
- data/app/models/standard_tags.rb +2 -2
- data/app/views/admin/page/index.rhtml +2 -1
- data/db/migrate/010_merge_behaviors_and_pages.rb +1 -1
- data/lib/plugins/extension_patches/init.rb +3 -1
- data/lib/plugins/extension_patches/lib/fixture_loading_extension.rb +1 -1
- data/lib/radiant.rb +2 -2
- data/lib/radiant/extension_loader.rb +1 -1
- data/public/javascripts/sitemap.js +6 -13
- data/test/fixtures/extensions/{basic → 01_basic}/app/controllers/basic_extension_controller.rb +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/app/models/basic_extension_mailer.rb +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/app/models/basic_extension_model.rb +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/app/views/basic_extension/index.rhtml +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/app/views/basic_extension/override.rhtml +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/app/views/basic_extension_mailer/message.rhtml +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/basic_extension.rb +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/db/migrate/001_create_initial_schema.rb +0 -0
- data/test/fixtures/extensions/{basic → 01_basic}/db/migrate/002_modify_initial_schema.rb +0 -0
- data/test/fixtures/extensions/{overriding → 02_overriding}/app/views/basic_extension/override.rhtml +0 -0
- data/test/fixtures/extensions/{overriding → 02_overriding}/overriding_extension.rb +0 -0
- data/test/functional/admin/user_controller_test.rb +22 -6
- data/test/functional/admin/welcome_controller_test.rb +3 -0
- data/test/functional/extension_initialization_test.rb +1 -1
- data/test/functional/site_controller_test.rb +19 -1
- data/test/helpers/logging_test_helper.rb +10 -0
- data/test/helpers/user_test_helper.rb +2 -1
- data/test/unit/standard_tags_test.rb +1 -1
- metadata +29 -28
    
        data/CHANGELOG
    CHANGED
    
    | @@ -1,6 +1,20 @@ | |
| 1 1 | 
             
            == Change Log
         | 
| 2 2 |  | 
| 3 | 
            -
            === 0.6. | 
| 3 | 
            +
            === 0.6.1 Stone Cutter (May 5, 2007)
         | 
| 4 | 
            +
            * Fixed a security vulnerability which caused passwords to appear in the logs
         | 
| 5 | 
            +
            * Fixed a bug in the site map code which caused it to forget which rows were
         | 
| 6 | 
            +
              expanded
         | 
| 7 | 
            +
            * The find_by_url method has been optimized to improve performance [Daniel
         | 
| 8 | 
            +
              Sheppard]
         | 
| 9 | 
            +
            * GET requests are now the only requests that are cached [Daniel Sheppard] 
         | 
| 10 | 
            +
            * Added rudimentary support for extension depencency specification through
         | 
| 11 | 
            +
              directory prefixing [Daniel Sheppard]
         | 
| 12 | 
            +
            * Fixed syntax error in fixture loading extension [Sean Cribbs]
         | 
| 13 | 
            +
            * Minor documentation fix for date tag [Sean Cribbs]
         | 
| 14 | 
            +
            * Fixed a bug in the migrations that prevented 0.5.x users from upgrading
         | 
| 15 | 
            +
              properly [Sean Cribbs]
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            === 0.6.0 Lapidary (April 24, 2007)
         | 
| 4 18 | 
             
            * Added support for extensions--an extremely flexible way to extend radiant
         | 
| 5 19 | 
             
            * Merged Behaviors into the Page class; subclass page now instead
         | 
| 6 20 | 
             
            * Improved database support for Postgres and Sqlite
         | 
| @@ -28,13 +42,13 @@ | |
| 28 42 | 
             
            * Created the r:cycle tag to make alternating tables and lists possible
         | 
| 29 43 | 
             
            * Added popups for filter and tag documentation inside the page editing 
         | 
| 30 44 | 
             
              interface
         | 
| 31 | 
            -
            * Added support for optimistic locking for all models [Daniel  | 
| 45 | 
            +
            * Added support for optimistic locking for all models [Daniel Sheppard]
         | 
| 32 46 | 
             
            * Added support to Radiant::Config for boolean values [Sean Cribbs]
         | 
| 33 47 | 
             
            * Caching no longer stores the headers and body in the same file [Daniel 
         | 
| 34 | 
            -
               | 
| 48 | 
            +
              Sheppard]
         | 
| 35 49 | 
             
            * Added support for the X-Sendfile header that works in conjunction with 
         | 
| 36 50 | 
             
              caching to speed it up (by default X-Sendfile support is off) [Daniel 
         | 
| 37 | 
            -
               | 
| 51 | 
            +
              Sheppard]
         | 
| 38 52 | 
             
            * Moved the images and stylesheets into images/admin and stylesheets/admin
         | 
| 39 53 | 
             
              respectively to make it easier for Radiant's assets to coexist easily with
         | 
| 40 54 | 
             
              the site's assets
         | 
| @@ -53,11 +67,11 @@ | |
| 53 67 | 
             
            * Updated icons for layouts
         | 
| 54 68 | 
             
            * Migrations are now repaired so that you can run `rake migrate` to create the
         | 
| 55 69 | 
             
              initial database. (`script/setup_database` is still the recommended method.)
         | 
| 56 | 
            -
              (closes ticket #46) [Daniel  | 
| 70 | 
            +
              (closes ticket #46) [Daniel Sheppard]
         | 
| 57 71 | 
             
            * When you collapse a branch in the admin page tree view and move to another
         | 
| 58 72 | 
             
              tab the collapsed status is now saved so that when you return, the collapsed
         | 
| 59 73 | 
             
              status is preserved. Also the status of collapsed branches is preserved when
         | 
| 60 | 
            -
              collapsing and expanding parent nodes. (closes ticket #29) [Daniel  | 
| 74 | 
            +
              collapsing and expanding parent nodes. (closes ticket #29) [Daniel Sheppard]
         | 
| 61 75 | 
             
            * Fixed documentation problem in response_cache.rb (closes ticket #142) [Paul
         | 
| 62 76 | 
             
              Smith]
         | 
| 63 77 | 
             
            * Fixed problem with timezones on fixtures causing tests to fail in Japan
         | 
    
        data/CONTRIBUTORS
    CHANGED
    
    
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            class Admin::PageController < Admin::AbstractModelController
         | 
| 2 | 
            -
              model_class Page
         | 
| 2 | 
            +
              model_class Page
         | 
| 3 3 | 
             
              before_filter :initialize_meta_rows_and_buttons, :only => [:new, :edit]
         | 
| 4 4 | 
             
              attr_accessor :cache
         | 
| 5 5 |  | 
| @@ -79,43 +79,43 @@ class Admin::PageController < Admin::AbstractModelController | |
| 79 79 | 
             
                    "The page was successfully removed from the site."
         | 
| 80 80 | 
             
                  end
         | 
| 81 81 | 
             
                end
         | 
| 82 | 
            -
             | 
| 82 | 
            +
                
         | 
| 83 | 
            +
                def announce_cache_cleared
         | 
| 84 | 
            +
                  flash[:notice] = "The page cache was successfully cleared."
         | 
| 85 | 
            +
                end
         | 
| 86 | 
            +
                
         | 
| 83 87 | 
             
                def initialize_meta_rows_and_buttons
         | 
| 84 88 | 
             
                  @buttons_partials ||= []
         | 
| 85 89 | 
             
                  @meta ||= []
         | 
| 86 90 | 
             
                  @meta << {:field => "slug", :type => "text_field", :args => [{:class => 'textbox', :maxlength => 100}]}
         | 
| 87 91 | 
             
                  @meta << {:field => "breadcrumb", :type => "text_field", :args => [{:class => 'textbox', :maxlength => 160}]}
         | 
| 88 92 | 
             
                end
         | 
| 89 | 
            -
             | 
| 90 | 
            -
                def  | 
| 91 | 
            -
                   | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
                   | 
| 96 | 
            -
                   | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
                     | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
                   | 
| 107 | 
            -
             | 
| 108 | 
            -
                     | 
| 109 | 
            -
             | 
| 110 | 
            -
                   | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
                   | 
| 116 | 
            -
                end
         | 
| 117 | 
            -
                
         | 
| 118 | 
            -
                def clear_model_cache
         | 
| 119 | 
            -
                  @cache.expire_response(@page.url)      
         | 
| 93 | 
            +
                
         | 
| 94 | 
            +
                def save
         | 
| 95 | 
            +
                  parts = @page.parts
         | 
| 96 | 
            +
                  parts_to_update = {}
         | 
| 97 | 
            +
                  (params[:part]||{}).each {|k,v| parts_to_update[v[:name]] = v }
         | 
| 98 | 
            +
                  
         | 
| 99 | 
            +
                  parts_to_remove = []
         | 
| 100 | 
            +
                  @page.parts.each do |part|
         | 
| 101 | 
            +
                    if(attrs = parts_to_update.delete(part.name))
         | 
| 102 | 
            +
                      part.attributes = part.attributes.merge(attrs)
         | 
| 103 | 
            +
                    else
         | 
| 104 | 
            +
                      parts_to_remove << part
         | 
| 105 | 
            +
                    end
         | 
| 106 | 
            +
                  end
         | 
| 107 | 
            +
                  parts_to_update.values.each do |attrs|
         | 
| 108 | 
            +
                    @page.parts.build(attrs)
         | 
| 109 | 
            +
                  end
         | 
| 110 | 
            +
                  if result = @page.save
         | 
| 111 | 
            +
                    new_parts = @page.parts - parts_to_remove
         | 
| 112 | 
            +
                    new_parts.each { |part| part.save }
         | 
| 113 | 
            +
                    @page.parts = new_parts
         | 
| 114 | 
            +
                  end
         | 
| 115 | 
            +
                  result
         | 
| 116 | 
            +
                end
         | 
| 117 | 
            +
                
         | 
| 118 | 
            +
                def clear_model_cache
         | 
| 119 | 
            +
                  @cache.expire_response(@page.url)      
         | 
| 120 120 | 
             
                end
         | 
| 121 121 | 
             
            end
         | 
| @@ -13,7 +13,7 @@ class SiteController < ApplicationController | |
| 13 13 | 
             
              def show_page
         | 
| 14 14 | 
             
                response.headers.delete('Cache-Control')
         | 
| 15 15 | 
             
                url = params[:url].to_s
         | 
| 16 | 
            -
                if live? and (@cache.response_cached?(url))
         | 
| 16 | 
            +
                if (request.get? || request.head?) and live? and (@cache.response_cached?(url))
         | 
| 17 17 | 
             
                  @cache.update_response(url, response, request)
         | 
| 18 18 | 
             
                  @performed_render = true
         | 
| 19 19 | 
             
                else
         | 
| @@ -36,7 +36,7 @@ class SiteController < ApplicationController | |
| 36 36 | 
             
                  @page = find_page(url)
         | 
| 37 37 | 
             
                  unless @page.nil?
         | 
| 38 38 | 
             
                    process_page(@page)
         | 
| 39 | 
            -
                    @cache.cache_response(url, response) if live? and @page.cache?
         | 
| 39 | 
            +
                    @cache.cache_response(url, response) if request.get? and live? and @page.cache?
         | 
| 40 40 | 
             
                    @performed_render = true
         | 
| 41 41 | 
             
                  else
         | 
| 42 42 | 
             
                    render :template => 'site/not_found', :status => 404
         | 
    
        data/app/models/page.rb
    CHANGED
    
    | @@ -125,15 +125,20 @@ class Page < ActiveRecord::Base | |
| 125 125 | 
             
              end
         | 
| 126 126 |  | 
| 127 127 | 
             
              def find_by_url(url, live = true, clean = true)
         | 
| 128 | 
            +
                return nil if virtual?
         | 
| 128 129 | 
             
                url = clean_url(url) if clean
         | 
| 129 | 
            -
                 | 
| 130 | 
            +
                my_url = self.url
         | 
| 131 | 
            +
                if (my_url == url) && (not live or published?)
         | 
| 130 132 | 
             
                  self
         | 
| 131 | 
            -
                 | 
| 133 | 
            +
                elsif (url =~ /^#{Regexp.quote(my_url)}([^\/]*)/)
         | 
| 134 | 
            +
                  slug_child = children.find_by_slug($1)
         | 
| 135 | 
            +
                  if slug_child
         | 
| 136 | 
            +
                    found = slug_child.find_by_url(url, live, clean)
         | 
| 137 | 
            +
                    return found if found
         | 
| 138 | 
            +
                  end
         | 
| 132 139 | 
             
                  children.each do |child|
         | 
| 133 | 
            -
                     | 
| 134 | 
            -
             | 
| 135 | 
            -
                      return found if found
         | 
| 136 | 
            -
                    end
         | 
| 140 | 
            +
                    found = child.find_by_url(url, live, clean)
         | 
| 141 | 
            +
                    return found if found
         | 
| 137 142 | 
             
                  end
         | 
| 138 143 | 
             
                  children.find(:first, :conditions => "class_name = 'FileNotFoundPage'")
         | 
| 139 144 | 
             
                end
         | 
| @@ -251,4 +256,4 @@ class Page < ActiveRecord::Base | |
| 251 256 |  | 
| 252 257 | 
             
            end
         | 
| 253 258 |  | 
| 254 | 
            -
            Page.load_subclasses
         | 
| 259 | 
            +
            Page.load_subclasses
         | 
| @@ -122,8 +122,8 @@ class ResponseCache | |
| 122 122 |  | 
| 123 123 | 
             
                def client_has_cache?(metadata, request)
         | 
| 124 124 | 
             
                    return false unless request
         | 
| 125 | 
            -
                    request_time = Time. | 
| 126 | 
            -
                    response_time = Time. | 
| 125 | 
            +
                    request_time = Time.httpdate(request.env["HTTP_IF_MODIFIED_SINCE"]) rescue nil
         | 
| 126 | 
            +
                    response_time = Time.httpdate(metadata['headers']['Last-Modified']) rescue nil
         | 
| 127 127 | 
             
                    return request_time && response_time && response_time <= request_time
         | 
| 128 128 | 
             
                end
         | 
| 129 129 |  | 
    
        data/app/models/standard_tags.rb
    CHANGED
    
    | @@ -318,7 +318,7 @@ module StandardTags | |
| 318 318 | 
             
                current date/time, regardless of the  page.
         | 
| 319 319 |  | 
| 320 320 | 
             
                *Usage:*  
         | 
| 321 | 
            -
                <pre><code><r:date [format="%A, %B %d, %Y"] [ | 
| 321 | 
            +
                <pre><code><r:date [format="%A, %B %d, %Y"] [for="published_at"]/></code></pre>
         | 
| 322 322 | 
             
              }
         | 
| 323 323 | 
             
              tag 'date' do |tag|
         | 
| 324 324 | 
             
                page = tag.locals.page
         | 
| @@ -331,7 +331,7 @@ module StandardTags | |
| 331 331 | 
             
                  when ['published_at', 'created_at', 'updated_at'].include?(time_attr)
         | 
| 332 332 | 
             
                    page[time_attr]
         | 
| 333 333 | 
             
                  else
         | 
| 334 | 
            -
                    raise TagError, "Invalid value for ' | 
| 334 | 
            +
                    raise TagError, "Invalid value for 'for' attribute."
         | 
| 335 335 | 
             
                  end
         | 
| 336 336 | 
             
                else
         | 
| 337 337 | 
             
                  page.published_at || page.created_at
         | 
| @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            <% include_javascript 'sitemap' -%>
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
            <h1>Pages</h1>
         | 
| 3 4 |  | 
| 4 5 | 
             
            <table id="site-map" class="index" cellpadding="0" cellspacing="0" border="0">
         | 
| @@ -21,7 +22,7 @@ | |
| 21 22 | 
             
            </table>
         | 
| 22 23 | 
             
            <script type="text/javascript">
         | 
| 23 24 | 
             
            // <![CDATA[
         | 
| 24 | 
            -
              new SiteMap('site-map');
         | 
| 25 | 
            +
              new SiteMap('site-map', <%= expanded_rows.to_json %>);
         | 
| 25 26 | 
             
            // ]]>
         | 
| 26 27 | 
             
            </script>
         | 
| 27 28 | 
             
            <form action="<%= clear_cache_url %>" method="post">
         | 
| @@ -11,7 +11,7 @@ class MergeBehaviorsAndPages < ActiveRecord::Migration | |
| 11 11 |  | 
| 12 12 | 
             
              def self.up
         | 
| 13 13 | 
             
                announce "converting behavior names to class names"
         | 
| 14 | 
            -
                 | 
| 14 | 
            +
                OldPage.find(:all).each do |page|
         | 
| 15 15 | 
             
                  unless page.behavior_id.blank?
         | 
| 16 16 | 
             
                    page.behavior_id = page_name(page.behavior_id)
         | 
| 17 17 | 
             
                    page.save!
         | 
| @@ -19,7 +19,7 @@ module Radiant | |
| 19 19 | 
             
                      begin
         | 
| 20 20 | 
             
                        directory = paths.pop
         | 
| 21 21 | 
             
                        fixtures_map[table_name] = Fixtures.new(connection, File.split(table_name.to_s).last, class_names[table_name.to_sym], File.join(directory, table_name))
         | 
| 22 | 
            -
                      rescue e
         | 
| 22 | 
            +
                      rescue Exception => e
         | 
| 23 23 | 
             
                        retry unless paths.empty?
         | 
| 24 24 | 
             
                        raise e
         | 
| 25 25 | 
             
                      end
         | 
    
        data/lib/radiant.rb
    CHANGED
    
    
| @@ -66,7 +66,7 @@ module Radiant | |
| 66 66 | 
             
                def activate_extensions(enabled_extensions = nil)
         | 
| 67 67 | 
             
                  initializer.initialize_default_admin_tabs
         | 
| 68 68 | 
             
                  activated_extensions = @extension_roots.select do |root|
         | 
| 69 | 
            -
                    extension_file = "#{File.basename(root)}_extension"
         | 
| 69 | 
            +
                    extension_file = "#{File.basename(root).sub(/^\d+_/,'')}_extension"
         | 
| 70 70 | 
             
                    extension = extension_file.camelize.constantize
         | 
| 71 71 | 
             
                    extension.root = root
         | 
| 72 72 | 
             
                    extension.unloadable
         | 
| @@ -5,16 +5,9 @@ Object.extend(SiteMap.prototype, { | |
| 5 5 |  | 
| 6 6 | 
             
              ruledTableInitialize: RuledTable.prototype.initialize,
         | 
| 7 7 |  | 
| 8 | 
            -
              initialize: function(id) {
         | 
| 8 | 
            +
              initialize: function(id, expanded) {
         | 
| 9 9 | 
             
                this.ruledTableInitialize(id);
         | 
| 10 | 
            -
                this.expandedRows =  | 
| 11 | 
            -
              },
         | 
| 12 | 
            -
              
         | 
| 13 | 
            -
              parseCookieExpandedRows: function () {
         | 
| 14 | 
            -
                var cookieExpandedRows = [];
         | 
| 15 | 
            -
                if(document.cookie.length > 0 && document.cookie.match(/expanded_rows=(.*);/))
         | 
| 16 | 
            -
                   cookieExpandedRows = RegExp.$1.split(/,/).reject(function (value, index){ return value.length == 0; }).uniq();
         | 
| 17 | 
            -
                return cookieExpandedRows;
         | 
| 10 | 
            +
                this.expandedRows = expanded
         | 
| 18 11 | 
             
              },
         | 
| 19 12 |  | 
| 20 13 | 
             
              onRowSetup: function(row) {
         | 
| @@ -67,7 +60,7 @@ Object.extend(SiteMap.prototype, { | |
| 67 60 | 
             
              },     
         | 
| 68 61 |  | 
| 69 62 | 
             
              saveExpandedCookie: function() {
         | 
| 70 | 
            -
                document.cookie = "expanded_rows="+this.expandedRows.uniq().join(",")+"; path=/admin";
         | 
| 63 | 
            +
                document.cookie = "expanded_rows=" + this.expandedRows.uniq().join(",") + "; path=/admin";
         | 
| 71 64 | 
             
              }, 
         | 
| 72 65 |  | 
| 73 66 | 
             
              hideBranch: function(row, img) {
         | 
| @@ -82,9 +75,9 @@ Object.extend(SiteMap.prototype, { | |
| 82 75 | 
             
                }
         | 
| 83 76 | 
             
                var pageId = this.extractPageId(row);
         | 
| 84 77 | 
             
                var newExpanded = [];
         | 
| 85 | 
            -
                for(i=0; i < this.expandedRows.length; i++)
         | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 78 | 
            +
                for(i = 0; i < this.expandedRows.length; i++)
         | 
| 79 | 
            +
                  if(this.expandedRows[i] != pageId)
         | 
| 80 | 
            +
                    newExpanded.push(this.expandedRows[i]);
         | 
| 88 81 | 
             
                this.expandedRows = newExpanded;
         | 
| 89 82 | 
             
                this.saveExpandedCookie();
         | 
| 90 83 | 
             
                if (img == null)
         | 
    
        data/test/fixtures/extensions/{basic → 01_basic}/app/controllers/basic_extension_controller.rb
    RENAMED
    
    | 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/test/fixtures/extensions/{basic → 01_basic}/app/views/basic_extension_mailer/message.rhtml
    RENAMED
    
    | 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/test/fixtures/extensions/{overriding → 02_overriding}/app/views/basic_extension/override.rhtml
    RENAMED
    
    | 
            File without changes
         | 
| 
            File without changes
         | 
| @@ -7,12 +7,17 @@ class Admin::UserController; def rescue_action(e) raise e end; end | |
| 7 7 | 
             
            class Admin::UserControllerTest < Test::Unit::TestCase
         | 
| 8 8 |  | 
| 9 9 | 
             
              fixtures :users
         | 
| 10 | 
            +
              test_helper :user, :logging
         | 
| 10 11 |  | 
| 11 12 | 
             
              def setup
         | 
| 12 13 | 
             
                @controller = Admin::UserController.new
         | 
| 13 14 | 
             
                @request = ActionController::TestRequest.new
         | 
| 14 15 | 
             
                @response = ActionController::TestResponse.new
         | 
| 15 | 
            -
                @user = @request.session['user'] =  | 
| 16 | 
            +
                @user = @request.session['user'] = create_test_user
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
              
         | 
| 19 | 
            +
              def teardown
         | 
| 20 | 
            +
                destroy_test_user
         | 
| 16 21 | 
             
              end
         | 
| 17 22 |  | 
| 18 23 | 
             
              def test_ancestors
         | 
| @@ -46,11 +51,9 @@ class Admin::UserControllerTest < Test::Unit::TestCase | |
| 46 51 | 
             
                assigned_user = assigns(:user)
         | 
| 47 52 | 
             
                assert_equal @user, assigned_user
         | 
| 48 53 | 
             
                assert @user.object_id != assigned_user.object_id
         | 
| 49 | 
            -
                assert_equal ' | 
| 54 | 
            +
                assert_equal 'jdoe@gmail.com', assigned_user.email
         | 
| 50 55 | 
             
              end
         | 
| 51 56 | 
             
              def test_preferences__post
         | 
| 52 | 
            -
                @user = User.new(:name => 'Test', :login => 'pref_test', :password => 'whoa!', :password_confirmation => 'whoa!')
         | 
| 53 | 
            -
                assert @user.save
         | 
| 54 57 | 
             
                post(
         | 
| 55 58 | 
             
                  :preferences,
         | 
| 56 59 | 
             
                  { :user => { :password => '', :password_confirmation => '', :email => 'updated@gmail.com' } },
         | 
| @@ -59,13 +62,26 @@ class Admin::UserControllerTest < Test::Unit::TestCase | |
| 59 62 | 
             
                @user = User.find(@user.id)
         | 
| 60 63 | 
             
                assert_redirected_to page_index_url
         | 
| 61 64 | 
             
                assert_match /preferences.*?saved/i, flash[:notice] 
         | 
| 62 | 
            -
                assert_equal | 
| 63 | 
            -
                @user.destroy
         | 
| 65 | 
            +
                assert_equal 'updated@gmail.com', @user.email
         | 
| 64 66 | 
             
              end
         | 
| 65 67 | 
             
              def test_preferences__post_with_bad_data
         | 
| 66 68 | 
             
                get :preferences, 'user' => { :login => 'superman' }
         | 
| 67 69 | 
             
                assert_response :success
         | 
| 68 70 | 
             
                assert_match /bad form data/i, flash[:error]
         | 
| 69 71 | 
             
              end
         | 
| 72 | 
            +
              
         | 
| 73 | 
            +
              def test_change_password
         | 
| 74 | 
            +
                @user = User.create!(:name => 'Test', :login => 'pref_test', :password => 'whoa!', :password_confirmation => 'whoa!')
         | 
| 75 | 
            +
                post(
         | 
| 76 | 
            +
                  :preferences,
         | 
| 77 | 
            +
                  { :user => { :password => 'funtimes', :password_confirmation => 'funtimes' } },
         | 
| 78 | 
            +
                  { 'user' => @user }
         | 
| 79 | 
            +
                )
         | 
| 80 | 
            +
                @user = User.find(@user.id)
         | 
| 81 | 
            +
                assert_equal User.sha1('funtimes'), @user.password
         | 
| 82 | 
            +
                
         | 
| 83 | 
            +
                assert !log_matches(/"password"=>"funtimes"/)
         | 
| 84 | 
            +
                assert !log_matches(/"password_confirmation"=>"funtimes"/)
         | 
| 85 | 
            +
              end
         | 
| 70 86 |  | 
| 71 87 | 
             
            end
         | 
| @@ -6,6 +6,7 @@ class Admin::WelcomeController; def rescue_action(e) raise e end; end | |
| 6 6 |  | 
| 7 7 | 
             
            class Admin::WelcomeControllerTest < Test::Unit::TestCase
         | 
| 8 8 |  | 
| 9 | 
            +
              test_helper :logging
         | 
| 9 10 | 
             
              fixtures :users
         | 
| 10 11 |  | 
| 11 12 | 
             
              def setup
         | 
| @@ -30,6 +31,8 @@ class Admin::WelcomeControllerTest < Test::Unit::TestCase | |
| 30 31 | 
             
                user = session['user']
         | 
| 31 32 | 
             
                assert_kind_of User, user
         | 
| 32 33 | 
             
                assert_equal 'existing', user.login
         | 
| 34 | 
            +
                
         | 
| 35 | 
            +
                assert !log_matches(/"password"=>"password"/)
         | 
| 33 36 | 
             
              end
         | 
| 34 37 | 
             
              def test_login__post_invalid_user
         | 
| 35 38 | 
             
                post :login, 'user' => { :login => 'invalid', :password => 'password' }
         | 
| @@ -12,7 +12,7 @@ class ExtensionInitializationTest < Test::Unit::TestCase | |
| 12 12 |  | 
| 13 13 | 
             
              def test_load_paths
         | 
| 14 14 | 
             
                assert_nothing_raised { BasicExtension }
         | 
| 15 | 
            -
                assert_equal File.join(File.expand_path(RADIANT_ROOT), 'test', 'fixtures', 'extensions', ' | 
| 15 | 
            +
                assert_equal File.join(File.expand_path(RADIANT_ROOT), 'test', 'fixtures', 'extensions', '01_basic'), BasicExtension.root
         | 
| 16 16 | 
             
                assert_equal 'Basic', BasicExtension.extension_name
         | 
| 17 17 | 
             
                assert_nothing_raised { BasicExtensionController }
         | 
| 18 18 | 
             
                assert_nothing_raised { BasicExtensionModel }
         | 
| @@ -161,7 +161,25 @@ class SiteControllerTest < Test::Unit::TestCase | |
| 161 161 | 
             
                get :show_page, :url => 'documentation'
         | 
| 162 162 | 
             
                assert_response :success
         | 
| 163 163 | 
             
                assert_equal 'This is the documentation section.', @response.body
         | 
| 164 | 
            -
              end
         | 
| 164 | 
            +
              end
         | 
| 165 | 
            +
              
         | 
| 166 | 
            +
              def test_show_page__no_cache_if_post 
         | 
| 167 | 
            +
                @controller.cache.perform_caching = true 
         | 
| 168 | 
            +
                @cache.clear 
         | 
| 169 | 
            +
                post :show_page, :url => 'documentation' 
         | 
| 170 | 
            +
                assert_response :success 
         | 
| 171 | 
            +
                assert !File.exists?(cache_file('documentation')) 
         | 
| 172 | 
            +
              end 
         | 
| 173 | 
            +
             | 
| 174 | 
            +
              def test_show_page__no_cache_if_post__cached 
         | 
| 175 | 
            +
                @controller.cache.perform_caching = true 
         | 
| 176 | 
            +
                @request.host = 'dev.site.com' 
         | 
| 177 | 
            +
                @cache.cache_response('documentation', response(:body => 'expired body')) 
         | 
| 178 | 
            +
                post :show_page, :url => 'documentation' 
         | 
| 179 | 
            +
                assert_response :success 
         | 
| 180 | 
            +
                assert_equal 'This is the documentation section.', @response.body 
         | 
| 181 | 
            +
              end 
         | 
| 182 | 
            +
              
         | 
| 165 183 |  | 
| 166 184 | 
             
              def test_show_page__no_pages
         | 
| 167 185 | 
             
                Page.destroy_all
         | 
| @@ -198,7 +198,7 @@ class StandardTagsTest < Test::Unit::TestCase | |
| 198 198 | 
             
                assert_renders 'Monday, January 30, 2006', '<r:date for="created_at" />'
         | 
| 199 199 | 
             
                assert_renders 'Tuesday, January 31, 2006', '<r:date for="updated_at" />'
         | 
| 200 200 | 
             
                assert_renders 'Monday, January 30, 2006', '<r:date for="published_at" />'
         | 
| 201 | 
            -
                assert_render_error "Invalid value for ' | 
| 201 | 
            +
                assert_render_error "Invalid value for 'for' attribute.", '<r:date for="blah" />'
         | 
| 202 202 | 
             
              end
         | 
| 203 203 |  | 
| 204 204 | 
             
              def test_tag_link
         | 
    
        metadata
    CHANGED
    
    | @@ -3,8 +3,8 @@ rubygems_version: 0.9.2 | |
| 3 3 | 
             
            specification_version: 1
         | 
| 4 4 | 
             
            name: radiant
         | 
| 5 5 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 6 | 
            -
              version: 0.6. | 
| 7 | 
            -
            date: 2007- | 
| 6 | 
            +
              version: 0.6.1
         | 
| 7 | 
            +
            date: 2007-05-05 00:00:00 -04:00
         | 
| 8 8 | 
             
            summary: A no-fluff content management system designed for small teams.
         | 
| 9 9 | 
             
            require_paths: 
         | 
| 10 10 | 
             
            - lib
         | 
| @@ -322,32 +322,32 @@ files: | |
| 322 322 | 
             
            - test/fixtures/sample.txt
         | 
| 323 323 | 
             
            - test/fixtures/snippets.yml
         | 
| 324 324 | 
             
            - test/fixtures/users.yml
         | 
| 325 | 
            -
            - test/fixtures/extensions/ | 
| 326 | 
            -
            - test/fixtures/extensions/ | 
| 327 | 
            -
            - test/fixtures/extensions/ | 
| 328 | 
            -
            - test/fixtures/extensions/ | 
| 329 | 
            -
            - test/fixtures/extensions/ | 
| 330 | 
            -
            - test/fixtures/extensions/ | 
| 331 | 
            -
            - test/fixtures/extensions/ | 
| 332 | 
            -
            - test/fixtures/extensions/ | 
| 333 | 
            -
            - test/fixtures/extensions/ | 
| 334 | 
            -
            - test/fixtures/extensions/ | 
| 335 | 
            -
            - test/fixtures/extensions/ | 
| 336 | 
            -
            - test/fixtures/extensions/ | 
| 337 | 
            -
            - test/fixtures/extensions/ | 
| 338 | 
            -
            - test/fixtures/extensions/ | 
| 339 | 
            -
            - test/fixtures/extensions/ | 
| 340 | 
            -
            - test/fixtures/extensions/ | 
| 341 | 
            -
            - test/fixtures/extensions/ | 
| 342 | 
            -
            - test/fixtures/extensions/ | 
| 343 | 
            -
            - test/fixtures/extensions/ | 
| 344 | 
            -
            - test/fixtures/extensions/ | 
| 345 | 
            -
            - test/fixtures/extensions/ | 
| 346 | 
            -
            - test/fixtures/extensions/ | 
| 347 | 
            -
            - test/fixtures/extensions/ | 
| 348 | 
            -
            - test/fixtures/extensions/ | 
| 349 | 
            -
            - test/fixtures/extensions/ | 
| 350 | 
            -
            - test/fixtures/extensions/ | 
| 325 | 
            +
            - test/fixtures/extensions/01_basic
         | 
| 326 | 
            +
            - test/fixtures/extensions/02_overriding
         | 
| 327 | 
            +
            - test/fixtures/extensions/01_basic/app
         | 
| 328 | 
            +
            - test/fixtures/extensions/01_basic/basic_extension.rb
         | 
| 329 | 
            +
            - test/fixtures/extensions/01_basic/db
         | 
| 330 | 
            +
            - test/fixtures/extensions/01_basic/lib
         | 
| 331 | 
            +
            - test/fixtures/extensions/01_basic/app/controllers
         | 
| 332 | 
            +
            - test/fixtures/extensions/01_basic/app/models
         | 
| 333 | 
            +
            - test/fixtures/extensions/01_basic/app/views
         | 
| 334 | 
            +
            - test/fixtures/extensions/01_basic/app/controllers/basic_extension_controller.rb
         | 
| 335 | 
            +
            - test/fixtures/extensions/01_basic/app/models/basic_extension_mailer.rb
         | 
| 336 | 
            +
            - test/fixtures/extensions/01_basic/app/models/basic_extension_model.rb
         | 
| 337 | 
            +
            - test/fixtures/extensions/01_basic/app/views/basic_extension
         | 
| 338 | 
            +
            - test/fixtures/extensions/01_basic/app/views/basic_extension_mailer
         | 
| 339 | 
            +
            - test/fixtures/extensions/01_basic/app/views/basic_extension/index.rhtml
         | 
| 340 | 
            +
            - test/fixtures/extensions/01_basic/app/views/basic_extension/override.rhtml
         | 
| 341 | 
            +
            - test/fixtures/extensions/01_basic/app/views/basic_extension_mailer/message.rhtml
         | 
| 342 | 
            +
            - test/fixtures/extensions/01_basic/db/migrate
         | 
| 343 | 
            +
            - test/fixtures/extensions/01_basic/db/migrate/001_create_initial_schema.rb
         | 
| 344 | 
            +
            - test/fixtures/extensions/01_basic/db/migrate/002_modify_initial_schema.rb
         | 
| 345 | 
            +
            - test/fixtures/extensions/01_basic/lib/tasks
         | 
| 346 | 
            +
            - test/fixtures/extensions/02_overriding/app
         | 
| 347 | 
            +
            - test/fixtures/extensions/02_overriding/overriding_extension.rb
         | 
| 348 | 
            +
            - test/fixtures/extensions/02_overriding/app/views
         | 
| 349 | 
            +
            - test/fixtures/extensions/02_overriding/app/views/basic_extension
         | 
| 350 | 
            +
            - test/fixtures/extensions/02_overriding/app/views/basic_extension/override.rhtml
         | 
| 351 351 | 
             
            - test/functional/admin
         | 
| 352 352 | 
             
            - test/functional/application_controller_test.rb
         | 
| 353 353 | 
             
            - test/functional/extension_initialization_test.rb
         | 
| @@ -366,6 +366,7 @@ files: | |
| 366 366 | 
             
            - test/helpers/extension_fixture_test_helper.rb
         | 
| 367 367 | 
             
            - test/helpers/extension_tag_test_helper.rb
         | 
| 368 368 | 
             
            - test/helpers/layout_test_helper.rb
         | 
| 369 | 
            +
            - test/helpers/logging_test_helper.rb
         | 
| 369 370 | 
             
            - test/helpers/page_part_test_helper.rb
         | 
| 370 371 | 
             
            - test/helpers/page_test_helper.rb
         | 
| 371 372 | 
             
            - test/helpers/render_test_helper.rb
         |