kuhsaft 0.1.1 → 0.2.legacy

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/.rspec +1 -2
  2. data/LICENSE +7 -0
  3. data/README.md +70 -0
  4. data/Rakefile +1 -1
  5. data/app/controllers/kuhsaft/{admin → cms}/admin_controller.rb +2 -2
  6. data/app/controllers/kuhsaft/{admin → cms}/assets_controller.rb +5 -5
  7. data/app/controllers/kuhsaft/cms/page_parts_controller.rb +34 -0
  8. data/app/controllers/kuhsaft/{admin → cms}/pages_controller.rb +12 -11
  9. data/app/helpers/cms_helper.rb +5 -0
  10. data/app/helpers/pages_helper.rb +31 -12
  11. data/app/models/kuhsaft/asset.rb +18 -0
  12. data/app/models/kuhsaft/localized_page.rb +42 -16
  13. data/app/models/kuhsaft/page.rb +66 -66
  14. data/app/models/kuhsaft/page_part/content.rb +23 -2
  15. data/app/models/kuhsaft/publish_state.rb +2 -6
  16. data/app/stylesheets/kuhsaft/{admin → cms}/partials/_assets.sass +0 -0
  17. data/app/stylesheets/kuhsaft/cms/partials/_buttons.sass +13 -0
  18. data/app/stylesheets/kuhsaft/{admin/ie.sass → cms/partials/_forms.sass} +0 -0
  19. data/app/stylesheets/kuhsaft/cms/partials/_generic.sass +315 -0
  20. data/app/stylesheets/kuhsaft/cms/partials/_simple_form.sass +75 -0
  21. data/app/stylesheets/kuhsaft/{admin → cms}/screen.sass +2 -1
  22. data/app/uploaders/kuhsaft/asset_uploader.rb +1 -1
  23. data/app/views/kuhsaft/cms/assets/_form.html.haml +15 -0
  24. data/app/views/kuhsaft/cms/assets/_list.html.haml +11 -0
  25. data/app/views/kuhsaft/cms/assets/edit.html.haml +2 -0
  26. data/app/views/kuhsaft/cms/assets/index.html.haml +3 -0
  27. data/app/views/kuhsaft/cms/assets/new.html.haml +2 -0
  28. data/app/views/kuhsaft/cms/page_parts/destroy.js.haml +1 -0
  29. data/app/{stylesheets/kuhsaft/admin/print.sass → views/kuhsaft/cms/page_parts/edit.html.haml} +0 -0
  30. data/app/views/kuhsaft/{admin/pages/show.html.haml → cms/page_parts/index.html.haml} +0 -0
  31. data/app/views/kuhsaft/cms/page_parts/new.html.haml +0 -0
  32. data/app/views/kuhsaft/cms/page_parts/show.html.haml +0 -0
  33. data/app/views/kuhsaft/cms/page_parts/update.js.haml +0 -0
  34. data/app/views/kuhsaft/cms/pages/_branch.html.haml +11 -0
  35. data/app/views/kuhsaft/cms/pages/_form.html.haml +59 -0
  36. data/app/views/kuhsaft/cms/pages/edit.html.haml +11 -0
  37. data/app/views/kuhsaft/cms/pages/index.html.haml +8 -0
  38. data/app/views/kuhsaft/cms/pages/new.html.haml +6 -0
  39. data/app/views/kuhsaft/cms/pages/show.html.haml +0 -0
  40. data/app/views/kuhsaft/page_part/markdowns/_edit_markdown.html.haml +1 -0
  41. data/app/views/kuhsaft/page_part/markdowns/_show_markdown.html.haml +1 -0
  42. data/app/views/kuhsaft/pages/show.html.haml +3 -1
  43. data/app/views/layouts/kuhsaft/admin.html.haml +24 -14
  44. data/config/locales/kuhsaft.en.yml +28 -6
  45. data/config/routes.rb +7 -8
  46. data/kuhsaft.gemspec +3 -2
  47. data/lib/generators/kuhsaft/install/migrations_generator.rb +2 -0
  48. data/lib/kuhsaft.rb +3 -0
  49. data/lib/kuhsaft/engine.rb +1 -0
  50. data/lib/kuhsaft/orderable.rb +68 -0
  51. data/lib/kuhsaft/version.rb +1 -1
  52. data/lib/templates/kuhsaft/install/acts_as_taggable_on_migration.rb +37 -0
  53. data/lib/templates/kuhsaft/install/add_tags_to_page_part_contents.rb +9 -0
  54. data/public/images/kuhsaft/add-child-page.png +0 -0
  55. data/public/images/kuhsaft/delete.png +0 -0
  56. data/public/images/kuhsaft/header-bg.jpg +0 -0
  57. data/public/images/kuhsaft/module-nav-tab-bg.png +0 -0
  58. data/public/images/kuhsaft/page-edit-icon.png +0 -0
  59. data/public/images/kuhsaft/page-new-icon.png +0 -0
  60. data/public/images/kuhsaft/page-part-draggable-area.png +0 -0
  61. data/public/images/kuhsaft/page-tree-breadcrumb-arrow.png +0 -0
  62. data/public/images/kuhsaft/pages-breadcrumb-icon.png +0 -0
  63. data/public/images/kuhsaft/tab-bg.png +0 -0
  64. data/public/images/kuhsaft/toggle-arrow-closed.png +0 -0
  65. data/public/images/kuhsaft/toggle-arrow-open.png +0 -0
  66. data/public/images/kuhsaft/wrapper-bg.png +0 -0
  67. data/public/javascripts/kuhsaft/cms/application.js +31 -0
  68. data/public/javascripts/kuhsaft/{admin → cms}/jquery-1.4.4.js +0 -0
  69. data/public/javascripts/kuhsaft/{admin → cms}/jquery-ui-1.8.12.custom.min.js +0 -0
  70. data/public/javascripts/kuhsaft/{admin → cms}/rails.js +0 -0
  71. data/spec/controllers/{admin_assets_controller_spec.rb → cms_assets_controller_spec.rb} +5 -5
  72. data/spec/controllers/{admin_pages_controller_spec.rb → cms_pages_controller_spec.rb} +2 -2
  73. data/spec/controllers/page_parts_controller_spec.rb +60 -0
  74. data/spec/dummy/app/controllers/application_controller.rb +1 -0
  75. data/spec/dummy/config/locales/en.yml +1 -3
  76. data/spec/dummy/public/javascripts/kuhsaft/cms/application.js +31 -0
  77. data/spec/dummy/public/javascripts/kuhsaft/cms/jquery-1.4.4.js +7179 -0
  78. data/spec/dummy/public/javascripts/kuhsaft/cms/jquery-ui-1.8.12.custom.min.js +192 -0
  79. data/spec/dummy/public/javascripts/kuhsaft/cms/rails.js +157 -0
  80. data/spec/factories.rb +4 -2
  81. data/spec/helpers/pages_helper_spec.rb +93 -33
  82. data/spec/models/asset_spec.rb +18 -2
  83. data/spec/models/localized_page_spec.rb +225 -124
  84. data/spec/models/page_part_content_spec.rb +35 -4
  85. data/spec/models/page_spec.rb +292 -143
  86. data/spec/models/publish_state_spec.rb +0 -12
  87. data/spec/requests/cms_pages_spec.rb +27 -0
  88. data/spec/routing/assets_routing_spec.rb +37 -30
  89. data/spec/routing/page_part_routing_spec.rb +70 -0
  90. data/spec/routing/pages_routing_spec.rb +23 -23
  91. data/spec/support/kuhsaft_spec_helper.rb +3 -0
  92. metadata +107 -63
  93. data/README +0 -67
  94. data/app/stylesheets/kuhsaft/admin/partials/_buttons.sass +0 -216
  95. data/app/stylesheets/kuhsaft/admin/partials/_generic.sass +0 -48
  96. data/app/stylesheets/kuhsaft/admin/partials/_pages.sass +0 -46
  97. data/app/views/kuhsaft/admin/assets/_form.html.haml +0 -3
  98. data/app/views/kuhsaft/admin/assets/_list.html.haml +0 -11
  99. data/app/views/kuhsaft/admin/assets/edit.html.haml +0 -1
  100. data/app/views/kuhsaft/admin/assets/index.html.haml +0 -3
  101. data/app/views/kuhsaft/admin/assets/new.html.haml +0 -1
  102. data/app/views/kuhsaft/admin/kuhsaft/page_part/markdowns/_markdown.html.haml +0 -1
  103. data/app/views/kuhsaft/admin/pages/_branch.html.haml +0 -10
  104. data/app/views/kuhsaft/admin/pages/_form.html.haml +0 -22
  105. data/app/views/kuhsaft/admin/pages/edit.html.haml +0 -7
  106. data/app/views/kuhsaft/admin/pages/index.html.haml +0 -4
  107. data/app/views/kuhsaft/admin/pages/new.html.haml +0 -3
  108. data/config/initializers/compass.rb +0 -3
  109. data/public/images/css3buttons_backgrounds.png +0 -0
  110. data/public/images/css3buttons_icons.png +0 -0
  111. data/public/images/drag-handle.png +0 -0
  112. data/public/javascripts/kuhsaft/admin/application.js +0 -17
  113. data/spec/dummy/public/images/css3buttons_backgrounds.png +0 -0
  114. data/spec/dummy/public/images/css3buttons_icons.png +0 -0
  115. data/spec/dummy/public/images/drag-handle.png +0 -0
