lolita-translation 0.0.3 → 0.0.4
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.
- data/.document +5 -5
- data/Gemfile +9 -9
- data/LICENSE.txt +20 -20
- data/README.md +44 -33
- data/Rakefile +53 -53
- data/VERSION +1 -1
- data/app/views/components/lolita/configuration/tab/translation/_display.html.erb +78 -76
- data/config/locales/en.yml +9 -8
- data/config/locales/lv.yml +9 -0
- data/lib/generators/lolita_translation/USAGE +8 -8
- data/lib/generators/lolita_translation/has_translations_generator.rb +8 -8
- data/lib/lolita-translation.rb +11 -11
- data/lib/lolita-translation/configuration/tab/translation.rb +13 -13
- data/lib/lolita-translation/has_translations.rb +294 -294
- data/lib/lolita-translation/rails.rb +4 -4
- data/lib/lolita-translation/string.rb +18 -18
- data/lib/tasks/has_translations_tasks.rake +4 -4
- data/lolita-translation.gemspec +3 -3
- data/lolita-translations.gemspec +60 -60
- data/spec/has_translations_spec.rb +43 -43
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +98 -98
- metadata +14 -14
- data/app/views/lolita/has_translations/_tab.html.erb +0 -78
@@ -1,5 +1,5 @@
|
|
1
|
-
module LolitaHasTranslation
|
2
|
-
class Engine < Rails::Engine
|
3
|
-
|
4
|
-
end
|
1
|
+
module LolitaHasTranslation
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
|
4
|
+
end
|
5
5
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
class String
|
2
|
-
attr_accessor :origin_model, :origin_name
|
3
|
-
def set_origins obj, name
|
4
|
-
self.origin_model = obj
|
5
|
-
self.origin_name = name
|
6
|
-
self
|
7
|
-
end
|
8
|
-
# forces given locale
|
9
|
-
# I18n.locale = :lv
|
10
|
-
# a = Article.find 18
|
11
|
-
# a.title
|
12
|
-
# => "LV title"
|
13
|
-
# a.title.in(:en)
|
14
|
-
# => "EN title"
|
15
|
-
def in locale
|
16
|
-
return self unless self.origin_model
|
17
|
-
translation = self.origin_model.in(locale) and translation.send(self.origin_name)
|
18
|
-
end
|
1
|
+
class String
|
2
|
+
attr_accessor :origin_model, :origin_name
|
3
|
+
def set_origins obj, name
|
4
|
+
self.origin_model = obj
|
5
|
+
self.origin_name = name
|
6
|
+
self
|
7
|
+
end
|
8
|
+
# forces given locale
|
9
|
+
# I18n.locale = :lv
|
10
|
+
# a = Article.find 18
|
11
|
+
# a.title
|
12
|
+
# => "LV title"
|
13
|
+
# a.title.in(:en)
|
14
|
+
# => "EN title"
|
15
|
+
def in locale
|
16
|
+
return self unless self.origin_model
|
17
|
+
translation = self.origin_model.in(locale) and translation.send(self.origin_name)
|
18
|
+
end
|
19
19
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# desc "Explaining what the task does"
|
2
|
-
# task :has_translations do
|
3
|
-
# # Task goes here
|
4
|
-
# end
|
1
|
+
# desc "Explaining what the task does"
|
2
|
+
# task :has_translations do
|
3
|
+
# # Task goes here
|
4
|
+
# end
|
data/lolita-translation.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{lolita-translation}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["ITHouse", "Gatis Tomsons", "Arturs Meisters"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-10}
|
13
13
|
s.description = %q{Translates models in Lolita}
|
14
14
|
s.email = %q{support@ithouse.lv}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
26
|
"app/views/components/lolita/configuration/tab/translation/_display.html.erb",
|
27
|
-
"app/views/lolita/has_translations/_tab.html.erb",
|
28
27
|
"config/locales/en.yml",
|
28
|
+
"config/locales/lv.yml",
|
29
29
|
"lib/generators/lolita_translation/USAGE",
|
30
30
|
"lib/generators/lolita_translation/has_translations_generator.rb",
|
31
31
|
"lib/lolita-translation.rb",
|
data/lolita-translations.gemspec
CHANGED
@@ -1,60 +1,60 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{lolita-translations}
|
8
|
-
s.version = "0.0.1"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["ITHouse", "Gatis Tomsons", "Arturs Meisters"]
|
12
|
-
s.date = %q{2011-08-01}
|
13
|
-
s.description = %q{Translates models in Lolita}
|
14
|
-
s.email = %q{support@ithouse.lv}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"Gemfile",
|
22
|
-
"LICENSE.txt",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION"
|
25
|
-
]
|
26
|
-
s.homepage = %q{http://github.com/ithouse/lolita-translations}
|
27
|
-
s.licenses = ["MIT"]
|
28
|
-
s.require_paths = ["lib"]
|
29
|
-
s.rubygems_version = %q{1.6.2}
|
30
|
-
s.summary = %q{Lolita models translation plugin}
|
31
|
-
s.test_files = [
|
32
|
-
"spec/has_translations_spec.rb",
|
33
|
-
"spec/spec_helper.rb"
|
34
|
-
]
|
35
|
-
|
36
|
-
if s.respond_to? :specification_version then
|
37
|
-
s.specification_version = 3
|
38
|
-
|
39
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
41
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
42
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
43
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
44
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
45
|
-
else
|
46
|
-
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
47
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
48
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
50
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
51
|
-
end
|
52
|
-
else
|
53
|
-
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
54
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
55
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
56
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
57
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{lolita-translations}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["ITHouse", "Gatis Tomsons", "Arturs Meisters"]
|
12
|
+
s.date = %q{2011-08-01}
|
13
|
+
s.description = %q{Translates models in Lolita}
|
14
|
+
s.email = %q{support@ithouse.lv}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"LICENSE.txt",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION"
|
25
|
+
]
|
26
|
+
s.homepage = %q{http://github.com/ithouse/lolita-translations}
|
27
|
+
s.licenses = ["MIT"]
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubygems_version = %q{1.6.2}
|
30
|
+
s.summary = %q{Lolita models translation plugin}
|
31
|
+
s.test_files = [
|
32
|
+
"spec/has_translations_spec.rb",
|
33
|
+
"spec/spec_helper.rb"
|
34
|
+
]
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
s.specification_version = 3
|
38
|
+
|
39
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
41
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
42
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
43
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
44
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
47
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
48
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
50
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
54
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
55
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
57
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
@@ -1,43 +1,43 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
-
|
4
|
-
describe 'HasTranslations' do
|
5
|
-
it "should switch locales" do
|
6
|
-
g = Group.create!(:name => "Sport")
|
7
|
-
c = Category.create!(:name => "Golf", :groups => [g])
|
8
|
-
z = News.create!(:title => "Tiger Woods sucks", :body => Faker::Lorem::paragraphs(10).join, :category_id => c.id)
|
9
|
-
# translate
|
10
|
-
g.translations.create!(:locale => 'lv', :name => "Sports")
|
11
|
-
c.translations.create!(:locale => 'lv', :name => "Golfs")
|
12
|
-
z.translations.create!(:locale => 'lv', :title => "Taigers Vuds nekam neder")
|
13
|
-
|
14
|
-
g.name.should == "Sport"
|
15
|
-
c.name.should == "Golf"
|
16
|
-
z.title.should == "Tiger Woods sucks"
|
17
|
-
|
18
|
-
I18n.locale = :lv
|
19
|
-
|
20
|
-
g.name.should == "Sports"
|
21
|
-
c.name.should == "Golfs"
|
22
|
-
z.title.should == "Taigers Vuds nekam neder"
|
23
|
-
|
24
|
-
z.category.name.should == "Golfs"
|
25
|
-
z.category.groups.first.name.should == "Sports"
|
26
|
-
|
27
|
-
z.destroy
|
28
|
-
c.destroy
|
29
|
-
g.destroy
|
30
|
-
#--------------------------------
|
31
|
-
I18n.locale = I18n.default_locale
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should load requested locale with 'in' method" do
|
35
|
-
g = Group.create!(:name => "Sport")
|
36
|
-
g.translations.create!(:locale => 'lv', :name => "Sports")
|
37
|
-
|
38
|
-
g = Group.find_by_name "Sport"
|
39
|
-
g.name.should == "Sport"
|
40
|
-
g.name.in(:lv).should == "Sports"
|
41
|
-
g.name.should == "Sport"
|
42
|
-
end
|
43
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
3
|
+
|
4
|
+
describe 'HasTranslations' do
|
5
|
+
it "should switch locales" do
|
6
|
+
g = Group.create!(:name => "Sport")
|
7
|
+
c = Category.create!(:name => "Golf", :groups => [g])
|
8
|
+
z = News.create!(:title => "Tiger Woods sucks", :body => Faker::Lorem::paragraphs(10).join, :category_id => c.id)
|
9
|
+
# translate
|
10
|
+
g.translations.create!(:locale => 'lv', :name => "Sports")
|
11
|
+
c.translations.create!(:locale => 'lv', :name => "Golfs")
|
12
|
+
z.translations.create!(:locale => 'lv', :title => "Taigers Vuds nekam neder")
|
13
|
+
|
14
|
+
g.name.should == "Sport"
|
15
|
+
c.name.should == "Golf"
|
16
|
+
z.title.should == "Tiger Woods sucks"
|
17
|
+
|
18
|
+
I18n.locale = :lv
|
19
|
+
|
20
|
+
g.name.should == "Sports"
|
21
|
+
c.name.should == "Golfs"
|
22
|
+
z.title.should == "Taigers Vuds nekam neder"
|
23
|
+
|
24
|
+
z.category.name.should == "Golfs"
|
25
|
+
z.category.groups.first.name.should == "Sports"
|
26
|
+
|
27
|
+
z.destroy
|
28
|
+
c.destroy
|
29
|
+
g.destroy
|
30
|
+
#--------------------------------
|
31
|
+
I18n.locale = I18n.default_locale
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should load requested locale with 'in' method" do
|
35
|
+
g = Group.create!(:name => "Sport")
|
36
|
+
g.translations.create!(:locale => 'lv', :name => "Sports")
|
37
|
+
|
38
|
+
g = Group.find_by_name "Sport"
|
39
|
+
g.name.should == "Sport"
|
40
|
+
g.name.in(:lv).should == "Sports"
|
41
|
+
g.name.should == "Sport"
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec.opts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
--colour
|
2
|
-
--reverse
|
1
|
+
--colour
|
2
|
+
--reverse
|
3
3
|
--backtrace
|
data/spec/spec_helper.rb
CHANGED
@@ -1,98 +1,98 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'rubygems'
|
3
|
-
gem 'rails', '~>2.3'
|
4
|
-
require 'i18n'
|
5
|
-
require 'active_record'
|
6
|
-
require 'spec'
|
7
|
-
require 'faker'
|
8
|
-
|
9
|
-
require 'ruby-debug'
|
10
|
-
|
11
|
-
require File.dirname(__FILE__)+'/../init.rb'
|
12
|
-
ActiveRecord::Base.logger = Logger.new(File.open("#{File.dirname(__FILE__)}/database.log", 'w+'))
|
13
|
-
ActiveRecord::Base.establish_connection({ :database => ":memory:", :adapter => 'sqlite3', :timeout => 500 })
|
14
|
-
|
15
|
-
# setup I18n
|
16
|
-
I18n.available_locales = [:en,:lv,:ru,:fr]
|
17
|
-
I18n.default_locale = :en
|
18
|
-
I18n.locale = :en
|
19
|
-
|
20
|
-
# Add models
|
21
|
-
ActiveRecord::Schema.define do
|
22
|
-
create_table :news, :force => true do |t|
|
23
|
-
t.string :title
|
24
|
-
t.string :slug
|
25
|
-
t.text :body
|
26
|
-
t.integer :category_id
|
27
|
-
t.integer :trx_id
|
28
|
-
end
|
29
|
-
create_table :categories, :force => true do |t|
|
30
|
-
t.string :name
|
31
|
-
t.string :desc
|
32
|
-
t.integer :trx_id
|
33
|
-
end
|
34
|
-
create_table :groups, :force => true do |t|
|
35
|
-
t.string :name
|
36
|
-
end
|
37
|
-
create_table :categories_groups, :force => true, :id => false do |t|
|
38
|
-
t.integer :category_id
|
39
|
-
t.integer :group_id
|
40
|
-
end
|
41
|
-
create_table :meta_datas, :force => true do |t|
|
42
|
-
t.string :title
|
43
|
-
t.string :url
|
44
|
-
t.string :keywords
|
45
|
-
t.text :description
|
46
|
-
t.string :metaable_type
|
47
|
-
t.integer :metaable_id
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class News < ActiveRecord::Base
|
52
|
-
belongs_to :category, :dependent => :destroy
|
53
|
-
has_one :meta_data, :as => :metaable, :dependent => :destroy
|
54
|
-
translations :title, :body
|
55
|
-
end
|
56
|
-
|
57
|
-
class Category < ActiveRecord::Base
|
58
|
-
has_many :news
|
59
|
-
has_and_belongs_to_many :groups
|
60
|
-
translations :name
|
61
|
-
end
|
62
|
-
|
63
|
-
class Group < ActiveRecord::Base
|
64
|
-
has_and_belongs_to_many :categories
|
65
|
-
translations :name
|
66
|
-
end
|
67
|
-
|
68
|
-
class MetaData < ActiveRecord::Base
|
69
|
-
belongs_to :metaable, :polymorphic => true
|
70
|
-
translations :title, :url, :keywords, :description
|
71
|
-
end
|
72
|
-
|
73
|
-
# build translation tables
|
74
|
-
|
75
|
-
News.sync_translation_table!
|
76
|
-
Category.sync_translation_table!
|
77
|
-
Group.sync_translation_table!
|
78
|
-
MetaData.sync_translation_table!
|
79
|
-
|
80
|
-
# this is included in Lolita by default
|
81
|
-
class ::Hash
|
82
|
-
# converts all keys to symbols, but RECURSIVE
|
83
|
-
def symbolize_keys!
|
84
|
-
each do |k,v|
|
85
|
-
sym = k.respond_to?(:to_sym) ? k.to_sym : k
|
86
|
-
self[sym] = Hash === v ? v.symbolize_keys! : v
|
87
|
-
delete(k) unless k == sym
|
88
|
-
end
|
89
|
-
self
|
90
|
-
end
|
91
|
-
end
|
92
|
-
Spec::Runner.configure do |config|
|
93
|
-
config.before(:each) do
|
94
|
-
News.delete_all
|
95
|
-
Category.delete_all
|
96
|
-
MetaData.delete_all
|
97
|
-
end
|
98
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
gem 'rails', '~>2.3'
|
4
|
+
require 'i18n'
|
5
|
+
require 'active_record'
|
6
|
+
require 'spec'
|
7
|
+
require 'faker'
|
8
|
+
|
9
|
+
require 'ruby-debug'
|
10
|
+
|
11
|
+
require File.dirname(__FILE__)+'/../init.rb'
|
12
|
+
ActiveRecord::Base.logger = Logger.new(File.open("#{File.dirname(__FILE__)}/database.log", 'w+'))
|
13
|
+
ActiveRecord::Base.establish_connection({ :database => ":memory:", :adapter => 'sqlite3', :timeout => 500 })
|
14
|
+
|
15
|
+
# setup I18n
|
16
|
+
I18n.available_locales = [:en,:lv,:ru,:fr]
|
17
|
+
I18n.default_locale = :en
|
18
|
+
I18n.locale = :en
|
19
|
+
|
20
|
+
# Add models
|
21
|
+
ActiveRecord::Schema.define do
|
22
|
+
create_table :news, :force => true do |t|
|
23
|
+
t.string :title
|
24
|
+
t.string :slug
|
25
|
+
t.text :body
|
26
|
+
t.integer :category_id
|
27
|
+
t.integer :trx_id
|
28
|
+
end
|
29
|
+
create_table :categories, :force => true do |t|
|
30
|
+
t.string :name
|
31
|
+
t.string :desc
|
32
|
+
t.integer :trx_id
|
33
|
+
end
|
34
|
+
create_table :groups, :force => true do |t|
|
35
|
+
t.string :name
|
36
|
+
end
|
37
|
+
create_table :categories_groups, :force => true, :id => false do |t|
|
38
|
+
t.integer :category_id
|
39
|
+
t.integer :group_id
|
40
|
+
end
|
41
|
+
create_table :meta_datas, :force => true do |t|
|
42
|
+
t.string :title
|
43
|
+
t.string :url
|
44
|
+
t.string :keywords
|
45
|
+
t.text :description
|
46
|
+
t.string :metaable_type
|
47
|
+
t.integer :metaable_id
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class News < ActiveRecord::Base
|
52
|
+
belongs_to :category, :dependent => :destroy
|
53
|
+
has_one :meta_data, :as => :metaable, :dependent => :destroy
|
54
|
+
translations :title, :body
|
55
|
+
end
|
56
|
+
|
57
|
+
class Category < ActiveRecord::Base
|
58
|
+
has_many :news
|
59
|
+
has_and_belongs_to_many :groups
|
60
|
+
translations :name
|
61
|
+
end
|
62
|
+
|
63
|
+
class Group < ActiveRecord::Base
|
64
|
+
has_and_belongs_to_many :categories
|
65
|
+
translations :name
|
66
|
+
end
|
67
|
+
|
68
|
+
class MetaData < ActiveRecord::Base
|
69
|
+
belongs_to :metaable, :polymorphic => true
|
70
|
+
translations :title, :url, :keywords, :description
|
71
|
+
end
|
72
|
+
|
73
|
+
# build translation tables
|
74
|
+
|
75
|
+
News.sync_translation_table!
|
76
|
+
Category.sync_translation_table!
|
77
|
+
Group.sync_translation_table!
|
78
|
+
MetaData.sync_translation_table!
|
79
|
+
|
80
|
+
# this is included in Lolita by default
|
81
|
+
class ::Hash
|
82
|
+
# converts all keys to symbols, but RECURSIVE
|
83
|
+
def symbolize_keys!
|
84
|
+
each do |k,v|
|
85
|
+
sym = k.respond_to?(:to_sym) ? k.to_sym : k
|
86
|
+
self[sym] = Hash === v ? v.symbolize_keys! : v
|
87
|
+
delete(k) unless k == sym
|
88
|
+
end
|
89
|
+
self
|
90
|
+
end
|
91
|
+
end
|
92
|
+
Spec::Runner.configure do |config|
|
93
|
+
config.before(:each) do
|
94
|
+
News.delete_all
|
95
|
+
Category.delete_all
|
96
|
+
MetaData.delete_all
|
97
|
+
end
|
98
|
+
end
|