mokio 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/app/assets/stylesheets/backend/custom.css.scss +1 -1
  4. data/app/views/mokio/common/_meta.html.slim +20 -20
  5. data/app/views/mokio/menus/_form.html.haml +1 -1
  6. data/app/views/mokio/menus/_menu.html.slim +7 -1
  7. data/app/views/mokio/menus/index.html.slim +1 -0
  8. data/app/views/mokio/menus/new_menu_position.slim +21 -0
  9. data/config/locales/en.yml +4 -1
  10. data/config/locales/pl.yml +4 -1
  11. data/config/routes.rb +6 -3
  12. data/db/migrate/20140422135850_add_mokio_to_application.rb +15 -15
  13. data/lib/mokio/concerns/controllers/menus.rb +25 -2
  14. data/lib/mokio/concerns/models/contact.rb +1 -1
  15. data/lib/mokio/concerns/models/menu.rb +2 -1
  16. data/lib/mokio/concerns/models/recipient.rb +0 -9
  17. data/lib/mokio/engine.rb +8 -0
  18. data/lib/mokio/frontend_helpers/langs_helper.rb +16 -9
  19. data/lib/mokio/frontend_helpers/menu_helper.rb +21 -16
  20. data/lib/mokio/slugged.rb +5 -0
  21. data/lib/mokio/version.rb +1 -1
  22. data/spec/controllers/{backend → mokio}/contents_controller_spec.rb +34 -25
  23. data/spec/controllers/mokio/dashboard_controller_spec.rb +76 -0
  24. data/spec/controllers/{backend → mokio}/menus_controller_spec.rb +104 -99
  25. data/spec/controllers/mokio/mov_galleries_controller_spec.rb +125 -0
  26. data/spec/controllers/mokio/photos_controller_spec.rb +350 -0
  27. data/spec/controllers/mokio/pic_galleries_controller_spec.rb +125 -0
  28. data/spec/controllers/mokio/static_modules_controller_spec.rb +166 -0
  29. data/spec/factories/contact_templates.rb +1 -1
  30. data/spec/factories/content_links_factory.rb +1 -1
  31. data/spec/factories/contents_factory.rb +8 -8
  32. data/spec/factories/gmaps.rb +1 -1
  33. data/spec/factories/langs.rb +1 -1
  34. data/spec/factories/menus_factory.rb +1 -1
  35. data/spec/factories/meta.rb +1 -1
  36. data/spec/factories/recipients.rb +1 -1
  37. data/spec/factories/selected_modules.rb +1 -1
  38. data/spec/factories/static_modules_factory.rb +2 -2
  39. data/spec/factories/users.rb +1 -1
  40. data/spec/helpers/mokio/common_helper_spec.rb +141 -0
  41. data/spec/helpers/mokio/menus_helper_spec.rb +70 -0
  42. data/spec/models/available_module_spec.rb +13 -10
  43. data/spec/models/contact_template_spec.rb +5 -3
  44. data/spec/models/content_link_spec.rb +5 -4
  45. data/spec/models/content_spec.rb +71 -70
  46. data/spec/models/data_file_spec.rb +5 -4
  47. data/spec/models/gmap_spec.rb +5 -4
  48. data/spec/models/lang_spec.rb +5 -4
  49. data/spec/models/menu_spec.rb +10 -2
  50. data/spec/models/meta_spec.rb +5 -4
  51. data/spec/models/module_position_spec.rb +11 -10
  52. data/spec/models/mov_gallery_spec.rb +62 -59
  53. data/spec/models/pic_gallery_spec.rb +62 -59
  54. data/spec/models/recipient_spec.rb +5 -4
  55. data/spec/models/selected_module_spec.rb +72 -88
  56. data/spec/models/static_module_spec.rb +56 -55
  57. data/spec/models/user_spec.rb +7 -3
  58. data/spec/spec_helper.rb +4 -1
  59. metadata +21 -22
  60. data/spec/controllers/backend/dashboard_controller_spec.rb +0 -69
  61. data/spec/controllers/backend/mov_galleries_controller_spec.rb +0 -118
  62. data/spec/controllers/backend/photos_controller_spec.rb +0 -342
  63. data/spec/controllers/backend/pic_galleries_controller_spec.rb +0 -118
  64. data/spec/controllers/backend/static_modules_controller_spec.rb +0 -159
  65. data/spec/factories/tags.rb +0 -17
  66. data/spec/helpers/backend/common_helper_spec.rb +0 -137
  67. data/spec/helpers/backend/menus_helper_spec.rb +0 -64
