admin_data 1.0.11 → 1.0.12
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/README.md +25 -0
- data/app/controllers/admin_data/base_controller.rb +2 -7
- data/app/views/admin_data/main/edit.html.erb +1 -2
- data/app/views/admin_data/main/misc/_form.html.erb +9 -2
- data/app/views/admin_data/shared/_drop_down_klasses.html.erb +1 -1
- data/app/views/admin_data/shared/_powered_by.html.erb +3 -20
- data/lib/admin_data/helpers.rb +1 -1
- data/lib/admin_data/version.rb +1 -1
- data/lib/js/vendor/{code.jquery.com jquery-1.4.2.js → jquery-1.4.2.js} +0 -0
- metadata +9 -110
- data/README.textile +0 -21
- data/lib/js/vendor/jquery.lint.js +0 -604
- data/test/factories/article.rb +0 -9
- data/test/factories/car.rb +0 -4
- data/test/factories/city.rb +0 -4
- data/test/factories/comment.rb +0 -6
- data/test/factories/door.rb +0 -4
- data/test/factories/engine.rb +0 -4
- data/test/functional/base_controller_test.rb +0 -5
- data/test/functional/feed_controller_test.rb +0 -45
- data/test/functional/main_controller_authorization_test.rb +0 -91
- data/test/functional/main_controller_test.rb +0 -418
- data/test/functional/migration_controller_test.rb +0 -39
- data/test/functional/routes_test.rb +0 -59
- data/test/functional/search_controller_authorization_test.rb +0 -77
- data/test/functional/search_controller_test.rb +0 -811
- data/test/helper/view_helper_test.rb +0 -177
- data/test/misc_tests/date_validation_test.rb +0 -32
- data/test/misc_tests/settings_test.rb +0 -29
- data/test/misc_tests/util_test.rb +0 -83
- data/test/rails_root/Gemfile +0 -22
- data/test/rails_root/Gemfile.lock +0 -101
- data/test/rails_root/Rakefile +0 -7
- data/test/rails_root/app/controllers/application_controller.rb +0 -3
- data/test/rails_root/app/helpers/application_helper.rb +0 -2
- data/test/rails_root/app/models/article.rb +0 -25
- data/test/rails_root/app/models/city.rb +0 -15
- data/test/rails_root/app/models/comment.rb +0 -13
- data/test/rails_root/app/models/tech_magazine.rb +0 -2
- data/test/rails_root/app/models/vehicle/car.rb +0 -4
- data/test/rails_root/app/models/vehicle/door.rb +0 -3
- data/test/rails_root/app/models/vehicle/engine.rb +0 -3
- data/test/rails_root/app/views/layouts/application.html.erb +0 -14
- data/test/rails_root/config/application.rb +0 -42
- data/test/rails_root/config/boot.rb +0 -13
- data/test/rails_root/config/database.yml +0 -22
- data/test/rails_root/config/environment.rb +0 -5
- data/test/rails_root/config/environments/development.rb +0 -22
- data/test/rails_root/config/environments/production.rb +0 -49
- data/test/rails_root/config/environments/test.rb +0 -35
- data/test/rails_root/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails_root/config/initializers/inflections.rb +0 -10
- data/test/rails_root/config/initializers/mime_types.rb +0 -5
- data/test/rails_root/config/initializers/secret_token.rb +0 -7
- data/test/rails_root/config/initializers/session_store.rb +0 -8
- data/test/rails_root/config/locales/en.yml +0 -5
- data/test/rails_root/config/routes.rb +0 -58
- data/test/rails_root/config.ru +0 -4
- data/test/rails_root/db/migrate/20090809061114_create_tables.rb +0 -70
- data/test/rails_root/db/schema.rb +0 -74
- data/test/rails_root/db/seeds.rb +0 -7
- data/test/rails_root/db/test.sqlite3 +0 -0
- data/test/rails_root/script/rails +0 -6
- data/test/rails_root/test/performance/browsing_test.rb +0 -0
- data/test/rails_root/test/test_helper.rb +0 -13
- data/test/support/assertions.rb +0 -20
- data/test/test_helper.rb +0 -76
@@ -1,177 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class ViewHelperTest < ActionView::TestCase
|
4
|
-
|
5
|
-
include FlexMock::TestCase
|
6
|
-
|
7
|
-
self.helper_class = AdminData::Helpers
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@f = flexmock
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'admin_data_form_field_id' do
|
14
|
-
context 'for primary key article_id' do
|
15
|
-
setup do
|
16
|
-
article = Factory(:article)
|
17
|
-
col = Article.columns.detect {|col| col.name == 'article_id'}
|
18
|
-
@output = admin_data_form_field(Article, article, col, @f)
|
19
|
-
end
|
20
|
-
should 'have value auto for id' do
|
21
|
-
assert_equal "(auto)", @output
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'for primary key id' do
|
26
|
-
setup do
|
27
|
-
comment = Factory(:comment)
|
28
|
-
col = Comment.columns.detect {|col| col.name == 'id'}
|
29
|
-
@output = admin_data_form_field(Comment, comment, col, @f)
|
30
|
-
end
|
31
|
-
should 'have value auto for id' do
|
32
|
-
assert_equal "(auto)", @output
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'for text_field' do
|
37
|
-
setup do
|
38
|
-
article = Factory(:article)
|
39
|
-
col = Article.columns.detect {|col| col.name == 'hits_count'}
|
40
|
-
@expected = '<input> for hits_count'
|
41
|
-
@f.should_receive(:text_field).with('hits_count', {:class => "nice-field", :size => 60}).and_return(@expected)
|
42
|
-
@output = admin_data_form_field(Article, article, col, @f)
|
43
|
-
end
|
44
|
-
should 'have input text' do
|
45
|
-
assert_equal @expected, @output
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'for datetime_select' do
|
51
|
-
setup do
|
52
|
-
col = Article.columns_hash['published_at']
|
53
|
-
@article = Factory(:article, :published_at => Time.parse('Aug 31, 1999 1:23:45'))
|
54
|
-
initial_dropdowns = '<input type="hidden">for year and <select>s for month and day and <select>s for time'
|
55
|
-
@expected_html = '<input type="text" size="4" class="nice-field">for year and <select>s for month and day and <select>s for time'
|
56
|
-
flexmock(self).should_receive(:params).and_return({:action => 'edit'})
|
57
|
-
@f.should_receive(:datetime_select).with('published_at', {:include_blank => true}).and_return(initial_dropdowns)
|
58
|
-
@output = admin_data_form_field(Article, @article, col, @f)
|
59
|
-
end
|
60
|
-
should 'have expected output' do
|
61
|
-
assert_equal @expected_html, @output
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'for date_select' do
|
66
|
-
setup do
|
67
|
-
col = Article.columns_hash['published_at']
|
68
|
-
flexmock(col).should_receive(:type).and_return(:date)
|
69
|
-
@article = Factory(:article, :published_at => Date.parse('Aug 31, 1999'))
|
70
|
-
initial_dropdowns = '<input type="hidden">for year and <select>s for month and day'
|
71
|
-
@expected_html = '<input type="text" size="4" class="nice-field">for year and <select>s for month and day'
|
72
|
-
flexmock(self).should_receive(:params).and_return({:action => 'edit'})
|
73
|
-
@f.should_receive(:date_select).with('published_at', {:discard_year => true, :include_blank => true}).and_return(initial_dropdowns)
|
74
|
-
@output = admin_data_form_field(Article, @article, col, @f)
|
75
|
-
end
|
76
|
-
should 'have expected value' do
|
77
|
-
assert_equal @expected_html, @output
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
context 'for collection_select' do
|
82
|
-
setup do
|
83
|
-
@article = Factory(:article)
|
84
|
-
@comment = Factory(:comment, :article => @article)
|
85
|
-
col = Comment.columns.detect {|col| col.name == 'article_id'}
|
86
|
-
@expected = '<select> for articles'
|
87
|
-
all_articles = flexmock
|
88
|
-
flexmock(Article).should_receive(:all).with(:order => "article_id asc").and_return(all_articles)
|
89
|
-
@f.should_receive(:collection_select).with('article_id', all_articles, :id, 'article_id', {:include_blank => true} ).and_return(@expected)
|
90
|
-
@output = admin_data_form_field(Comment, @comment, col, @f)
|
91
|
-
end
|
92
|
-
should 'have expected value' do
|
93
|
-
assert_equal @expected, @output
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'invoke admin_data_get_value_for_column' do
|
98
|
-
context 'for text column' do
|
99
|
-
context 'untrucated case' do
|
100
|
-
setup do
|
101
|
-
column = Article.columns.select {|column| column.name.to_s == 'title'}.first
|
102
|
-
@article = Factory(:article)
|
103
|
-
@output = admin_data_get_value_for_column(column, @article, {})
|
104
|
-
end
|
105
|
-
should 'have untruncated title' do
|
106
|
-
assert_equal 'this is a dummy title', @output
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'truncated case' do
|
111
|
-
setup do
|
112
|
-
column = Article.columns.select {|column| column.name.to_s == 'title'}.first
|
113
|
-
@article = Factory(:article, :title => 'this is a very very very long long long title')
|
114
|
-
options = {}
|
115
|
-
|
116
|
-
@output = admin_data_get_value_for_column(column,@article,{:limit => 15})
|
117
|
-
end
|
118
|
-
should 'should have truncated title' do
|
119
|
-
assert_equal 'this is a ve...', @output
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
context 'for integer column' do
|
125
|
-
setup do
|
126
|
-
@article = Factory(:article, :hits_count => 100)
|
127
|
-
column = Article.columns.select {|column| column.name.to_s == 'hits_count'}.first
|
128
|
-
@output = admin_data_get_value_for_column(column, @article)
|
129
|
-
end
|
130
|
-
should 'have right value' do
|
131
|
-
assert_equal 100, @output
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
context 'for integer column with truncate option should not cause any problem' do
|
136
|
-
setup do
|
137
|
-
@article = Factory(:article, :hits_count => 100)
|
138
|
-
column = Article.columns.select {|column| column.name.to_s == 'hits_count'}.first
|
139
|
-
@output = admin_data_get_value_for_column(column, @article, {:limit => 10})
|
140
|
-
end
|
141
|
-
should 'have right value' do
|
142
|
-
assert_equal 100, @output
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
context 'for text column which should raise exception' do
|
147
|
-
setup do
|
148
|
-
column = Article.columns.select {|column| column.name.to_s == 'title'}.first
|
149
|
-
@article = Factory(:article, :title => 'this is a very very very long long long title')
|
150
|
-
options = {}
|
151
|
-
|
152
|
-
#truncate method should raise exception
|
153
|
-
flexmock(self).should_receive('truncate').with('any_args').and_raise(Exception)
|
154
|
-
|
155
|
-
@output = admin_data_get_value_for_column(column,@article,{:limit => 15})
|
156
|
-
end
|
157
|
-
should 'have rescued message' do
|
158
|
-
assert_equal '<actual data is not being shown because truncate method failed.>', @output
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
context 'for text column which is serialized' do
|
163
|
-
setup do
|
164
|
-
column = Article.columns.select {|column| column.name.to_s == 'data'}.first
|
165
|
-
@article = Factory(:article, :data => { :key => 123456789 }.to_yaml)
|
166
|
-
options = {}
|
167
|
-
|
168
|
-
@output = admin_data_get_value_for_column(column,@article,{:limit => 15})
|
169
|
-
end
|
170
|
-
should 'show inspected value' do
|
171
|
-
assert_equal "{:key=>12345...", @output
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'admin_data_date_validation'
|
3
|
-
|
4
|
-
class AdminDataTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def test_date_validation
|
7
|
-
|
8
|
-
assert ::AdminDataDateValidation.validate('13-feb-2009')
|
9
|
-
assert ::AdminDataDateValidation.validate('13-FEB-2009')
|
10
|
-
assert ::AdminDataDateValidation.validate('13-feb -2009') # extra white space should not hurt
|
11
|
-
|
12
|
-
# only the first three characters of the month should be checked
|
13
|
-
assert ::AdminDataDateValidation.validate('13-FEBfoo-2009')
|
14
|
-
|
15
|
-
assert !::AdminDataDateValidation.validate('13-foo-2009') # month name is wrong
|
16
|
-
assert !::AdminDataDateValidation.validate('13 foo 2009') # there must be two occurences of -
|
17
|
-
assert !::AdminDataDateValidation.validate('32-jan-2009') # day is wrong
|
18
|
-
assert !::AdminDataDateValidation.validate('32-jan- -2009') # there should be only two occurences of -
|
19
|
-
assert !::AdminDataDateValidation.validate('32-jan-09') # year must be greater than 1900
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_date_validation_with_operator
|
23
|
-
assert ::AdminDataDateValidation.validate_with_operator('> 13-feb-2009')
|
24
|
-
assert ::AdminDataDateValidation.validate_with_operator('>= 13-feb-2009')
|
25
|
-
assert ::AdminDataDateValidation.validate_with_operator('< 13-feb-2009')
|
26
|
-
assert ::AdminDataDateValidation.validate_with_operator('<= 13-feb-2009')
|
27
|
-
|
28
|
-
assert !::AdminDataDateValidation.validate_with_operator('<=13-feb-2009') # no white space
|
29
|
-
assert !::AdminDataDateValidation.validate_with_operator('| 13-feb-2009') # invalid operator
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class AdminData::AdminDataConfigTest < ActionController::TestCase
|
4
|
-
context 'setting configuration parameters' do
|
5
|
-
teardown do
|
6
|
-
AdminData::Config.initialize_defaults
|
7
|
-
end
|
8
|
-
|
9
|
-
%w(
|
10
|
-
find_conditions
|
11
|
-
plugin_dir
|
12
|
-
will_paginate_per_page
|
13
|
-
is_allowed_to_view
|
14
|
-
is_allowed_to_update
|
15
|
-
).each do |valid_key|
|
16
|
-
should "store #{valid_key} setting" do
|
17
|
-
AdminData::Config.set = { valid_key.to_sym => "some value for #{valid_key}" }
|
18
|
-
assert_equal "some value for #{valid_key}", AdminData::Config.setting[valid_key.to_sym]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "get an error with a bad key" do
|
23
|
-
should "raise error when attempting to set bad key" do
|
24
|
-
assert_raises(RuntimeError) { AdminData::Config.set = { :a_bad_key => "some value" }}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'admin_data/util'
|
3
|
-
|
4
|
-
class AdminDataUtilTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
context 'has_one' do
|
7
|
-
subject { AdminData::Util.has_one_what(Vehicle::Car) }
|
8
|
-
setup { @instance = Vehicle::Car.create(:year => 2000, :brand => 'bmw') }
|
9
|
-
should 'be engine' do
|
10
|
-
assert subject
|
11
|
-
assert_equal 1, subject.size
|
12
|
-
assert_equal 'engine', subject[0]
|
13
|
-
end
|
14
|
-
should 'respond_to? has_one' do
|
15
|
-
assert @instance.respond_to?(subject[0])
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'columns_order default order' do
|
20
|
-
setup do
|
21
|
-
AdminData::Config.set = {:columns_order => nil }
|
22
|
-
@output = AdminData::Util.columns_order('Article')
|
23
|
-
end
|
24
|
-
should 'have created_at and updated_at at the very end' do
|
25
|
-
assert_equal %w(article_id title body body_html short_desc status published_at approved hits_count
|
26
|
-
magazine_type magazine_id data created_at updated_at
|
27
|
-
), @output
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'columns_order custom order' do
|
32
|
-
setup do
|
33
|
-
AdminData::Config.set = {:columns_order => {'Article' => [:article_id, :body, :published_at] }}
|
34
|
-
@output = AdminData::Util.columns_order('Article')
|
35
|
-
end
|
36
|
-
should 'have right order' do
|
37
|
-
assert_equal %w(article_id body published_at title body_html short_desc status approved hits_count
|
38
|
-
magazine_type created_at updated_at magazine_id data
|
39
|
-
),
|
40
|
-
@output
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'oracle test' do
|
45
|
-
setup do
|
46
|
-
AdminData::Config.setting.merge!(:adapter_name => 'Oracle')
|
47
|
-
@term = Search::Term.new(Article,{:col1 => 'body_html', :col2 => 'contains', :col3 => 'foo'}, 'quick_search')
|
48
|
-
end
|
49
|
-
teardown do
|
50
|
-
AdminData::Config.setting.merge!(:adapter => 'MySQL')
|
51
|
-
end
|
52
|
-
should 'have proper sql' do
|
53
|
-
assert_equal ["upper(articles.body_html) LIKE ?", "%FOO%"], @term.attribute_condition
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'postgresql test' do
|
58
|
-
setup do
|
59
|
-
AdminData::Config.setting.merge!(:adapter_name => 'PostgreSql')
|
60
|
-
@term = Search::Term.new(Article,{:col1 => 'body_html', :col2 => 'contains', :col3 => 'foo'}, 'quick_search')
|
61
|
-
end
|
62
|
-
teardown do
|
63
|
-
AdminData::Config.setting.merge!(:adapter => 'MySQL')
|
64
|
-
end
|
65
|
-
should 'have proper sql' do
|
66
|
-
assert_equal ["articles.body_html ILIKE ?", "%foo%"], @term.attribute_condition
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'mysql test' do
|
71
|
-
setup do
|
72
|
-
AdminData::Config.setting.merge!(:adapter_name => 'MySQL')
|
73
|
-
@term = Search::Term.new(Article,{:col1 => 'body_html', :col2 => 'contains', :col3 => 'foo'}, 'quick_search')
|
74
|
-
end
|
75
|
-
teardown do
|
76
|
-
AdminData::Config.setting.merge!(:adapter => 'MySQL')
|
77
|
-
end
|
78
|
-
should 'have proper sql' do
|
79
|
-
assert_equal ["articles.body_html LIKE ?", "%foo%"], @term.attribute_condition
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
data/test/rails_root/Gemfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rails', '3.0.0.rc'
|
4
|
-
|
5
|
-
# Bundle edge Rails instead:
|
6
|
-
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
7
|
-
|
8
|
-
gem 'sqlite3-ruby', :require => 'sqlite3'
|
9
|
-
|
10
|
-
gem 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :branch => 'rails3'
|
11
|
-
|
12
|
-
# Bundle gems for the local environment. Make sure to
|
13
|
-
# put test-only gems in this group so their generators
|
14
|
-
# and rake tasks are available in development mode:
|
15
|
-
group :development, :test do
|
16
|
-
gem 'shoulda'
|
17
|
-
gem 'factory_girl_rails', :git => 'git://github.com/thoughtbot/factory_girl_rails'
|
18
|
-
gem 'flexmock'
|
19
|
-
gem 'redgreen'
|
20
|
-
gem 'nokogiri'
|
21
|
-
gem 'json'
|
22
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/mislav/will_paginate.git
|
3
|
-
revision: 3615938
|
4
|
-
branch: rails3
|
5
|
-
specs:
|
6
|
-
will_paginate (3.0.pre2)
|
7
|
-
|
8
|
-
GIT
|
9
|
-
remote: git://github.com/thoughtbot/factory_girl_rails
|
10
|
-
revision: 338105c
|
11
|
-
specs:
|
12
|
-
factory_girl_rails (1.0)
|
13
|
-
factory_girl (~> 1.3)
|
14
|
-
rails (>= 3.0.0.beta4)
|
15
|
-
|
16
|
-
GEM
|
17
|
-
remote: http://rubygems.org/
|
18
|
-
specs:
|
19
|
-
abstract (1.0.0)
|
20
|
-
actionmailer (3.0.0.rc)
|
21
|
-
actionpack (= 3.0.0.rc)
|
22
|
-
mail (~> 2.2.5)
|
23
|
-
actionpack (3.0.0.rc)
|
24
|
-
activemodel (= 3.0.0.rc)
|
25
|
-
activesupport (= 3.0.0.rc)
|
26
|
-
builder (~> 2.1.2)
|
27
|
-
erubis (~> 2.6.6)
|
28
|
-
i18n (~> 0.4.1)
|
29
|
-
rack (~> 1.2.1)
|
30
|
-
rack-mount (~> 0.6.9)
|
31
|
-
rack-test (~> 0.5.4)
|
32
|
-
tzinfo (~> 0.3.22)
|
33
|
-
activemodel (3.0.0.rc)
|
34
|
-
activesupport (= 3.0.0.rc)
|
35
|
-
builder (~> 2.1.2)
|
36
|
-
i18n (~> 0.4.1)
|
37
|
-
activerecord (3.0.0.rc)
|
38
|
-
activemodel (= 3.0.0.rc)
|
39
|
-
activesupport (= 3.0.0.rc)
|
40
|
-
arel (~> 0.4.0)
|
41
|
-
tzinfo (~> 0.3.22)
|
42
|
-
activeresource (3.0.0.rc)
|
43
|
-
activemodel (= 3.0.0.rc)
|
44
|
-
activesupport (= 3.0.0.rc)
|
45
|
-
activesupport (3.0.0.rc)
|
46
|
-
arel (0.4.0)
|
47
|
-
activesupport (>= 3.0.0.beta)
|
48
|
-
builder (2.1.2)
|
49
|
-
erubis (2.6.6)
|
50
|
-
abstract (>= 1.0.0)
|
51
|
-
factory_girl (1.3.2)
|
52
|
-
flexmock (0.8.7)
|
53
|
-
i18n (0.4.1)
|
54
|
-
json (1.4.6)
|
55
|
-
mail (2.2.5)
|
56
|
-
activesupport (>= 2.3.6)
|
57
|
-
mime-types
|
58
|
-
treetop (>= 1.4.5)
|
59
|
-
mime-types (1.16)
|
60
|
-
nokogiri (1.4.3.1)
|
61
|
-
polyglot (0.3.1)
|
62
|
-
rack (1.2.1)
|
63
|
-
rack-mount (0.6.9)
|
64
|
-
rack (>= 1.0.0)
|
65
|
-
rack-test (0.5.4)
|
66
|
-
rack (>= 1.0)
|
67
|
-
rails (3.0.0.rc)
|
68
|
-
actionmailer (= 3.0.0.rc)
|
69
|
-
actionpack (= 3.0.0.rc)
|
70
|
-
activerecord (= 3.0.0.rc)
|
71
|
-
activeresource (= 3.0.0.rc)
|
72
|
-
activesupport (= 3.0.0.rc)
|
73
|
-
bundler (>= 1.0.0.rc.1)
|
74
|
-
railties (= 3.0.0.rc)
|
75
|
-
railties (3.0.0.rc)
|
76
|
-
actionpack (= 3.0.0.rc)
|
77
|
-
activesupport (= 3.0.0.rc)
|
78
|
-
rake (>= 0.8.3)
|
79
|
-
thor (~> 0.14.0)
|
80
|
-
rake (0.8.7)
|
81
|
-
redgreen (1.2.2)
|
82
|
-
shoulda (2.11.3)
|
83
|
-
sqlite3-ruby (1.3.1)
|
84
|
-
thor (0.14.0)
|
85
|
-
treetop (1.4.8)
|
86
|
-
polyglot (>= 0.3.1)
|
87
|
-
tzinfo (0.3.22)
|
88
|
-
|
89
|
-
PLATFORMS
|
90
|
-
ruby
|
91
|
-
|
92
|
-
DEPENDENCIES
|
93
|
-
factory_girl_rails!
|
94
|
-
flexmock
|
95
|
-
json
|
96
|
-
nokogiri
|
97
|
-
rails (= 3.0.0.rc)
|
98
|
-
redgreen
|
99
|
-
shoulda
|
100
|
-
sqlite3-ruby
|
101
|
-
will_paginate!
|
data/test/rails_root/Rakefile
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
-
|
4
|
-
require File.expand_path('../config/application', __FILE__)
|
5
|
-
require 'rake'
|
6
|
-
|
7
|
-
RailsRoot::Application.load_tasks
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class Article < ActiveRecord::Base
|
2
|
-
|
3
|
-
set_primary_key 'article_id'
|
4
|
-
|
5
|
-
has_many :comments, :dependent => :destroy
|
6
|
-
|
7
|
-
belongs_to :magazine, :polymorphic => true
|
8
|
-
|
9
|
-
before_save :set_body_html
|
10
|
-
|
11
|
-
validates_presence_of :title,:body
|
12
|
-
|
13
|
-
serialize :data
|
14
|
-
|
15
|
-
def to_param
|
16
|
-
"#{id}-#{title.gsub(' ', '_').camelize}"
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def set_body_html
|
22
|
-
self.body_html = self.body
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
-
# you've limited to :test, :development, or :production.
|
7
|
-
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
-
|
9
|
-
module RailsRoot
|
10
|
-
class Application < Rails::Application
|
11
|
-
# Settings in config/environments/* take precedence over those specified here.
|
12
|
-
# Application configuration should go into files in config/initializers
|
13
|
-
# -- all .rb files in that directory are automatically loaded.
|
14
|
-
|
15
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
16
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
17
|
-
|
18
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
19
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
20
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
21
|
-
|
22
|
-
# Activate observers that should always be running.
|
23
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
24
|
-
|
25
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
-
|
29
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
-
# config.i18n.default_locale = :de
|
32
|
-
|
33
|
-
# JavaScript files you want as :defaults (application.js is always included).
|
34
|
-
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
35
|
-
|
36
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
-
config.encoding = "utf-8"
|
38
|
-
|
39
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
-
config.filter_parameters += [:password]
|
41
|
-
end
|
42
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
# Set up gems listed in the Gemfile.
|
4
|
-
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
-
begin
|
6
|
-
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
-
require 'bundler'
|
8
|
-
Bundler.setup
|
9
|
-
rescue Bundler::GemNotFound => e
|
10
|
-
STDERR.puts e.message
|
11
|
-
STDERR.puts "Try running `bundle install`."
|
12
|
-
exit!
|
13
|
-
end if File.exist?(gemfile)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
-
development:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: db/development.sqlite3
|
6
|
-
pool: 5
|
7
|
-
timeout: 5000
|
8
|
-
|
9
|
-
# Warning: The database defined as "test" will be erased and
|
10
|
-
# re-generated from your development database when you run "rake".
|
11
|
-
# Do not set this db to the same as development or production.
|
12
|
-
test:
|
13
|
-
adapter: sqlite3
|
14
|
-
database: db/test.sqlite3
|
15
|
-
pool: 5
|
16
|
-
timeout: 5000
|
17
|
-
|
18
|
-
production:
|
19
|
-
adapter: sqlite3
|
20
|
-
database: db/production.sqlite3
|
21
|
-
pool: 5
|
22
|
-
timeout: 5000
|
@@ -1,22 +0,0 @@
|
|
1
|
-
RailsRoot::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the webserver when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_view.debug_rjs = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Don't care if the mailer can't send
|
18
|
-
config.action_mailer.raise_delivery_errors = false
|
19
|
-
|
20
|
-
# Print deprecation notices to the Rails logger
|
21
|
-
config.active_support.deprecation = :log
|
22
|
-
end
|