@@ -12,12 +12,28 @@ describe Kuhsaft::Asset do
12
12
  Kuhsaft::AssetUploader.enable_processing = false
13
13
  end
14
14
 
15
- it 'should scale down to fit into a 50x50 thumb' do
16
- @uploader.thumb.should have_dimensions(50, 50)
15
+ it 'should scale down to fit into a 100x100 thumb' do
16
+ @uploader.thumb.should have_dimensions(100, 100)
17
17
  end
18
18
 
19
19
  it "should make the image readable only to the owner and not executable" do
20
20
  pending 'how and where do we ensure permissions?'
21
21
  @uploader.should have_permissions(0600)
22
22
  end
23
+
24
+ describe '#file_type' do
25
+ it 'should have a file_type' do
26
+ @asset.should respond_to(:file_type)
27
+ end
28
+
29
+ it 'should be symbolized' do
30
+ @asset.file_type.should be_a(Symbol)
31
+ end
32
+ end
33
+
34
+ describe '#name' do
35
+ it 'should have a name' do
36
+ @asset.should respond_to(:name)
37
+ end
38
+ end
23
39
  end
@@ -2,81 +2,219 @@ require 'spec_helper'
2
2
 
3
3
  describe Kuhsaft::LocalizedPage do
4
4
  before :each do