@@ -22,82 +22,83 @@
22
22
 
23
23
  require 'spec_helper'
24
24
 
25
-
25
+ module Mokio
26
26
 
27
- describe StaticModule do
27
+ describe StaticModule do
28
28
 
29
- before(:all) do
30
- StaticModule.delete_all
31
- SelectedModule.delete_all
32
- AvailableModule.delete_all
33
- end
34
-
35
- it 'has valid factory' do
36
- FactoryGirl.create(:static_module).should be_valid
37
- end
38
-
39
- it 'is invalid without title' do
40
- FactoryGirl.build(:static_module_without_title).should_not be_valid
41
- end
42
-
43
- describe 'default values' do
44
- before(:each) do
45
- @static_module = FactoryGirl.build(:static_module)
29
+ before(:all) do
30
+ StaticModule.delete_all
31
+ SelectedModule.delete_all
32
+ AvailableModule.delete_all
46
33
  end
47
34
 
48
- it 'is editable' do
49
- @static_module.editable.should == true
35
+ it 'has valid factory' do
36
+ FactoryGirl.create(:static_module).should be_valid
50
37
  end
51
38
 
52
- it 'is deletable' do
53
- @static_module.deletable.should == true
39
+ it 'is invalid without title' do
40
+ FactoryGirl.build(:static_module_without_title).should_not be_valid
54
41
  end
55
42
 
56
- it 'is active' do
57
- @static_module.active.should == true
58
- end
59
- end
43
+ describe 'default values' do
44
+ before(:each) do
45
+ @static_module = FactoryGirl.build(:static_module)
46
+ end
60
47
 
61
- describe 'has and belongs to many module positions' do
62
- it 'reflect on association' do
63
- static_module = StaticModule.reflect_on_association(:module_positions)
64
- static_module.macro.should == :has_and_belongs_to_many
65
- end
48
+ it 'is editable' do
49
+ @static_module.editable.should == true
50
+ end
66
51
 
67
- describe 'without module position in database' do
68
- it 'is invalid' do
69
- expect { FactoryGirl.create(:with_module_position).data_files }.to raise_error ActiveRecord::RecordNotFound
52
+ it 'is deletable' do
53
+ @static_module.deletable.should == true
70
54
  end
71
- end
72
55
 
73
- it 'does not save through available_modules without module position' do
74
- static_module = FactoryGirl.create(:static_module)
75
- static_module.save!
76
- expect(AvailableModule).to have(0).records
56
+ it 'is active' do
57
+ @static_module.active.should == true
58
+ end
77
59
  end
78
60
 
79
- describe 'with module position in database' do
80
- before(:each) do
81
- position = FactoryGirl.create(:module_position)
82
- @static_module = FactoryGirl.create(:static_module, :module_position_ids => [position.id])
61
+ describe 'has and belongs to many module positions' do
62
+ it 'reflect on association' do
63
+ static_module = StaticModule.reflect_on_association(:module_positions)
64
+ static_module.macro.should == :has_many
83
65
  end
84
66
 
85
- it 'is valid' do
86
- @static_module.should be_valid
67
+ describe 'without module position in database' do
68
+ it 'is invalid' do
69
+ expect { FactoryGirl.create(:with_module_position).data_files }.to raise_error ActiveRecord::RecordNotFound
70
+ end
87
71
  end
88
72
 
89
- it 'saves through available_modules' do
90
- @static_module.save!
91
- expect(AvailableModule).to have(1).records
73
+ it 'does not save through available_modules without module position' do
74
+ static_module = FactoryGirl.create(:static_module)
75
+ static_module.save!
76
+ expect(AvailableModule).to have(0).records
77
+ end
78
+
79
+ describe 'with module position in database' do
80
+ before(:each) do
81
+ position = FactoryGirl.create(:module_position)
82
+ @static_module = FactoryGirl.create(:static_module, :module_position_ids => [position.id])
83
+ end
84
+
85
+ it 'is valid' do
86
+ @static_module.should be_valid
87
+ end
88
+
89
+ it 'saves through available_modules' do
90
+ @static_module.save!
91
+ expect(AvailableModule).to have(1).records
92
+ end
92
93
  end
93
94
  end
94
- end
95
95
 
96
- describe 'functions' do
97
- context 'columns for table' do
98
- it 'returns array of values' do
99
- expect(StaticModule.columns_for_table).to eq(["title", "active", "module_position_ids", "updated_at", "lang_id"])
96
+ describe 'functions' do
97
+ context 'columns for table' do
98
+ it 'returns array of values' do
99
+ expect(StaticModule.columns_for_table).to eq(["title", "active", "module_position_ids", "updated_at", "lang_id"])
100
+ end
100
101
  end
