mokio 0.0.11 → 0.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.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/app/assets/stylesheets/backend/custom.css.scss +1 -1
- data/app/views/mokio/common/_meta.html.slim +20 -20
- data/app/views/mokio/menus/_form.html.haml +1 -1
- data/app/views/mokio/menus/_menu.html.slim +7 -1
- data/app/views/mokio/menus/index.html.slim +1 -0
- data/app/views/mokio/menus/new_menu_position.slim +21 -0
- data/config/locales/en.yml +4 -1
- data/config/locales/pl.yml +4 -1
- data/config/routes.rb +6 -3
- data/db/migrate/20140422135850_add_mokio_to_application.rb +15 -15
- data/lib/mokio/concerns/controllers/menus.rb +25 -2
- data/lib/mokio/concerns/models/contact.rb +1 -1
- data/lib/mokio/concerns/models/menu.rb +2 -1
- data/lib/mokio/concerns/models/recipient.rb +0 -9
- data/lib/mokio/engine.rb +8 -0
- data/lib/mokio/frontend_helpers/langs_helper.rb +16 -9
- data/lib/mokio/frontend_helpers/menu_helper.rb +21 -16
- data/lib/mokio/slugged.rb +5 -0
- data/lib/mokio/version.rb +1 -1
- data/spec/controllers/{backend → mokio}/contents_controller_spec.rb +34 -25
- data/spec/controllers/mokio/dashboard_controller_spec.rb +76 -0
- data/spec/controllers/{backend → mokio}/menus_controller_spec.rb +104 -99
- data/spec/controllers/mokio/mov_galleries_controller_spec.rb +125 -0
- data/spec/controllers/mokio/photos_controller_spec.rb +350 -0
- data/spec/controllers/mokio/pic_galleries_controller_spec.rb +125 -0
- data/spec/controllers/mokio/static_modules_controller_spec.rb +166 -0
- data/spec/factories/contact_templates.rb +1 -1
- data/spec/factories/content_links_factory.rb +1 -1
- data/spec/factories/contents_factory.rb +8 -8
- data/spec/factories/gmaps.rb +1 -1
- data/spec/factories/langs.rb +1 -1
- data/spec/factories/menus_factory.rb +1 -1
- data/spec/factories/meta.rb +1 -1
- data/spec/factories/recipients.rb +1 -1
- data/spec/factories/selected_modules.rb +1 -1
- data/spec/factories/static_modules_factory.rb +2 -2
- data/spec/factories/users.rb +1 -1
- data/spec/helpers/mokio/common_helper_spec.rb +141 -0
- data/spec/helpers/mokio/menus_helper_spec.rb +70 -0
- data/spec/models/available_module_spec.rb +13 -10
- data/spec/models/contact_template_spec.rb +5 -3
- data/spec/models/content_link_spec.rb +5 -4
- data/spec/models/content_spec.rb +71 -70
- data/spec/models/data_file_spec.rb +5 -4
- data/spec/models/gmap_spec.rb +5 -4
- data/spec/models/lang_spec.rb +5 -4
- data/spec/models/menu_spec.rb +10 -2
- data/spec/models/meta_spec.rb +5 -4
- data/spec/models/module_position_spec.rb +11 -10
- data/spec/models/mov_gallery_spec.rb +62 -59
- data/spec/models/pic_gallery_spec.rb +62 -59
- data/spec/models/recipient_spec.rb +5 -4
- data/spec/models/selected_module_spec.rb +72 -88
- data/spec/models/static_module_spec.rb +56 -55
- data/spec/models/user_spec.rb +7 -3
- data/spec/spec_helper.rb +4 -1
- metadata +21 -22
- data/spec/controllers/backend/dashboard_controller_spec.rb +0 -69
- data/spec/controllers/backend/mov_galleries_controller_spec.rb +0 -118
- data/spec/controllers/backend/photos_controller_spec.rb +0 -342
- data/spec/controllers/backend/pic_galleries_controller_spec.rb +0 -118
- data/spec/controllers/backend/static_modules_controller_spec.rb +0 -159
- data/spec/factories/tags.rb +0 -17
- data/spec/helpers/backend/common_helper_spec.rb +0 -137
- data/spec/helpers/backend/menus_helper_spec.rb +0 -64
data/spec/models/gmap_spec.rb
CHANGED
data/spec/models/lang_spec.rb
CHANGED
data/spec/models/menu_spec.rb
CHANGED
@@ -28,6 +28,8 @@ require 'spec_helper'
|
|
28
28
|
|
29
29
|
MENU_COUNT_INITIAL = 7
|
30
30
|
|
31
|
+
module Mokio
|
32
|
+
|
31
33
|
describe Menu do
|
32
34
|
|
33
35
|
before :all do
|
@@ -35,6 +37,11 @@ describe Menu do
|
|
35
37
|
Lang.create(:name => 'polish', :shortname => 'pl', :id => 1)
|
36
38
|
end
|
37
39
|
|
40
|
+
# before :each do
|
41
|
+
# # @routes = Mokio::Engine.routes
|
42
|
+
# end
|
43
|
+
|
44
|
+
|
38
45
|
it "has one record" do
|
39
46
|
|
40
47
|
expect {FactoryGirl.create(:menu)}.to change(Menu, :count).by(1)
|
@@ -240,8 +247,9 @@ describe Menu do
|
|
240
247
|
|
241
248
|
describe 'some_editable' do
|
242
249
|
it 'is invalid when not editable' do
|
243
|
-
@menu = FactoryGirl.
|
250
|
+
@menu = FactoryGirl.create(:menu, :not_editable)
|
244
251
|
@menu.name = 'aaa'
|
252
|
+
# raise (@menu.valid?).inspect
|
245
253
|
expect(@menu).not_to be_valid
|
246
254
|
end
|
247
255
|
|
@@ -311,5 +319,5 @@ describe Menu do
|
|
311
319
|
end
|
312
320
|
|
313
321
|
end
|
314
|
-
|
322
|
+
end
|
315
323
|
end
|
data/spec/models/meta_spec.rb
CHANGED
@@ -10,16 +10,17 @@
|
|
10
10
|
#
|
11
11
|
|
12
12
|
require 'spec_helper'
|
13
|
+
module Mokio
|
14
|
+
describe ModulePosition do
|
15
|
+
it 'has valid factory' do
|
16
|
+
FactoryGirl.create(:module_position).should be_valid
|
17
|
+
end
|
13
18
|
|
14
|
-
describe
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
describe 'has and belongs to many static modules' do
|
20
|
-
it 'reflect on association' do
|
21
|
-
module_position = ModulePosition.reflect_on_association(:static_modules)
|
22
|
-
module_position.macro.should == :has_and_belongs_to_many
|
19
|
+
describe 'has and belongs to many static modules' do
|
20
|
+
it 'reflect on association' do
|
21
|
+
module_position = ModulePosition.reflect_on_association(:static_modules)
|
22
|
+
module_position.macro.should == :has_many
|
23
|
+
end
|
23
24
|
end
|
24
25
|
end
|
25
|
-
end
|
26
|
+
end
|
@@ -25,79 +25,82 @@
|
|
25
25
|
|
26
26
|
require 'spec_helper'
|
27
27
|
|
28
|
-
|
28
|
+
module Mokio
|
29
29
|
|
30
|
-
describe
|
31
|
-
before(:each) do
|
32
|
-
@gallery = MovGallery.new
|
33
|
-
end
|
30
|
+
describe MovGallery do
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
describe 'defaults' do
|
33
|
+
before(:each) do
|
34
|
+
@gallery = MovGallery.new
|
35
|
+
end
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
it 'has MovGallery type' do
|
38
|
+
@gallery.type.should == "Mokio::MovGallery"
|
39
|
+
end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
it 'is editable' do
|
47
|
-
@gallery.editable.should == true
|
48
|
-
end
|
41
|
+
it 'is invalid without title' do
|
42
|
+
@gallery.should_not be_valid
|
43
|
+
end
|
49
44
|
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
#
|
46
|
+
# default added MovGallery have to have this values
|
47
|
+
#
|
48
|
+
it 'is editable' do
|
49
|
+
@gallery.editable.should == true
|
50
|
+
end
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
52
|
+
it 'is deletable' do
|
53
|
+
@gallery.deletable.should == true
|
54
|
+
end
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
#
|
63
|
-
it 'is Content child' do
|
64
|
-
expect(subject).to be_a_kind_of Content
|
56
|
+
it 'is active' do
|
57
|
+
@gallery.active.should == true
|
58
|
+
end
|
65
59
|
end
|
66
60
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
61
|
+
describe 'associations and inheritance' do
|
62
|
+
#
|
63
|
+
# MovGallery < Content
|
64
|
+
#
|
65
|
+
it 'is Content child' do
|
66
|
+
expect(subject).to be_a_kind_of Content
|
67
|
+
end
|
71
68
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
it "should have many data_files" do
|
70
|
+
association = MovGallery.reflect_on_association(:data_files)
|
71
|
+
association.macro.should == :has_many
|
72
|
+
end
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
74
|
+
it "should have many menus" do
|
75
|
+
association = MovGallery.reflect_on_association(:menus)
|
76
|
+
association.macro.should == :has_many
|
77
|
+
end
|
82
78
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
79
|
+
it "should have many content_links" do
|
80
|
+
association = MovGallery.reflect_on_association(:content_links)
|
81
|
+
association.macro.should == :has_many
|
82
|
+
end
|
83
|
+
end
|
88
84
|
|
89
|
-
|
90
|
-
|
91
|
-
gallery
|
92
|
-
gallery.
|
93
|
-
gallery.save!
|
94
|
-
expect(DataFile).to have(1).records
|
85
|
+
it 'has default_data_file saved as model reference' do
|
86
|
+
gallery = MovGallery.new
|
87
|
+
gallery.default_data_file.should_not == "Youtube"
|
88
|
+
gallery.default_data_file.should == Youtube
|
95
89
|
end
|
96
90
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
91
|
+
describe 'data_files' do
|
92
|
+
it 'saves association with data_file' do
|
93
|
+
gallery = MovGallery.new(:title => "test")
|
94
|
+
gallery.data_files.build(data_file: "test.png", name: "Test")
|
95
|
+
gallery.save!
|
96
|
+
expect(DataFile).to have(1).records
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'does not save association without data_file' do
|
100
|
+
content = MovGallery.new(:title => "test")
|
101
|
+
content.save!
|
102
|
+
expect(DataFile).to have(0).records
|
103
|
+
end
|
101
104
|
end
|
102
105
|
end
|
103
|
-
end
|
106
|
+
end
|
@@ -25,79 +25,82 @@
|
|
25
25
|
|
26
26
|
require 'spec_helper'
|
27
27
|
|
28
|
-
|
28
|
+
module Mokio
|
29
29
|
|
30
|
-
describe
|
31
|
-
before(:each) do
|
32
|
-
@gallery = PicGallery.new
|
33
|
-
end
|
30
|
+
describe PicGallery do
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
describe 'defaults' do
|
33
|
+
before(:each) do
|
34
|
+
@gallery = PicGallery.new
|
35
|
+
end
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
it 'has PicGallery type' do
|
38
|
+
@gallery.type.should == "Mokio::PicGallery"
|
39
|
+
end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
it 'is editable' do
|
47
|
-
@gallery.editable.should == true
|
48
|
-
end
|
41
|
+
it 'is invalid without title' do
|
42
|
+
@gallery.should_not be_valid
|
43
|
+
end
|
49
44
|
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
#
|
46
|
+
# default added PicGallery have to have this values
|
47
|
+
#
|
48
|
+
it 'is editable' do
|
49
|
+
@gallery.editable.should == true
|
50
|
+
end
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
52
|
+
it 'is deletable' do
|
53
|
+
@gallery.deletable.should == true
|
54
|
+
end
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
#
|
63
|
-
it 'is Content child' do
|
64
|
-
expect(subject).to be_a_kind_of Content
|
56
|
+
it 'is active' do
|
57
|
+
@gallery.active.should == true
|
58
|
+
end
|
65
59
|
end
|
66
60
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
61
|
+
describe 'associations and inheritance' do
|
62
|
+
#
|
63
|
+
# PicGallery < Content
|
64
|
+
#
|
65
|
+
it 'is Content child' do
|
66
|
+
expect(subject).to be_a_kind_of Content
|
67
|
+
end
|
71
68
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
it "should have many data_files" do
|
70
|
+
association = PicGallery.reflect_on_association(:data_files)
|
71
|
+
association.macro.should == :has_many
|
72
|
+
end
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
74
|
+
it "should have many menus" do
|
75
|
+
association = PicGallery.reflect_on_association(:menus)
|
76
|
+
association.macro.should == :has_many
|
77
|
+
end
|
82
78
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
79
|
+
it "should have many content_links" do
|
80
|
+
association = PicGallery.reflect_on_association(:content_links)
|
81
|
+
association.macro.should == :has_many
|
82
|
+
end
|
83
|
+
end
|
88
84
|
|
89
|
-
|
90
|
-
|
91
|
-
gallery
|
92
|
-
gallery.
|
93
|
-
gallery.save!
|
94
|
-
expect(DataFile).to have(1).records
|
85
|
+
it 'has default_data_file saved as model reference' do
|
86
|
+
gallery = PicGallery.new
|
87
|
+
gallery.default_data_file.should_not == "Photo"
|
88
|
+
gallery.default_data_file.should == Photo
|
95
89
|
end
|
96
90
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
91
|
+
describe 'data_files' do
|
92
|
+
it 'saves association with data_file' do
|
93
|
+
gallery = PicGallery.new(:title => "test")
|
94
|
+
gallery.data_files.build(data_file: "test.png", name: "Test")
|
95
|
+
gallery.save!
|
96
|
+
expect(DataFile).to have(1).records
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'does not save association without data_file' do
|
100
|
+
content = PicGallery.new(:title => "test")
|
101
|
+
content.save!
|
102
|
+
expect(DataFile).to have(0).records
|
103
|
+
end
|
101
104
|
end
|
102
105
|
end
|
103
|
-
end
|
106
|
+
end
|
@@ -12,102 +12,86 @@
|
|
12
12
|
|
13
13
|
require 'spec_helper'
|
14
14
|
|
15
|
-
|
15
|
+
module Mokio
|
16
16
|
|
17
|
-
|
18
|
-
@menu = FactoryGirl.create(:menu)
|
19
|
-
@position = FactoryGirl.create(:module_position)
|
20
|
-
@static_module = FactoryGirl.create(:static_module, :module_position_ids => [@position.id])
|
21
|
-
end
|
17
|
+
describe SelectedModule do
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
expect(@menu.available_modules.size).to eq(1)
|
29
|
-
end
|
19
|
+
before(:each) do
|
20
|
+
@menu = FactoryGirl.create(:menu)
|
21
|
+
@position = FactoryGirl.create(:module_position)
|
22
|
+
@static_module = FactoryGirl.create(:static_module, :module_position_ids => [@position.id])
|
23
|
+
end
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
it "adds properly new selected module to men" do
|
26
|
+
av_mod = AvailableModule.first #?
|
27
|
+
@menu.available_modules << av_mod
|
28
|
+
@menu.save
|
29
|
+
expect(SelectedModule).to have(1).records
|
30
|
+
expect(@menu.available_modules.size).to eq(1)
|
31
|
+
end
|
38
32
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
it "removes properly selected module from menu" do
|
34
|
+
av_mod = AvailableModule.first
|
35
|
+
@menu.available_modules.delete(av_mod)
|
36
|
+
@menu.save
|
37
|
+
expect(SelectedModule).to have(0).records
|
38
|
+
expect(@menu.available_modules.size).to eq(0)
|
39
|
+
end
|
45
40
|
|
46
|
-
# it "saves parent" do
|
47
|
-
# @parent = Menu.create!(:name => "Parent")
|
48
|
-
# Menu.create!(:name => "Child", :parent => Menu.create!(:name => "Parent"))
|
49
|
-
# @parent = Menu.where(:name => "Parent").first
|
50
|
-
# @child = Menu.where(:name => "Child").first
|
51
|
-
# expect(@parent.children.include?(@child))
|
52
|
-
# end
|
53
|
-
# it "validates presence of name" do
|
54
|
-
# @menu = Menu.new(:name => "", :id => -1)
|
55
|
-
# @menu.should_not be_valid
|
56
|
-
# end
|
57
41
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# end
|
64
|
-
# @menu.errors.should_not be_empty
|
65
|
-
|
66
|
-
# end
|
42
|
+
it "counts only records that match a query" do
|
43
|
+
FactoryGirl.create(:menu, :name => "Uuups")
|
44
|
+
expect(Menu.where(:name => "Uuups")).to have(1).record
|
45
|
+
expect(Menu.where(:name => "Eeeee")).to have(0).records
|
46
|
+
end
|
67
47
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
48
|
+
it "saves parent" do
|
49
|
+
@parent = FactoryGirl.create(:menu, :name => "Parent")
|
50
|
+
FactoryGirl.create(:menu, :name => "Child", :parent => @parent)
|
51
|
+
@parent = Menu.where(:name => "Parent").first
|
52
|
+
@child = Menu.where(:name => "Child").first
|
53
|
+
expect(@parent.children.include?(@child))
|
54
|
+
end
|
55
|
+
it "validates presence of name" do
|
56
|
+
@menu = Menu.new(:name => "", :id => -1)
|
57
|
+
@menu.should_not be_valid
|
58
|
+
end
|
74
59
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
# end
|
83
|
-
# @menu.errors.should_not be_empty
|
84
|
-
|
85
|
-
# end
|
60
|
+
it "saves error for empty name" do
|
61
|
+
@menu = Menu.new(:name => "", :id => -1)
|
62
|
+
begin
|
63
|
+
@menu.save
|
64
|
+
rescue
|
65
|
+
end
|
66
|
+
@menu.errors.should_not be_empty
|
86
67
|
|
87
|
-
|
88
|
-
# @menu = Menu.new(:name => "Child777", :parent_id => 1, :lang_id => 1)
|
89
|
-
# @content = Content.new(:title => "Art")
|
90
|
-
# @content.save
|
91
|
-
# @menu.contents << @content
|
92
|
-
# @menu.save
|
93
|
-
# @menu1 = Menu.find(@menu.id)
|
94
|
-
# @menu1.contents.size.should eq(1)
|
95
|
-
# @menu1.contents[0].title.should eq("Art")
|
96
|
-
# end
|
68
|
+
end
|
97
69
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
70
|
+
it "has many contents" do
|
71
|
+
@menu = Menu.new(:name => "Child777", :parent_id => 1, :lang_id => 1)
|
72
|
+
@content = Content.new(:title => "Art")
|
73
|
+
@content.save
|
74
|
+
@menu.contents << @content
|
75
|
+
@menu.save
|
76
|
+
@menu1 = Menu.find(@menu.id)
|
77
|
+
@menu1.contents.size.should eq(1)
|
78
|
+
@menu1.contents[0].title.should eq("Art")
|
79
|
+
end
|
104
80
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
81
|
+
# describe 'has and belongs to many contents' do
|
82
|
+
|
83
|
+
# it 'reflect on association' do
|
84
|
+
# menu = Menu.reflect_on_association(:contents)
|
85
|
+
# menu.macro.should == :has_many
|
86
|
+
# end
|
87
|
+
|
88
|
+
# it 'properly saves contents for menu' do
|
89
|
+
# @content = FactoryGirl.create(:content)
|
90
|
+
# @menu = FactoryGirl.create(:menu, :content_ids => [@content.id])
|
91
|
+
# @menu.reload
|
92
|
+
# @menu.contents.count.should eq(1)
|
93
|
+
# @content.menus.count.should eq(1)
|
94
|
+
# end
|
95
|
+
# end
|
96
|
+
end
|
97
|
+
end
|