5
- @localized_page = Factory.create(:localized_page)
5
+ @page = Factory::create :page
6
+ @localized_page = @page.translation
6
7
  end
7
8
 
8
- it 'should have a symbolized locale' do
9
- @localized_page.locale.should be(:en)
10
- end
11
-
12
- it 'should be published' do
13
- @localized_page.published?.should be_true
14
- end
15
-
16
- it 'should have a fulltext field' do
17
- @localized_page.should respond_to(:fulltext)
18
- end
19
-
20
- it 'should not be published when set to false' do
21
- @localized_page.update_attribute :published, false
22
- @localized_page.published?.should be_false
23
- end
24
-
25
- it 'should not be published when set to 0' do
26
- @localized_page.update_attribute :published, 0
27
- @localized_page.published?.should be_false
28
- end
29
-
30
- it 'should belong to a page' do
31
- @localized_page.page.should be_a(Kuhsaft::Page)
32
- end
33
-
34
- it 'should create a slug when the slug is empty' do
35
- @localized_page.should_receive(:create_slug)
36
- @localized_page.save
37
- end
38
-
39
- it 'should generate the slug from the title' do
40
- @localized_page.slug.should eq(@localized_page.title.parameterize)
41
- end
42
-
43
- it 'should have page_parts' do
44
- @localized_page.should respond_to(:page_parts)
45
- end
46
-
47
- it 'should not generate the slug if the user has set it' do
48
- Factory.create(:localized_page, :slug => 'my-slug').slug.should == 'my-slug'
9
+ describe 'associations' do
10
+ describe '#page_parts' do
11
+ it 'should have many page parts' do
12
+ @localized_page.should respond_to(:page_parts)
13
+ end
14
+ end
15
+
16
+ describe '#page' do
17
+ it 'should belongs to a page' do
18
+ @localized_page.should respond_to(:page)
19
+ end
20
+ end
49
21
  end
50
22
 
51
- after :each do
52
- @localized_page.destroy
53
- end
23
+ describe 'instance methods' do
24
+ describe '#locale' do
25
+ it 'should have a locale' do
26
+ @localized_page.should respond_to(:locale)
27
+ end
28
+
29
+ it 'should be a Symbol' do
30
+ @localized_page.locale.should be_an_instance_of(Symbol)
31
+ end
32
+ end
54
33
 