101
102
  end
102
103
  end
103
- end
104
+ end
@@ -1,5 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe User do
4
- pending "add some examples to (or delete) #{__FILE__}"
5
- end
3
+ module Mokio
4
+
5
+ describe User do
6
+ pending "add some examples to (or delete) #{__FILE__}"
7
+ end
8
+
9
+ end
@@ -35,6 +35,9 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
35
35
  ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
36
36
 
37
37
  RSpec.configure do |config|
38
+
39
+
40
+
38
41
  # ## Mock Framework
39
42
  #
40
43
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
@@ -82,7 +85,7 @@ RSpec.configure do |config|
82
85
 
83
86
  config.before(:each) do
84
87
  ::Sunspot.session = ::Sunspot::Rails::StubSessionProxy.new(::Sunspot.session)
85
-
88
+
86
89
  end
87
90
 
88
91
  config.after(:each) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mokio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - versoft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -1405,6 +1405,7 @@ files:
1405
1405
  - app/views/mokio/menus/_menu.html.slim
1406
1406
  - app/views/mokio/menus/index.html.slim
1407
1407
  - app/views/mokio/menus/lang_changed.js.slim
1408
+ - app/views/mokio/menus/new_menu_position.slim
1408
1409
  - app/views/mokio/menus/sort.html.slim
1409
1410
  - app/views/mokio/menus/update_menu_breadcrumps.js.slim
1410
1411
  - app/views/mokio/module_positions/_form.html.slim
@@ -1538,13 +1539,13 @@ files:
1538
1539
  - lib/tasks/mokio_create_user.rake
1539
1540
  - lib/tasks/mokio_install.rake
1540
1541
  - lib/tasks/mokio_rollback.rake
1541
- - spec/controllers/backend/contents_controller_spec.rb
1542
- - spec/controllers/backend/dashboard_controller_spec.rb
1543
- - spec/controllers/backend/menus_controller_spec.rb
1544
- - spec/controllers/backend/mov_galleries_controller_spec.rb
1545
- - spec/controllers/backend/photos_controller_spec.rb
1546
- - spec/controllers/backend/pic_galleries_controller_spec.rb
1547
- - spec/controllers/backend/static_modules_controller_spec.rb
1542
+ - spec/controllers/mokio/contents_controller_spec.rb
1543
+ - spec/controllers/mokio/dashboard_controller_spec.rb
1544
+ - spec/controllers/mokio/menus_controller_spec.rb
1545
+ - spec/controllers/mokio/mov_galleries_controller_spec.rb
1546
+ - spec/controllers/mokio/photos_controller_spec.rb
1547
+ - spec/controllers/mokio/pic_galleries_controller_spec.rb
1548
+ - spec/controllers/mokio/static_modules_controller_spec.rb
1548
1549
  - spec/dummy/README.rdoc
1549
1550
  - spec/dummy/Rakefile
1550
1551
  - spec/dummy/app/assets/javascripts/application.js
@@ -1591,11 +1592,10 @@ files:
1591
1592
  - spec/factories/recipients.rb
1592
1593
  - spec/factories/selected_modules.rb
1593
1594
  - spec/factories/static_modules_factory.rb
1594
- - spec/factories/tags.rb
1595
1595
  - spec/factories/users.rb
1596
1596
  - spec/fixtures/files/sample_image.jpg
1597
- - spec/helpers/backend/common_helper_spec.rb
1598
- - spec/helpers/backend/menus_helper_spec.rb
1597
+ - spec/helpers/mokio/common_helper_spec.rb
1598
+ - spec/helpers/mokio/menus_helper_spec.rb
1599
1599
  - spec/integration/navigation_test.rb
1600
1600
  - spec/lib/load_spec.rb
1601
1601
  - spec/lib/mokio/site_helper_spec.rb
@@ -1646,8 +1646,8 @@ summary: Mokio is a Content Management System that allows creation of sophistica
1646
1646
  menu structure and managing any kind of element that you wish to include on your
1647
1647
  site.
1648
1648
  test_files:
1649
- - spec/helpers/backend/menus_helper_spec.rb
1650
- - spec/helpers/backend/common_helper_spec.rb
1649
+ - spec/helpers/mokio/menus_helper_spec.rb
1650
+ - spec/helpers/mokio/common_helper_spec.rb
1651
1651
  - spec/models/recipient_spec.rb
1652
1652
  - spec/models/content_link_spec.rb
1653
1653
  - spec/models/module_position_spec.rb
