aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Guardfile10
-rw-r--r--spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb2
-rw-r--r--spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb4
-rw-r--r--spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb26
-rw-r--r--spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb11
-rw-r--r--spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb15
-rw-r--r--spec/dummy/db/schema.rb7
-rw-r--r--spec/dummy/db/seed/.gitkeep0
-rw-r--r--spec/dummy/db/seeds/pages.rb8
-rw-r--r--spec/spec_helper.rb3
-rw-r--r--spec/support/refinery.rb4
11 files changed, 52 insertions, 38 deletions
diff --git a/Guardfile b/Guardfile
index 4de3a30..7774821 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,12 +1,4 @@
-# A sample Guardfile
-# More info at https://github.com/guard/guard#readme
-
-guard 'rspec', :version => 2 do
- watch(%r{^spec/.+_spec\.rb$})
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
- watch('spec/spec_helper.rb') { "spec" }
-
- # Rails example
+guard 'rspec', :version => 2, :cli => "--format Fuubar --color --drb" do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
diff --git a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb
index c2dd42c..5061efa 100644
--- a/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb
+++ b/spec/dummy/db/migrate/20100913234706_create_refinerycms_core_schema.rb
@@ -4,7 +4,7 @@ class CreateRefinerycmsCoreSchema < ActiveRecord::Migration
create_table ::Slug.table_name, :force => true do |t|
t.string "name"
t.integer "sluggable_id"
- t.integer "sequence", :default => 1, :null => false
+ t.integer "sequence", :default => 1, :null => false
t.string "sluggable_type", :limit => 40
t.string "scope", :limit => 40
t.datetime "created_at"
diff --git a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb
index bdb0a43..1280e88 100644
--- a/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb
+++ b/spec/dummy/db/migrate/20101217113425_translate_page_plugin.rb
@@ -13,7 +13,9 @@ class TranslatePagePlugin < ActiveRecord::Migration
:title => :string,
:meta_keywords => :string,
:meta_description => :text,
- :browser_title => :string
+ :browser_title => :string,
+ :custom_slug => :string,
+ :menu_title => :string
}, {
:migrate_data => true
})
diff --git a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb
index 2bcecc7..7d87d84 100644
--- a/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb
+++ b/spec/dummy/db/migrate/20110307025652_translate_custom_title_on_pages.rb
@@ -1,30 +1,30 @@
class TranslateCustomTitleOnPages < ActiveRecord::Migration
def self.up
- unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:custom_title)
- add_column ::Refinery::Page.translation_class.table_name, :custom_title, :string
+ unless ::Refinery::Page.translation_class.column_names.map(&:to_sym).include?(:menu_title)
+ add_column ::Refinery::Page.translation_class.table_name, :menu_title, :string
- say_with_time("Re-save custom_title") do
+ say_with_time("Re-save menu_title") do
::Refinery::Page.all.each do |page|
- say "updating custom_title field for page##{page.id}"
- page.update_attribute(:custom_title, page.untranslated_attributes['custom_title'])
+ say "updating menu_title field for page##{page.id}"
+ page.update_attribute(:menu_title, page.untranslated_attributes['menu_title'])
end
end
else
- say "Nothing done, ::Refinery::Page.translation_class table already includes a custom_title field"
+ say "Nothing done, ::Refinery::Page.translation_class table already includes a menu_title field"
end
::Refinery::Page.translation_class.reset_column_information
end
def self.down
- say_with_time("Re-save custom_title") do
+ say_with_time("Re-save menu_title") do
::Refinery::Page.all.each do |page|
- if page.attributes['custom_title'].nil?
- say "Nothing done, page##{page.id} custom_title field is nil"
+ if page.attributes['menu_title'].nil?
+ say "Nothing done, page##{page.id} menu_title field is nil"
else
- say "updating custom_title field for page #{page.id}"
+ say "updating menu_title field for page #{page.id}"
::Refinery::Page.update_all({
- :custom_title => page.attributes['custom_title']
+ :menu_title => page.attributes['menu_title']
}, {
:id => page.id.to_s
})
@@ -32,9 +32,9 @@ class TranslateCustomTitleOnPages < ActiveRecord::Migration
end
end
- remove_column ::Refinery::Page.translation_class.table_name, :custom_title
+ remove_column ::Refinery::Page.translation_class.table_name, :menu_title
- ::Refinery::Page.translated_attribute_names.delete(:custom_title)
+ ::Refinery::Page.translated_attribute_names.delete(:menu_title)
::Refinery::Page.translation_class.reset_column_information
end
diff --git a/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb
new file mode 100644
index 0000000..2feb837
--- /dev/null
+++ b/spec/dummy/db/migrate/20110810070753_add_custom_slug_to_refinery_page_translations.rb
@@ -0,0 +1,11 @@
+class AddCustomSlugToRefineryPageTranslations < ActiveRecord::Migration
+ def up
+ if ::Refinery::Page::Translation.column_names.map(&:to_sym).exclude?(:custom_slug)
+ add_column ::Refinery::Page::Translation.table_name, :custom_slug, :string, :default => nil
+ end
+ end
+
+ def down
+ remove_column ::Refinery::Page::Translation.table_name, :custom_slug
+ end
+end
diff --git a/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb
new file mode 100644
index 0000000..0ce6cb2
--- /dev/null
+++ b/spec/dummy/db/migrate/20110812055013_rename_custom_title_to_menu_title_in_refinery_pages.rb
@@ -0,0 +1,15 @@
+class RenameCustomTitleToMenuTitleInRefineryPages < ActiveRecord::Migration
+ def up
+ if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:custom_title)
+ rename_column ::Refinery::Page::Translation.table_name, :custom_title, :menu_title
+ end
+ remove_column ::Refinery::Page.table_name, :custom_title_type
+ end
+
+ def down
+ if ::Refinery::Page::Translation.column_names.map(&:to_sym).include?(:menu_title)
+ rename_column ::Refinery::Page::Translation.table_name, :menu_title, :custom_title
+ end
+ add_column ::Refinery::Page.table_name, :custom_title_type, :string
+ end
+end
diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb
index afb4ec6..f65cc81 100644
--- a/spec/dummy/db/schema.rb
+++ b/spec/dummy/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110803223529) do
+ActiveRecord::Schema.define(:version => 20110812055013) do
create_table "refinery_blog_categories", :force => true do |t|
t.string "title"
@@ -95,7 +95,8 @@ ActiveRecord::Schema.define(:version => 20110803223529) do
t.integer "refinery_page_id"
t.string "locale"
t.string "title"
- t.string "custom_title"
+ t.string "custom_slug"
+ t.string "menu_title"
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -112,7 +113,7 @@ ActiveRecord::Schema.define(:version => 20110803223529) do
t.string "link_url"
t.string "menu_match"
t.boolean "deletable", :default => true
- t.string "custom_title_type", :default => "none"
+ t.string "custom_title"
t.boolean "draft", :default => false
t.boolean "skip_to_first_child", :default => false
t.integer "lft"
diff --git a/spec/dummy/db/seed/.gitkeep b/spec/dummy/db/seed/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/spec/dummy/db/seed/.gitkeep
+++ /dev/null
diff --git a/spec/dummy/db/seeds/pages.rb b/spec/dummy/db/seeds/pages.rb
index 677f17d..62d4e8d 100644
--- a/spec/dummy/db/seeds/pages.rb
+++ b/spec/dummy/db/seeds/pages.rb
@@ -1,14 +1,6 @@
module Refinery
::Refinery::Page.reset_column_information
- # Check whether all columns are applied yet by seo_meta.
- unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k|
- ::Refinery::Page.translation_class.instance_methods.include?(k)
- }
- # Make pages model seo_meta because not all columns are accessible.
- ::Refinery::Page.translation_class.send :is_seo_meta
- end
-
page_position = -1
unless ::Refinery::Page.where(:menu_match => "^/$").any?
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 75db576..68edfe8 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -12,6 +12,7 @@ def setup_environment
require 'rspec/rails'
require 'capybara/rspec'
require 'factory_girl'
+ require 'refinerycms-testing'
Rails.backtrace_cleaner.remove_silencers!
@@ -23,6 +24,8 @@ def setup_environment
RSpec.configure do |config|
config.mock_with :rspec
config.use_transactional_fixtures = false
+
+ config.extend ActionController::Testing::Caching, :type => :controller
end
end
diff --git a/spec/support/refinery.rb b/spec/support/refinery.rb
index 85d28ce..d761787 100644
--- a/spec/support/refinery.rb
+++ b/spec/support/refinery.rb
@@ -1,6 +1,4 @@
-require 'refinery/testing/factories'
-require 'refinery/testing/controller_macros'
-require 'refinery/testing/request_macros'
+require 'refinerycms-testing'
RSpec.configure do |config|
config.extend Refinery::Testing::ControllerMacros::Authentication, :type => :controller