55
- describe 'page_type' do
56
- it 'should have a page_type' do
57
- @localized_page.should respond_to(:page_type)
34
+ describe '#published?' do
35
+ it 'should know if it\'s published' do
36
+ @localized_page.should respond_to(:published?)
37
+ end
38
+
39
+ context 'when the published state is UNPUBLISHED' do
40
+ it 'should not be published' do
41
+ @localized_page.update_attribute :published, Kuhsaft::PublishState::UNPUBLISHED
42
+ @localized_page.published?.should be_false
43
+ end
44
+
45
+ context 'when a published_at date is set' do
46
+ it 'should not be published' do
47
+ @localized_page.update_attribute :published, Kuhsaft::PublishState::UNPUBLISHED
48
+ @localized_page.update_attribute :published_at, Time.now - 2.days
49
+ @localized_page.published?.should be_false
50
+ end
51
+ end
52
+ end
53
+
54
+ context 'when the published state is PUBLISHED' do
55
+ it 'should be published' do
56
+ @localized_page.update_attribute :published, Kuhsaft::PublishState::PUBLISHED
57
+ @localized_page.published?.should be_true
58
+ end
59
+
60
+ context 'when the published_at date is set' do
61
+ it 'should be published' do
62
+ @localized_page.update_attribute :published, Kuhsaft::PublishState::PUBLISHED
63
+ @localized_page.update_attribute :published_at, Time.now + 2.days
64
+ @localized_page.published?.should be_true
65
+ end
66
+ end
67
+ end
68
+
69
+ context 'when the published state is PUBLISHED_AT' do
70
+ it 'should be published if the date is in the past' do
71
+ @localized_page.update_attribute :published, Kuhsaft::PublishState::PUBLISHED_AT
72
+ @localized_page.update_attribute :published_at, Time.now - 2.days
73
+ @localized_page.published?.should be_true
74
+ end
75
+
76
+ it 'should not be published if the date is in the future' do
77
+ @localized_page.update_attribute :published, Kuhsaft::PublishState::PUBLISHED_AT
78
+ @localized_page.update_attribute :published_at, Time.now + 2.days
79
+ @localized_page.published?.should be_false
80
+ end
81
+ end
58
82
  end
83
+
84
+ describe '#slug' do
85
+ it 'should have a slug' do
86
+ @localized_page.should respond_to(:slug)
87
+ end
88
+
89
+ context 'when it is empty' do
90
+ it 'should be generated' do
91
+ @localized_page.should_receive(:create_slug)
92
+ @localized_page.save
93
+ end
94
+
95
+ it 'should use the title to generate the slug' do
96
+ @localized_page.slug.should eq(@localized_page.title.parameterize)
97
+ end
98
+ end
59
99
 
60
- it 'should just generate the url when the page_type is empty' do
61
- page = Factory.create :page
62
- page.translation.url.should eq('en/english-title')
100
+ context 'when it is not empty' do
101
+ it 'should take the slug provided by the user' do
102
+ Factory.create(:localized_page, :slug => 'my-slug').slug.should == 'my-slug'
103
+ end
104
+ end
63
105
  end
64
106
 
65
- it 'should save the users url with a "REDIRECT" page_type' do
66
- page = Factory.create :page
67
- page.translation.page_type = Kuhsaft::PageType::REDIRECT
68
- page.translation.url = '/en/news'
69
- page.save
70
- page.translation.url.should eq('/en/news')
107
+ describe '#url' do
108
+ it 'should have an url' do
109
+ @localized_page.should respond_to(:url)
110
+ end
111
+
112
+ context 'when saving the localized_page' do
113
+ context 'when it is a normal page' do
114
+ it 'should include the parents slug in its url' do
115
+ page = Kuhsaft::Page.new
116
+ page.localized_pages << Kuhsaft::LocalizedPage.new(:title => 'hi', :slug => 'parent-slug', :page_type => '', :locale => :en )
117
+
118
+ child = Kuhsaft::Page.new
119
+ child.localized_pages << Kuhsaft::LocalizedPage.new(:title => 'hi', :slug => 'child-slug', :page_type => '', :locale => :en)
120
+
121
+ page.childs << child
122
+ page.save
123
+
124
+ child.url.should == 'en/parent-slug/child-slug'
125
+ end
126
+ end
127
+
128
+ context 'when it is a navigation?' do
129
+ it 'the slug should be left out in the url' do
130
+ page = Kuhsaft::Page.new
131
+ page.localized_pages << Kuhsaft::LocalizedPage.new(:title => 'hi', :slug => 'parent-slug', :page_type => Kuhsaft::PageType::NAVIGATION, :locale => :en )
132
+
133
+ child = Kuhsaft::Page.new
134
+ child.localized_pages << Kuhsaft::LocalizedPage.new(:title => 'hi', :slug => 'child-slug', :page_type => '', :locale => :en)
135
+
136
+ page.childs << child
137
+ page.save
138
+
139
+ child.url.should == 'en/child-slug'
140
+ end
141
+ end
142
+
143
+ context 'when it\'s a redirect?' do
144
+ it 'should not touch the url' do
145
+ page = Factory.create :page
146
+ page.translation.page_type = Kuhsaft::PageType::REDIRECT
147
+ page.translation.url = '/en/news'
148
+ page.save
149
+ page.link.should eq('/en/news')
150
+ end
151
+ end
152
+ end
153
+ end
154
+
155
+ describe '#page_type' do
156
+ it 'should have a page_type' do
157
+ @localized_page.should respond_to(:page_type)
158
+ end
159
+ end
160
+
161
+ describe '#navigation?' do
162
+ it 'should be true if the page_type is PageType::NAVIGATION' do
163
+ @page.translation.page_type = Kuhsaft::PageType::NAVIGATION
164
+ @page.navigation?.should be_true
165
+ end
71
166
  end