@@ -1665,16 +1665,15 @@ test_files:
1665
1665
  - spec/models/gmap_spec.rb
1666
1666
  - spec/models/lang_spec.rb
1667
1667
  - spec/mokio_test.rb
1668
- - spec/controllers/backend/photos_controller_spec.rb
1669
- - spec/controllers/backend/static_modules_controller_spec.rb
1670
- - spec/controllers/backend/mov_galleries_controller_spec.rb
1671
- - spec/controllers/backend/menus_controller_spec.rb
1672
- - spec/controllers/backend/contents_controller_spec.rb
1673
- - spec/controllers/backend/pic_galleries_controller_spec.rb
1674
- - spec/controllers/backend/dashboard_controller_spec.rb
1668
+ - spec/controllers/mokio/photos_controller_spec.rb
1669
+ - spec/controllers/mokio/static_modules_controller_spec.rb
1670
+ - spec/controllers/mokio/mov_galleries_controller_spec.rb
1671
+ - spec/controllers/mokio/menus_controller_spec.rb
1672
+ - spec/controllers/mokio/contents_controller_spec.rb
1673
+ - spec/controllers/mokio/pic_galleries_controller_spec.rb
1674
+ - spec/controllers/mokio/dashboard_controller_spec.rb
1675
1675
  - spec/factories/common_factory.rb
1676
1676
  - spec/factories/content_links_factory.rb
1677
- - spec/factories/tags.rb
1678
1677
  - spec/factories/selected_modules.rb
1679
1678
  - spec/factories/files.rb
