sunrise-cms 0.5.1 → 0.5.2

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.
Files changed (43) hide show
  1. data/app/controllers/sunrise/manager_controller.rb +4 -4
  2. data/app/helpers/sunrise/structure_helper.rb +1 -1
  3. data/lib/sunrise/abstract_model.rb +2 -3
  4. data/lib/sunrise/config/association.rb +4 -0
  5. data/lib/sunrise/config/model.rb +0 -1
  6. data/lib/sunrise/version.rb +1 -1
  7. data/spec/dummy/log/test.log +2629 -0
  8. data/spec/models/sunrise/abstract_model_spec.rb +1 -1
  9. data/spec/tmp/app/models/defaults/ability.rb +18 -0
  10. data/spec/tmp/app/models/defaults/asset.rb +7 -0
  11. data/spec/tmp/app/models/defaults/attachment_file.rb +5 -0
  12. data/spec/tmp/app/models/defaults/avatar.rb +7 -0
  13. data/spec/tmp/app/models/defaults/picture.rb +7 -0
  14. data/spec/tmp/app/models/defaults/position_type.rb +7 -0
  15. data/spec/tmp/app/models/defaults/role_type.rb +8 -0
  16. data/spec/tmp/app/models/defaults/settings.rb +3 -0
  17. data/spec/tmp/app/models/defaults/structure.rb +9 -0
  18. data/spec/tmp/app/models/defaults/structure_type.rb +9 -0
  19. data/spec/tmp/app/models/defaults/user.rb +13 -0
  20. data/spec/tmp/app/models/sunrise/sunrise_navigation.rb +14 -0
  21. data/spec/tmp/app/models/sunrise/sunrise_page.rb +10 -0
  22. data/spec/tmp/app/models/sunrise/sunrise_structure.rb +35 -0
  23. data/spec/tmp/app/models/sunrise/sunrise_user.rb +50 -0
  24. data/spec/tmp/app/uploaders/attachment_file_uploader.rb +5 -0
  25. data/spec/tmp/app/uploaders/avatar_uploader.rb +15 -0
  26. data/spec/tmp/app/uploaders/picture_uploader.rb +15 -0
  27. data/spec/tmp/app/views/layouts/application.html.erb +22 -0
  28. data/spec/tmp/app/views/pages/show.html.erb +2 -0
  29. data/spec/tmp/app/views/shared/_notice.html.erb +17 -0
  30. data/spec/tmp/config/application.rb +63 -0
  31. data/spec/tmp/config/database.yml.sample +34 -0
  32. data/spec/tmp/config/initializers/sunrise.rb +18 -0
  33. data/spec/tmp/config/logrotate-config.sample +9 -0
  34. data/spec/tmp/config/nginx-config.sample +99 -0
  35. data/spec/tmp/config/routes.rb +9 -0
  36. data/spec/tmp/db/seeds.rb +31 -0
  37. data/spec/tmp/spec/controllers/pages_controller_spec.rb +22 -0
  38. data/spec/tmp/spec/controllers/welcome_controller_spec.rb +18 -0
  39. data/spec/tmp/spec/factories/structure_factory.rb +22 -0
  40. data/spec/tmp/spec/factories/user_factory.rb +61 -0
  41. data/spec/tmp/spec/spec_helper.rb +37 -0
  42. data/spec/tmp/spec/support/helpers/controller_macros.rb +52 -0
  43. metadata +69 -1
@@ -22,7 +22,7 @@ describe Sunrise::AbstractModel do
22
22
 
23
23
  it "should return valid attributes" do
24
24
  @abstract_model.current_list.should == :tree
25
- @abstract_model.scoped_path.should == 'structures'
25
+ @abstract_model.plural.should == 'structures'
26
26
  @abstract_model.model_name.should == Structure.model_name
27
27
  end
28
28
 