167
+
168
+ describe '#redirect?' do
169
+ it 'should be true if the page_type is PageType::REDIRECT' do
170
+ @page.translation.page_type = Kuhsaft::PageType::REDIRECT
171
+ @page.redirect?.should be_true
172
+ end
173
+ end
174
+
175
+ describe '#fulltext' do
176
+ before do
177
+ @page = Factory.create :page
178
+ @page.translation.keywords = 'key words'
179
+ @page.translation.description = 'descrip tion'
180
+ @page.translation.title = 'my title'
181
+ @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => 'oh la la1')
182
+ @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => 'oh la la2')
183
+ @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => 'oh la la3')
184
+ @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => nil)
185
+ @page.save
186
+ end
187
+
188
+ it 'should have a fulltext' do
189
+ @localized_page.should respond_to(:fulltext)
190
+ end
191
+
192
+ context 'when saved' do
193
+ it 'should collect and assign the fulltext' do
194
+ @page.translation.should_receive(:collect_fulltext)
195
+ @page.save
196
+ end
197
+
198
+ it 'should contain the title' do
199
+ @page.fulltext.should include('my title')
200
+ end
72
201
 
73
- it 'should not use the slug in the url when the page_type is "NAVIGATION"' do
74
- page = Factory.create :page
75
- child_page = Factory.create :page
76
- page.childs << child_page
77
- page.translation.page_type = Kuhsaft::PageType::NAVIGATION
78
- page.save
79
- child_page.translation.url.should eq('en/english-title')
202
+ it 'should contain the keywords' do
203
+ @page.fulltext.should include('key words')
204
+ end
205
+
206
+ it 'should contain the description' do
207
+ @page.fulltext.should include('descrip tion')
208
+ end
209
+
210
+ it 'should contain the page part content' do
211
+ @page.fulltext.should include('oh la la')
212
+ end
213
+
214
+ it 'should convert all data to strings' do
215
+ expect { @page.translation.collect_fulltext }.to_not raise_error
216
+ end
217
+ end
80
218
  end
81
219
  end
82
220
 
@@ -100,66 +238,29 @@ describe Kuhsaft::LocalizedPage do
100
238
  end
101
239
  end
102
240
 