1680
1679
  - spec/factories/users.rb
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mokio::Backend::DashboardController do
4
- # include Devise::TestHelpers
5
- let(:valid_session) { {} }
6
-
7
- describe "GET show" do
8
- before(:all) do
9
- Content.delete_all
10
- Menu.delete_all
11
- @root_pl_menu = FactoryGirl.create(:root_pl)
12
- @top_menu = FactoryGirl.create(:top_pl)
13
- @loose_content_elt = FactoryGirl.create(:article_displayed_and_active).becomes(Article)
14
- @invisible_content = FactoryGirl.create(:article_non_displayed).becomes(Article)
15
- @empty_menu_elt = FactoryGirl.create(:menu, :parent_id => @top_menu.id)
16
- @menu_with_invisible = FactoryGirl.create(:menu, :parent_id => @top_menu.id)
17
- @menu_with_invisible.contents << @invisible_content
18
- @menu_with_invisible.save
19
-
20
- @menu_with_visible = FactoryGirl.create(:menu, :parent_id => @top_menu.id)
21
- @content = FactoryGirl.create(:article_displayed_and_active).becomes(Article)
22
- @menu_with_visible.contents << @content
23
- @menu_with_visible.save
24
- end
25
-
26
- it "displays loose content" do
27
- get :show, {}, valid_session
28
- if (!assigns(:more_loose_content))
29
- expect(assigns(:loose_content).include?(@loose_content_elt)).to be_true
30
- end
31
- end
32
-
33
- it "displays empty menu" do
34
- get :show, {}, valid_session
35
- if (!assigns(:more_empty_menu))
36
- expect(assigns(:empty_menu).include?(@empty_menu_elt)).to be_true
37
- end
38
- end
39
-
40
- it "displays invisible menu" do
41
- get :show, {}, valid_session
42
- if (!assigns(:more_empty_menu))
43
- expect(@menu_with_invisible.invisible_content).to be_true
44
- expect(assigns(:empty_menu).include?(@menu_with_invisible)).to be_true
45
- end
46
- end
47
-
48
- it 'does not display assigned content' do
49
- get :show, {}, valid_session
50
- expect(assigns(:loose_content).include?(@menu_with_invisible)).to be_false
51
- end
52
-
53
- it 'does not display menu with visible content' do
54
- get :show, {}, valid_session
55
- expect(assigns(:empty_menu).include?(@menu_with_visible)).to be_false
56
- end
57
-
58
- it "displays last created" do
59
- get :show, {}, valid_session
60
- expect(assigns(:last_created).include?(@content)).to be_true
61
- end
62
-
63
- it "displays last updated" do
64
- get :show, {}, valid_session
65
- expect(assigns(:last_updated).include?(@content)).to be_true
66
- end
67
-
68
- end
69
- end
@@ -1,118 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mokio::Backend::MovGalleriesController do
4
-
5
- # This should return the minimal set of attributes required to create a valid
6
- # Article. As you add validations to Article, be sure to
7
- # adjust the attributes here as well.
8
- let(:valid_attributes) { { :title => "MyString" } }
9
-
10
- # This should return the minimal set of values that should be in the session
11
- # in order to pass any filters (e.g. authentication) defined in
12
- # ArticlesController. Be sure to keep this updated too.
13
- let(:valid_session) { {} }
14
-
15
- # describe "GET index" do
16
- # it "assigns all articles as @article" do
17
- # article = Article.all
18
- # get :index, {}, valid_session
19
- # assigns(:mov_gallery).should eq(article)
20
- # end
21
- # end
22
-
23
- describe 'GET new' do
24
- before(:each) do
25
- get :new
26
- end
27
-
28
- it "assigns a new mov_gallery as @mov_gallery" do
29
- assigns(:mov_gallery).should be_a_new(MovGallery)
30
- end
31
- end
32
-
33
- describe 'POST create' do
34
- describe "with valid params" do
35
- it "creates a new MovGallery" do
36
- expect {
37
- post :create, {:mov_gallery => valid_attributes}, valid_session
38
- }.to change(MovGallery, :count).by(1)
39
- end
40
-
41
- it "assigns a newly created mov_gallery as @mov_gallery" do
42
- post :create, {:mov_gallery => valid_attributes}, valid_session
43
- assigns(:mov_gallery).should be_a(MovGallery)
44
- assigns(:mov_gallery).should be_persisted
45
- end
46
-
47
- it "redirects to the index" do
48
- post :create, {:mov_gallery => valid_attributes}, valid_session
49
- response.should redirect_to(edit_backend_content_path(assigns(:mov_gallery).id))
50
- end
51
-
52
- it "has type param = 'MovGallery'" do
53
- post :create, {:mov_gallery => valid_attributes }, valid_session
54
- assigns(:mov_gallery).type.should == "MovGallery"
55
- end
56
- end
57
-
58
- describe "with invalid params" do
59
- it "assigns a newly created but unsaved article as @mov_gallery" do
60
- # Trigger the behavior that occurs when invalid params are submitted
61
- Article.any_instance.stub(:save).and_return(false)
62
- post :create, {:mov_gallery => { "title" => "" }}, valid_session
63
- assigns(:mov_gallery).should be_a_new(MovGallery)
64
- end
65
-
66
- it "re-renders the 'new' template" do
67
- # Trigger the behavior that occurs when invalid params are submitted
68
- Article.any_instance.stub(:save).and_return(false)
69
- post :create, {:mov_gallery => { "title" => "" }}, valid_session
70
- response.should render_template("new")
71
- end
72
- end
73
- end
74
-
75
- describe "PUT update" do
76
- describe "with valid params" do
77
- it "updates the requested article" do
78
- gallery = MovGallery.create! valid_attributes
79
- # Assuming there are no other articles in the database, this
80
- # specifies that the Article created on the previous line
81
- # receives the :update_attributes message with whatever params are
82
- # submitted in the request.
83
- MovGallery.any_instance.should_receive(:update).with({ "title" => "MyString" })
84
- put :update, {:id => gallery.to_param, :mov_gallery => { "title" => "MyString" }}, valid_session
85
- end
86
-
87
- it "assigns the requested article as @article" do
88
- gallery = MovGallery.create! valid_attributes
89
- put :update, {:id => gallery.to_param, :mov_gallery => valid_attributes}, valid_session
90
- assigns(:mov_gallery).should eq(gallery)
91
- end
92
-
93
- it "redirects to the index" do
94
- gallery = MovGallery.create! valid_attributes
95
- put :update, {:id => gallery.to_param, :mov_gallery => valid_attributes}, valid_session
96
- response.should redirect_to(backend_mov_galleries_path)
97
- end
98
- end
99
-
100
- describe "with invalid params" do
101
- it "assigns the article as @article" do
102
- gallery = MovGallery.create! valid_attributes
103
- # Trigger the behavior that occurs when invalid params are submitted
104
- MovGallery.any_instance.stub(:save).and_return(false)
105
- put :update, {:id => gallery.to_param, :mov_gallery => { "title" => "" }}, valid_session
106
- assigns(:mov_gallery).should eq(gallery)
107
- end
108
-
109
- it "re-renders the 'edit' template" do
110
- gallery = MovGallery.create! valid_attributes
111
- # Trigger the behavior that occurs when invalid params are submitted
112
- MovGallery.any_instance.stub(:save).and_return(false)
113
- put :update, {:id => gallery.to_param, :mov_gallery => { "title" => "" }}, valid_session
114
- response.should render_template("edit")
115
- end
116
- end
117
- end
118
- end