@@ -0,0 +1,18 @@
1
+ class Ability < Sunrise::Models::Ability
2
+
3
+ def guest
4
+ # TODO
5
+ end
6
+
7
+ def default
8
+ # TODO
9
+ end
10
+
11
+ def redactor
12
+ # TODO
13
+ end
14
+
15
+ def moderator
16
+ # TODO
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ class Asset < ActiveRecord::Base
2
+ include Sunrise::Models::Asset
3
+
4
+ validates_presence_of :data
5
+
6
+ default_scope order("#{quoted_table_name}.sort_order")
7
+ end
@@ -0,0 +1,5 @@
1
+ class AttachmentFile < Asset
2
+ sunrise_uploader AttachmentFileUploader
3
+
4
+ validates_filesize_of :data, :maximum => 100.megabytes.to_i
5
+ end
@@ -0,0 +1,7 @@
1
+ class Avatar < Asset
2
+ sunrise_uploader AvatarUploader
3
+
4
+ validates :data_content_type, :inclusion => {:in => Sunrise::Utils::IMAGE_TYPES }
5
+ validates_integrity_of :data
6
+ validates_filesize_of :data, :maximum => 1.megabytes.to_i
7
+ end
@@ -0,0 +1,7 @@
1
+ class Picture < Asset
2
+ sunrise_uploader PictureUploader
3
+
4
+ validates :data_content_type, :inclusion => {:in => Sunrise::Utils::IMAGE_TYPES }
5
+ validates_integrity_of :data
6
+ validates_filesize_of :data, :maximum => 2.megabytes.to_i
7
+ end
@@ -0,0 +1,7 @@
1
+ class PositionType < Sunrise::Models::PositionType
2
+ define_enum do |builder|
3
+ builder.member :default, :object => new("default")
4
+ builder.member :menu, :object => new("menu")
5
+ builder.member :bottom, :object => new("bottom")
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ class RoleType < Sunrise::Models::RoleType
2
+ define_enum do |builder|
3
+ builder.member :default, :object => new("default")
4
+ builder.member :redactor, :object => new("redactor")
5
+ builder.member :moderator, :object => new("moderator")
6
+ builder.member :admin, :object => new("admin")
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ class Settings < ActiveRecord::Base
2
+ include Sunrise::Models::Settings
3
+ end
@@ -0,0 +1,9 @@
1
+ class Structure < ActiveRecord::Base
2
+ include Sunrise::Models::Structure
3
+ include PageParts::Extension
4
+ include MetaManager::Taggable
5
+ include ActiveModel::ForbiddenAttributesProtection
6
+
7
+ # audited :protect => false
8
+ # page_parts :content
9
+ end
@@ -0,0 +1,9 @@
1
+ class StructureType < Sunrise::Models::StructureType
2
+ define_enum do |builder|
3
+ builder.member :page, :object => new("page")
4
+ builder.member :posts, :object => new("posts")
5
+ builder.member :main, :object => new("main")
6
+ builder.member :redirect, :object => new("redirect")
7
+ builder.member :group, :object => new("group")
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ class User < ActiveRecord::Base
2
+ include Sunrise::Models::User
3
+ include ActiveModel::ForbiddenAttributesProtection
4
+
5
+ # Include default devise modules.
6
+ devise :database_authenticatable, :confirmable, :lockable, :timeoutable,
7
+ :recoverable, :rememberable, :trackable, :validatable,
8
+ :encryptable, :encryptor => :sha512
9
+
10
+ fileuploads :avatar
11
+
12
+ # audited :protect => false, :only => [:name, :email, :password]
13
+ end
@@ -0,0 +1,14 @@
1
+ class SunriseNavigation < Sunrise::Config::Navigation
2
+ navigation :main do |m|
3
+ m.item :dashboard, root_path, :class => "icon1"
4
+ m.item :structures, index_path(:model_name => "structures"), :class => "icon2"
5
+ m.item :users, index_path(:model_name => "users"), :class => "icon3"
6
+ m.item :services, "#", :class => "icon4"
7
+ m.item :settings, edit_settings_path, :class => "icon4"
8
+ end
9
+
10
+ navigation :creates do |c|
11
+ c.item :structures, new_path(:model_name => "structures")
12
+ c.item :users, new_path(:model_name => "users")
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ class SunrisePage < Sunrise::AbstractModel
2
+ self.resource_name = "Structure"
3
+
4
+ list false
5
+
6
+ edit do
7
+ field :main, :as => :text
8
+ field :sidebar, :as => :text
9
+ end
10
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+ class SunriseStructure < Sunrise::AbstractModel
3
+ self.resource_name = "Structure"
4
+
5
+ default_list_view :tree
6
+ available_list_view [:tree, :thumbs]
7
+
8
+ list :tree do
9
+ field :title
10
+ field :updated_at
11
+ field :id
12
+ end
13
+
14
+ show do
15
+ field :title
16
+ field :redirect_url
17
+ field :is_visible
18
+ end
19
+
20
+ edit do
21
+ field :title
22
+ field :redirect_url
23
+ field :slug
24
+ field :parent_id, :collection => lambda { Structure.nested_set_options() {|i| "#{'–' * i.depth} #{i.title}"} }, :if => lambda { |s| s.moveable? }
25
+ field :kind, :collection => lambda { StructureType.all }, :include_blank => false
26
+ field :position, :collection => lambda { PositionType.all }, :include_blank => false
27
+ field :is_visible
28
+
29
+ group :meta_tags, :holder => :sidebar do
30
+ field :tag_title
31
+ field :tag_keywords
32
+ field :tag_description
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,50 @@
1
+ class SunriseUser < Sunrise::AbstractModel
2
+ self.resource_name = "User"
3
+
4
+ list :table do
5
+ field :email
6
+ field :updated_at
7
+ field :id
8
+
9
+ group :search do
10
+ field :email
11
+ field :name
12
+ end
13
+ end
14
+
15
+ list :thumbs do
16
+ scope { User.includes(:avatar) }
17
+ preview lambda { |user| user.avatar.try(:url, :thumb) }
18
+
19
+ field :email, :label => false
20
+ field :updated_at, :label => false
21
+ field :id
22
+
23
+ group :search do
24
+ field :email
25
+ field :name
26
+ end
27
+ end
28
+
29
+ edit do
30
+ permited_attributes lambda { |user|
31
+ user.admin? ? :all : [:name, :password, :password_confirmation, :avatar_attributes]
32
+ }
33
+
34
+ field :name
35
+ field :email
36
+ field :password
37
+ field :password_confirmation
38
+ field :role_type_id, :collection => lambda { RoleType.all }
39
+
40
+ group :bottom, :holder => :bottom do
41
+ field :avatar, :as => :uploader
42
+ end
43
+ end
44
+
45
+ list :export do
46
+ field :id
47
+ field :name
48
+ field :email
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ class AttachmentFileUploader < Sunrise::CarrierWave::BaseUploader
2
+ def extension_white_list
3
+ %w(pdf doc docx xls xlsx ppt pptx zip rar csv)
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ class AvatarUploader < Sunrise::CarrierWave::BaseUploader
2
+ process :quality => 90
3
+
4
+ version :thumb do
5
+ process :resize_to_fill => [50, 50]
6
+ end
7
+
8
+ version :small do
9
+ process :resize_to_fill => [32, 32]
10
+ end
11
+
12
+ def extension_white_list
13
+ %w(jpg jpeg gif png)
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ class PictureUploader < Sunrise::CarrierWave::BaseUploader
2
+ process :quality => 90
3
+
4
+ version :thumb do
5
+ process :resize_to_fill => [50, 50]
6
+ end
7
+
8
+ version :content do
9
+ process :resize_to_fit => [575, 500]
10
+ end
11
+
12
+ def extension_white_list
13
+ %w(jpg jpeg gif png)
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <%= csrf_meta_tag %>
6
+ <%= raw(render_meta_tags(@structure)) %>
7
+ <title><%= render_page_title(@structure) %></title>
8
+ <%= stylesheet_link_tag "application" %>
9
+ <%= javascript_include_tag "application" %>
10
+ <%= yield(:head) %>
11
+ </head>
12
+ <body>
13
+ <%#= render :partial => "manage/shared/panel" if content_manager? %>
14
+ <%= render :partial => 'shared/notice' if flash %>
15
+
16
+ <div class='content'>
17
+ <%= yield %>
18
+ </div>
19
+
20
+ <%= yield(:footer) %>
21
+ </body>
22
+ </html>
@@ -0,0 +1,2 @@
1
+ <h1><%= @structure.title %></h1>
2
+ <%=raw Nokogiri::HTML.fragment(@page.content).to_html %>
@@ -0,0 +1,17 @@
1
+ <% unless flash.keys.empty? %>
2
+ <div class="message" style="display:none;z-index:5000;">
3
+ <div class="alert-container">
4
+ <div class="alert">
5
+ <% flash.each do |key, text| %>
6
+ <%= content_tag(:div, text, :class => "flash_#{key}") %>
7
+ <% end %>
8
+ <%= link_to_function(image_tag("cross_ico.png", :title=>t('label.close')), "$(this).parents('div.message').slideUp()", :class=>"close") %>
9
+ </div>
10
+ </div>
11
+ <script type='text/javascript' charset='UTF-8'>
12
+ $(document).ready(function(){
13
+ $('div.message').slideDown('slow');
14
+ })
15
+ </script>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,63 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ unless defined?(SUNRISE_ORM)
6
+ SUNRISE_ORM = (ENV["SUNRISE_ORM"] || :active_record).to_sym
7
+ end
8
+
9
+ if defined?(Bundler)
10
+ # If you precompile assets before deploying to production, use this line
11
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
12
+ # If you want your assets lazily compiled in production, use this line
13
+ Bundler.require(SUNRISE_ORM)
14
+ end
15
+
16
+ require "sunrise-cms"
17
+
18
+ module Dummy
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Custom directories with classes and modules you want to be autoloadable.
25
+ config.autoload_paths += %W(
26
+ #{config.root}/../../lib/generators/sunrise/templates/models/#{SUNRISE_ORM}
27
+ #{config.root}/../../lib/generators/sunrise/templates/uploaders
28
+ #{config.root}/../../lib/generators/sunrise/templates/models/sunrise
29
+ #{config.root}/app/models/#{SUNRISE_ORM}
30
+ #{config.root}/app/models/sunrise)
31
+
32
+ # Only load the plugins named here, in the order given (default is alphabetical).
33
+ # :all can be used as a placeholder for all plugins not explicitly named.
34
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
35
+
36
+ # Activate observers that should always be running.
37
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
38
+
39
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
40
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
41
+ # config.time_zone = 'Central Time (US & Canada)'
42
+
43
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
44
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
45
+ # config.i18n.default_locale = :de
46
+
47
+ # Configure the default encoding used in templates for Ruby 1.9.
48
+ config.encoding = "utf-8"
49
+
50
+ # Configure sensitive parameters which will be filtered from the log file.
51
+ config.filter_parameters += [:password]
52
+
53
+ # Enable the asset pipeline
54
+ config.assets.enabled = true
55
+
56
+ # Version of your assets, change this if you want to expire all your assets
57
+ config.assets.version = '1.0'
58
+
59
+ # Disable the default whitelisting that occurs in later versions of Rails
60
+ config.active_record.whitelist_attributes = false
61
+ end
62
+ end
63
+
@@ -0,0 +1,34 @@
1
+ # And be sure to use new-style password hashing:
2
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
3
+ development:
4
+ adapter: mysql2
5
+ encoding: utf8
6
+ reconnect: false
7
+ database: dummy
8
+ pool: 5
9
+ username: root
10
+ password:
11
+ socket: /var/run/mysqld/mysqld.sock
12
+
13
+ # Warning: The database defined as "test" will be erased and
14
+ # re-generated from your development database when you run "rake".
15
+ # Do not set this db to the same as development or production.
16
+ test:
17
+ adapter: mysql2
18
+ encoding: utf8
19
+ reconnect: false
20
+ database: dummy_test
21
+ pool: 5
22
+ username: root
23
+ password:
24
+ socket: /var/run/mysqld/mysqld.sock
25
+
26
+ production:
27
+ adapter: mysql2
28
+ encoding: utf8
29
+ reconnect: true
30
+ database: dummy
31
+ pool: 5
32
+ username: root
33
+ password:
34
+ socket: /var/run/mysqld/mysqld.sock
@@ -0,0 +1,18 @@
1
+ # Use this hook to configure sunrise
2
+ if Object.const_defined?("Sunrise")
3
+ Sunrise.setup do |config|
4
+ # Flash keys
5
+ #config.flash_keys = [ :success, :failure ]
6
+ end
7
+ end
8
+
9
+ # Assuming HistoryTracker is your tracker class
10
+ # Mongoid::History.tracker_class_name = :history_tracker
11
+
12
+ # Assuming you're using devise/authlogic
13
+ # Mongoid::History.current_user_method = :current_user
14
+
15
+ #if Settings.table_exists?
16
+ # Settings.defaults[:some_setting] = "value"
17
+ # Settings.defaults[:some_setting2] = "value2"
18
+ #end
@@ -0,0 +1,9 @@
1
+ /var/www/gems/sunrise/spec/dummy/log/*.log {
2
+ copytruncate
3
+ daily
4
+ rotate 4
5
+ missingok
6
+ notifempty
7
+ compress
8
+ nodelaycompress
9
+ }
@@ -0,0 +1,99 @@
1
+ # dummy
2
+ #
3
+ upstream dummy_backend {
4
+ server unix:/var/www/dummy/tmp/sockets/unicorn.sock;
5
+ }
6
+
7
+ server {
8
+ listen 5.9.17.136:80;
9
+ server_name dummy.fodojo.com;
10
+
11
+ access_log off;
12
+ error_log off;
13
+ server_tokens off;
14
+
15
+ root /var/www/dummy/public;
16
+
17
+ if (-f $request_filename) {
18
+ break;
19
+ }
20
+
21
+ if (-f /cache$request_filename) {
22
+ rewrite (.*) /cache$1 break;
23
+ break;
24
+ }
25
+
26
+ if (-f /cache$request_filename.html) {
27
+ rewrite (.*) /cache$1.html break;
28
+ break;
29
+ }
30
+
31
+ if (-f $document_root/cache$request_uri.html) {
32
+ rewrite (.*) /cache$1.html break;
33
+ }
34
+
35
+ if (-f $document_root/cache$request_uri/index.html) {
36
+ rewrite (.*) /cache$1/index.html break;
37
+ }
38
+
39
+ # This directive prohibits direct access to the cache directory from outside
40
+ location ^~ /cache {
41
+ internal;
42
+ }
43
+
44
+ location ~ /\.[^\/]+ {
45
+ return 404;
46
+ }
47
+
48
+ location / {
49
+ proxy_redirect off;
50
+ proxy_set_header Host $host;
51
+ proxy_set_header X-Real-IP $remote_addr;
52
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
53
+ # proxy_set_header X-Forwarded-Proto https; # for SSL, add this
54
+
55
+ client_max_body_size 20m;
56
+ client_body_buffer_size 128k;
57
+
58
+ proxy_connect_timeout 90;
59
+ proxy_send_timeout 90;
60
+ proxy_read_timeout 90;
61
+
62
+ proxy_buffer_size 4k;
63
+ proxy_buffers 4 32k;
64
+ proxy_busy_buffers_size 64k;
65
+ proxy_temp_file_write_size 64k;
66
+
67
+ if (!-f $request_filename) {
68
+ proxy_pass http://dummy_backend;
69
+ break;
70
+ }
71
+ }
72
+
73
+ location ~ ^/(assets|ckeditor_assets|images|javascripts|stylesheets)/ {
74
+ expires 1y;
75
+ add_header Cache-Control public;
76
+
77
+ # Some browsers still send conditional-GET requests if there's a
78
+ # Last-Modified header or an ETag header even if they haven't
79
+ # reached the expiry date sent in the Expires header.
80
+ add_header Last-Modified "";
81
+ add_header ETag "";
82
+ break;
83
+ }
84
+
85
+ # This rewrites all the requests to the maintenance.html page if it exists in the doc root.
86
+ if (-f $document_root/system/maintenance.html) {
87
+ return 503;
88
+ }
89
+
90
+ error_page 503 @503;
91
+ location @503 {
92
+ # Serve static assets if found.
93
+ if (-f $request_filename) {
94
+ break;
95
+ }
96
+
97
+ rewrite ^(.*)$ /system/maintenance.html break;
98
+ }
99
+ }
@@ -0,0 +1,9 @@
1
+ Rails.application.routes.draw do
2
+ mount Sunrise::Engine => '/manage'
3
+
4
+ devise_for :users
5
+
6
+ resources :pages, :only => [:show]
7
+
8
+ root :to => "welcome#index"
9
+ end
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ def insert_user
4
+ User.truncate!
5
+ password = Rails.env.production? ? Devise.friendly_token : (1..9).to_a.join
6
+
7
+ admin = User.new do |u|
8
+ u.name = "Administrator"
9
+ u.email = 'dev@fodojo.com'
10
+ u.password = password
11
+ u.password_confirmation = password
12
+ u.login = 'admin' if u.respond_to?(:login)
13
+ u.role_type = RoleType.admin
14
+ end
15
+
16
+ admin.skip_confirmation!
17
+ admin.save!
18
+
19
+ puts "Admin: #{admin.email}, #{admin.password}"
20
+ end
21
+
22
+ def insert_structures
23
+ Structure.truncate!
24
+
25
+ main_page = Structure.create!({:title => "Главная страница", :slug => "main-page", :structure_type => StructureType.main, :parent => nil}, :as => :admin)
26
+ #Structure.create!({:title => "Трансляции", :slug => "broadcasts", :structure_type => StructureType.broadcasts, :parent => main_page}, :as => :admin)
27
+ #Structure.create!({:title => "Прямые репортажи", :slug => "posts", :structure_type => StructureType.posts, :parent => main_page}, :as => :admin)
28
+ end
29
+
30
+ insert_user
31
+ insert_structures
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe PagesController do
4
+ render_views
5
+
6
+ before(:all) do
7
+ @root = FactoryGirl.create(:structure_main)
8
+ end
9
+
10
+ context "page" do
11
+ before(:each) { @page = FactoryGirl.create(:structure_page, :parent => @root) }
12
+
13
+ it "should render show action" do
14
+ get :show, :id => @page.slug
15
+
16
+ assigns(:structure).should == @page
17
+
18
+ response.should be_success
19
+ response.should render_template('show')
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe WelcomeController do
4
+ render_views
5
+
6
+ before(:each) do
7
+ @root = FactoryGirl.create(:structure_main)
8
+ end
9
+
10
+ it "should render index action" do
11
+ get :index
12
+
13
+ assigns(:structure).should == @root
14
+
15
+ response.should be_success
16
+ response.should render_template('index')
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ FactoryGirl.define do
3
+ factory :structure_page, :class => Structure do
4
+ title 'Structure'
5
+ slug { FactoryGirl.generate(:slug) }
6
+ structure_type StructureType.page
7
+ position_type PositionType.menu
8
+ is_visible true
9
+ end
10
+
11
+ factory :structure_main, :class => Structure do
12
+ title "Main page"
13
+ slug "main-page"
14
+ structure_type StructureType.main
15
+ position_type PositionType.default
16
+ is_visible true
17
+ end
18
+
19
+ sequence :slug do |n|
20
+ "slug#{n}"
21
+ end
22
+ end