103
- describe 'fulltext' do
104
- before do
105
- @page = Factory.create :page
106
- @page.translation.keywords = 'key words'
107
- @page.translation.description = 'descrip tion'
108
- @page.translation.title = 'my title'
109
- @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => 'oh la la1')
110
- @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => 'oh la la2')
111
- @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => 'oh la la3')
112
- @page.translation.page_parts << Kuhsaft::PagePart::Markdown.new(:text => nil)
113
- @page.save
114
- end
115
-
116
- it 'should collect the fulltext when saved' do
117
- @page.translation.should_receive(:collect_fulltext)
118
- @page.save
119
- end
120
-
121
- it 'should contain the title' do
122
- @page.fulltext.should include('my title')
123
- end
124
-
125
- it 'should contain the keywords' do
126
- @page.fulltext.should include('key words')
127
- end
128
-
129
- it 'should contain the description' do
130
- @page.fulltext.should include('descrip tion')
131
- end
132
-
133
- it 'should contain the page part content' do
134
- @page.fulltext.should include('oh la la')
135
- end
136
-
137
- it 'should convert all data to strings' do
138
- expect { @page.translation.collect_fulltext }.to_not raise_error
139
- end
140
- end
141
-
142
- describe 'search' do
143
- before do
144
- Factory.create :page
145
- Factory.create :page
146
- Factory.create :page
147
- end
148
-
149
- it 'should find any containing the search term' do
150
- Kuhsaft::LocalizedPage.search('hi').should have_at_least(0).items
151
- end
152
-
153
- it 'should find with "English Title"' do
154
- Kuhsaft::LocalizedPage.search('English Title').should have_at_least(1).item
155
- end
156
-
157
- it 'should only find results with the current locale' do
158
- Kuhsaft::LocalizedPage.search('English Title').should be_all { |p| p.locale == Kuhsaft::Page.current_translation_locale }
159
- end
160
-
161
- it 'should only find published results' do
162
- Kuhsaft::LocalizedPage.search('English Title').should be_all { |p| p.published? == true }
241
+ describe 'class methods' do
242
+ describe 'search' do
243
+ before do
244
+ Factory.create :page
245
+ Factory.create :page
246
+ Factory.create :page
247
+ end
248
+
249
+ it 'should find any containing the search term' do
250
+ Kuhsaft::LocalizedPage.search('hi').should have_at_least(0).items
251
+ end
252
+
253
+ it 'should find with "English Title"' do
254
+ Kuhsaft::LocalizedPage.search('English Title').should have_at_least(1).item
255
+ end
256
+
257
+ it 'should only find results with the current locale' do
258
+ Kuhsaft::LocalizedPage.search('English Title').should be_all { |p| p.locale == Kuhsaft::Page.current_translation_locale }
259
+ end
260
+
261
+ it 'should only find published results' do
262
+ Kuhsaft::LocalizedPage.search('English Title').should be_all { |p| p.published? == true }
263
+ end
163
264
  end
164
265
  end
165
266
  end
@@ -14,11 +14,27 @@ describe 'PagePart' do
14
14
  @content.should respond_to(:content)
15
15
  end
16
16
 
17
+ it 'should be orderable' do
18
+ @content.should respond_to(:position)
19
+ end
20
+
21
+ it 'should have tags' do
22
+ @content.should respond_to(:tags)
23
+ end
24
+
25
+ it 'should have a tag list' do
26
+ @content.should respond_to(:tag_list)
27
+ end
28
+
17
29
  context 'class' do
18
30
  it 'should keep a list of the serializeable attributes' do
19
31
  Kuhsaft::PagePart::Content.serializeable_attributes.should be_a(Array)
20
32
  end
21
33
 
34
+ it 'should return the position of a page_part' do
35
+ Kuhsaft::PagePart::Content.should respond_to(:position_of)
36
+ end
37
+
22
38
  it 'should keep a list of searchable attributes' do
23
39
  Kuhsaft::PagePart::Content.searchable_attributes.should be_a(Array)
24
40
  end
@@ -30,10 +46,6 @@ describe 'PagePart' do
30
46
  it 'should have the Markdown PagePart by default' do
31
47
  Kuhsaft::PagePart::Content.descendants.should include(Kuhsaft::PagePart::Markdown)
32
48
  end
33
-
34
- it 'should convert to_name' do
35
- Kuhsaft::PagePart::Markdown.to_name.should eq('Markdown')
36
- end
37
49
  end
38
50
  end
39
51
 
@@ -60,5 +72,24 @@ describe 'PagePart' do
60
72
  m2 = Kuhsaft::PagePart::Markdown.find(m.id)
61
73
  m2.text.should eq('hi')
62
74
  end
75
+
76
+ it 'should set the initial position after save' do
77
+ @m2 = Kuhsaft::PagePart::Markdown.new
78
+ @m2.text = 'hi there'
79
+ @m2.should_receive(:set_position)
80
+ @m2.save
81
+ end
82
+
83
+ describe 'edit_partial_path' do
84
+ it 'should return kuhsaft/page_part/markdowns/edit_markdown' do
85
+ @m.edit_partial_path.should eq('kuhsaft/page_part/markdowns/edit_markdown')
86
+ end
87
+ end
88
+
89
+ describe 'show_partial_path' do
90
+ it 'should return kuhsaft/page_part/markdowns/show_markdown' do
91
+ @m.show_partial_path.should eq('kuhsaft/page_part/markdowns/show_markdown')
92
+ end
93
+ end
63
94
  end
64
95
  end