really odd alias_method_chain bug in test environment

Oleg committed Aug 31, 2010
commit 3159486d464943a61d6a956b4fbb14053ec5c55c
Showing 5 changed files with 45 additions and 35 deletions
Gemfile +1 -1
@@ @@ -1,6 +1,6 @@
source 'http://rubygems.org'
- gem 'rails', '3.0.0.rc2'
+ gem 'rails', '3.0.0'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'active_link_to', '>=0.0.6'
Gemfile.lock +31 -31
@@ @@ -2,12 +2,12 @@ GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
- actionmailer (3.0.0.rc2)
- actionpack (= 3.0.0.rc2)
+ actionmailer (3.0.0)
+ actionpack (= 3.0.0)
mail (~> 2.2.5)
- actionpack (3.0.0.rc2)
- activemodel (= 3.0.0.rc2)
- activesupport (= 3.0.0.rc2)
+ actionpack (3.0.0)
+ activemodel (= 3.0.0)
+ activesupport (= 3.0.0)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4.1)
@@ @@ -16,21 +16,21 @@ GEM
rack-test (~> 0.5.4)
tzinfo (~> 0.3.23)
active_link_to (0.0.6)
- activemodel (3.0.0.rc2)
- activesupport (= 3.0.0.rc2)
+ activemodel (3.0.0)
+ activesupport (= 3.0.0)
builder (~> 2.1.2)
i18n (~> 0.4.1)
- activerecord (3.0.0.rc2)
- activemodel (= 3.0.0.rc2)
- activesupport (= 3.0.0.rc2)
- arel (~> 1.0.0.rc1)
+ activerecord (3.0.0)
+ activemodel (= 3.0.0)
+ activesupport (= 3.0.0)
+ arel (~> 1.0.0)
tzinfo (~> 0.3.23)
- activeresource (3.0.0.rc2)
- activemodel (= 3.0.0.rc2)
- activesupport (= 3.0.0.rc2)
- activesupport (3.0.0.rc2)
- arel (1.0.0.rc1)
- activesupport (>= 3.0.0.beta)
+ activeresource (3.0.0)
+ activemodel (= 3.0.0)
+ activesupport (= 3.0.0)
+ activesupport (3.0.0)
+ arel (1.0.1)
+ activesupport (~> 3.0.0)
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
@@ @@ -45,22 +45,22 @@ GEM
activesupport
polyglot (0.3.1)
rack (1.2.1)
- rack-mount (0.6.12)
+ rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.4)
rack (>= 1.0)
- rails (3.0.0.rc2)
- actionmailer (= 3.0.0.rc2)
- actionpack (= 3.0.0.rc2)
- activerecord (= 3.0.0.rc2)
- activeresource (= 3.0.0.rc2)
- activesupport (= 3.0.0.rc2)
- bundler (>= 1.0.0.rc.6)
- railties (= 3.0.0.rc2)
- railties (3.0.0.rc2)
- actionpack (= 3.0.0.rc2)
- activesupport (= 3.0.0.rc2)
- rake (>= 0.8.3)
+ rails (3.0.0)
+ actionmailer (= 3.0.0)
+ actionpack (= 3.0.0)
+ activerecord (= 3.0.0)
+ activeresource (= 3.0.0)
+ activesupport (= 3.0.0)
+ bundler (~> 1.0.0)
+ railties (= 3.0.0)
+ railties (3.0.0)
+ actionpack (= 3.0.0)
+ activesupport (= 3.0.0)
+ rake (>= 0.8.4)
thor (~> 0.14.0)
rake (0.8.7)
sqlite3-ruby (1.3.1)
@@ @@ -76,5 +76,5 @@ DEPENDENCIES
active_link_to (>= 0.0.6)
mime-types
paperclip (>= 2.3.3)
- rails (= 3.0.0.rc2)
+ rails (= 3.0.0)
sqlite3-ruby
app/models/cms_layout.rb +5 -0
@@ @@ -9,5 +9,10 @@ class CmsLayout < ActiveRecord::Base
:uniqueness => true
validates :content,
:presence => true
+
+ # -- Class Methods --------------------------------------------------------
+ def self.options_for_select
+ CmsLayout.all(:select => 'id, label').collect { |l| [ l.label, l.id ] }
+ end
end
app/views/cms_admin/pages/_form.html.erb +1 -0
@@ @@ -1,3 +1,4 @@
+ <%= form.select :cms_layout_id, CmsLayout.options_for_select, {} %>
<%= form.text_field :label %>
<%= form.text_field :slug %>
test/unit/cms_tag_test.rb +7 -3
@@ @@ -13,7 +13,7 @@ class CmsTagTest < ActiveSupport::TestCase
def test_initialize_tags
content = cms_layouts(:default).content
- tags = CmsTag.initialize_tags(content)
+ tags = CmsTag.initialize_tags(nil, content)
assert_equal 3, tags.size
assert_equal 3, (cms_blocks = tags.select{|t| t.class.superclass == CmsBlock}).count
cms_blocks.each do |block|
@@ @@ -22,8 +22,12 @@ class CmsTagTest < ActiveSupport::TestCase
end
def test_initialize_tags_for_a_page
- content = cms_layouts(:default).content
- tags = CmsTag.initialize_tags(content, :cms_page => cms_pages(:default))
+ @cms_page = CmsPage.new
+ @cms_page.cms_layout ||= CmsLayout.first
+ tags = @cms_page.initialize_tags
+
+
+ # tags = CmsTag.initialize_tags(cms_pages(:default))
assert_equal 3, tags.size
assert_equal 3, (cms_blocks = tags.select{|t| t.class.superclass == CmsBlock}).count
cms_blocks.each do |block|