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
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Mokio
|
4
|
+
|
5
|
+
describe Mokio::PicGalleriesController do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@routes = Mokio::Engine.routes
|
9
|
+
end
|
10
|
+
|
11
|
+
# This should return the minimal set of attributes required to create a valid
|
12
|
+
# Article. As you add validations to Article, be sure to
|
13
|
+
# adjust the attributes here as well.
|
14
|
+
let(:valid_attributes) { { :title => "MyString"} }
|
15
|
+
|
16
|
+
# This should return the minimal set of values that should be in the session
|
17
|
+
# in order to pass any filters (e.g. authentication) defined in
|
18
|
+
# ArticlesController. Be sure to keep this updated too.
|
19
|
+
let(:valid_session) { { } }
|
20
|
+
|
21
|
+
# describe "GET index" do
|
22
|
+
# it "assigns all articles as @article" do
|
23
|
+
# article = Article.all
|
24
|
+
# get :index, {}, valid_session
|
25
|
+
# assigns(:pic_gallery).should eq(article)
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
|
29
|
+
describe 'GET new' do
|
30
|
+
before(:each) do
|
31
|
+
get :new
|
32
|
+
end
|
33
|
+
|
34
|
+
it "assigns a new pic_gallery as @pic_gallery" do
|
35
|
+
assigns(:pic_gallery).should be_a_new(PicGallery)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'POST create' do
|
40
|
+
describe "with valid params" do
|
41
|
+
it "creates a new PicGallery" do
|
42
|
+
expect {
|
43
|
+
post :create, {:pic_gallery => valid_attributes, :save_and_new => 1}, valid_session
|
44
|
+
}.to change(PicGallery, :count).by(1)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "assigns a newly created pic_gallery as @pic_gallery" do
|
48
|
+
post :create, {:pic_gallery => valid_attributes, :save_and_new => 1}, valid_session
|
49
|
+
assigns(:pic_gallery).should be_a(PicGallery)
|
50
|
+
assigns(:pic_gallery).should be_persisted
|
51
|
+
end
|
52
|
+
|
53
|
+
it "redirects to the index" do
|
54
|
+
post :create, {:pic_gallery => valid_attributes}, valid_session
|
55
|
+
response.should redirect_to(edit_content_path(assigns(:pic_gallery).id))
|
56
|
+
end
|
57
|
+
|
58
|
+
it "has type param = 'PicGallery'" do
|
59
|
+
post :create, {:pic_gallery => valid_attributes, :save_and_new => 1 }, valid_session
|
60
|
+
assigns(:pic_gallery).type.should == "Mokio::PicGallery"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "with invalid params" do
|
65
|
+
it "assigns a newly created but unsaved article as @pic_gallery" do
|
66
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
67
|
+
Article.any_instance.stub(:save).and_return(false)
|
68
|
+
post :create, {:pic_gallery => { "title" => "" }, :save_and_new => 1}, valid_session
|
69
|
+
assigns(:pic_gallery).should be_a_new(PicGallery)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "re-renders the 'new' template" do
|
73
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
74
|
+
Article.any_instance.stub(:save).and_return(false)
|
75
|
+
post :create, {:pic_gallery => { "title" => "" }, :save_and_new => 1}, valid_session
|
76
|
+
response.should render_template("new")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "PUT update" do
|
82
|
+
describe "with valid params" do
|
83
|
+
it "updates the requested article" do
|
84
|
+
gallery = PicGallery.create! valid_attributes
|
85
|
+
# Assuming there are no other articles in the database, this
|
86
|
+
# specifies that the Article created on the previous line
|
87
|
+
# receives the :update_attributes message with whatever params are
|
88
|
+
# submitted in the request.
|
89
|
+
PicGallery.any_instance.should_receive(:update).with({ "title" => "MyString" })
|
90
|
+
put :update, {:id => gallery.to_param, :pic_gallery => { "title" => "MyString" }, :save_and_new => 1}, valid_session
|
91
|
+
end
|
92
|
+
|
93
|
+
it "assigns the requested article as @article" do
|
94
|
+
gallery = PicGallery.create! valid_attributes
|
95
|
+
put :update, {:id => gallery.to_param, :pic_gallery => valid_attributes, :save_and_new => 1}, valid_session
|
96
|
+
assigns(:pic_gallery).should eq(gallery)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "redirects to the index" do
|
100
|
+
gallery = PicGallery.create! valid_attributes
|
101
|
+
put :update, {:id => gallery.to_param, :pic_gallery => valid_attributes}, valid_session
|
102
|
+
response.should redirect_to(pic_galleries_path)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "with invalid params" do
|
107
|
+
it "assigns the article as @article" do
|
108
|
+
gallery = PicGallery.create! valid_attributes
|
109
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
110
|
+
PicGallery.any_instance.stub(:save).and_return(false)
|
111
|
+
put :update, {:id => gallery.to_param, :pic_gallery => { "title" => "" }, :save_and_new => 1}, valid_session
|
112
|
+
assigns(:pic_gallery).should eq(gallery)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "re-renders the 'edit' template" do
|
116
|
+
gallery = PicGallery.create! valid_attributes
|
117
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
118
|
+
PicGallery.any_instance.stub(:save).and_return(false)
|
119
|
+
put :update, {:id => gallery.to_param, :pic_gallery => { "title" => "" }, :save_and_new => 1}, valid_session
|
120
|
+
response.should render_template("edit")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
6
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
7
|
+
# was generated by Rails when you ran the scaffold generator.
|
8
|
+
#
|
9
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
10
|
+
# generator. If you are using any extension libraries to generate different
|
11
|
+
# controller code, this generated spec may or may not pass.
|
12
|
+
#
|
13
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
14
|
+
# of tools you can use to make these specs even more expressive, but we're
|
15
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
16
|
+
#
|
17
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
18
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
19
|
+
# is no simpler way to get a handle on the object needed for the example.
|
20
|
+
# Message expectations are only used when there is no simpler way to specify
|
21
|
+
# that an instance is receiving a specific message.
|
22
|
+
|
23
|
+
module Mokio
|
24
|
+
|
25
|
+
describe Mokio::StaticModulesController do
|
26
|
+
|
27
|
+
before(:each) do
|
28
|
+
@routes = Mokio::Engine.routes
|
29
|
+
end
|
30
|
+
|
31
|
+
# This should return the minimal set of attributes required to create a valid
|
32
|
+
# StaticModule. As you add validations to StaticModule, be sure to
|
33
|
+
# adjust the attributes here as well.
|
34
|
+
let(:valid_attributes) { { :title => "tytuł" } }
|
35
|
+
|
36
|
+
# This should return the minimal set of values that should be in the session
|
37
|
+
# in order to pass any filters (e.g. authentication) defined in
|
38
|
+
# StaticModulesController. Be sure to keep this updated too.
|
39
|
+
let(:valid_session) { { "title" => "test" } }
|
40
|
+
|
41
|
+
# describe "GET index" do
|
42
|
+
# it "assigns all static_modules as @static_modules" do
|
43
|
+
# static_module = StaticModule.create! valid_attributes
|
44
|
+
# get :index, {}, valid_session
|
45
|
+
# assigns(:static_module).should eq([static_module])
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
|
49
|
+
before :each do
|
50
|
+
request.env["HTTP_REFERER"] = static_modules_path
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
describe "GET new" do
|
55
|
+
it "assigns a new static_module as @static_module" do
|
56
|
+
get :new, {}, valid_session
|
57
|
+
assigns(:static_module).should be_a_new(StaticModule)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "GET edit" do
|
62
|
+
it "assigns the requested static_module as @static_module" do
|
63
|
+
static_module = StaticModule.create! valid_attributes
|
64
|
+
get :edit, {:id => static_module.to_param}, valid_session
|
65
|
+
assigns(:static_module).should eq(static_module)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "POST create" do
|
70
|
+
describe "with valid params" do
|
71
|
+
it "creates a new StaticModule" do
|
72
|
+
expect {
|
73
|
+
post :create, {:static_module => valid_attributes, :save_and_new => 1}, valid_session
|
74
|
+
}.to change(StaticModule, :count).by(1)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "assigns a newly created static_module as @static_module" do
|
78
|
+
post :create, {:static_module => valid_attributes, :save_and_new => 1}, valid_session
|
79
|
+
assigns(:static_module).should be_a(StaticModule)
|
80
|
+
assigns(:static_module).should be_persisted
|
81
|
+
end
|
82
|
+
|
83
|
+
it "redirects to index" do
|
84
|
+
post :create, {:static_module => valid_attributes}, valid_session
|
85
|
+
response.should redirect_to(static_modules_url)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "with invalid params" do
|
90
|
+
it "assigns a newly created but unsaved static_module as @static_module" do
|
91
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
92
|
+
StaticModule.any_instance.stub(:save).and_return(false)
|
93
|
+
post :create, {:static_module => { }, :save_and_new => 1}, valid_session
|
94
|
+
assigns(:static_module).should be_a_new(StaticModule)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "re-renders the 'new' template" do
|
98
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
99
|
+
StaticModule.any_instance.stub(:save).and_return(false)
|
100
|
+
post :create, {:static_module => { }, :save_and_new => 1}, valid_session
|
101
|
+
response.should render_template("new")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "PUT update" do
|
107
|
+
describe "with valid params" do
|
108
|
+
it "updates the requested static_module" do
|
109
|
+
static_module = StaticModule.create! valid_attributes
|
110
|
+
# Assuming there are no other static_modules in the database, this
|
111
|
+
# specifies that the StaticModule created on the previous line
|
112
|
+
# receives the :update_attributes message with whatever params are
|
113
|
+
# submitted in the request.
|
114
|
+
StaticModule.any_instance.should_receive(:update).with(valid_session)
|
115
|
+
put :update, {:id => static_module.to_param, :static_module => valid_session, :save_and_new => 1}, valid_session
|
116
|
+
end
|
117
|
+
|
118
|
+
it "assigns the requested static_module as @static_module" do
|
119
|
+
static_module = StaticModule.create! valid_attributes
|
120
|
+
put :update, {:id => static_module.to_param, :static_module => valid_attributes, :save_and_new => 1}, valid_session
|
121
|
+
assigns(:static_module).should eq(static_module)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "redirects to index" do
|
125
|
+
static_module = StaticModule.create! valid_attributes
|
126
|
+
put :update, {:id => static_module.to_param, :static_module => valid_attributes}, valid_session
|
127
|
+
response.should redirect_to(static_modules_url)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe "with invalid params" do
|
132
|
+
it "assigns the static_module as @static_module" do
|
133
|
+
static_module = StaticModule.create! valid_attributes
|
134
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
135
|
+
StaticModule.any_instance.stub(:save).and_return(false)
|
136
|
+
put :update, {:id => static_module.to_param, :static_module => { }, :save_and_new => 1}, valid_session
|
137
|
+
assigns(:static_module).should eq(static_module)
|
138
|
+
end
|
139
|
+
|
140
|
+
it "re-renders the 'edit' template" do
|
141
|
+
static_module = StaticModule.create! valid_attributes
|
142
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
143
|
+
StaticModule.any_instance.stub(:save).and_return(false)
|
144
|
+
put :update, {:id => static_module.to_param, :static_module => { }, :save_and_new => 1}, valid_session
|
145
|
+
response.should render_template("edit")
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe "DELETE destroy" do
|
151
|
+
it "destroys the requested static_module" do
|
152
|
+
static_module = StaticModule.create! valid_attributes
|
153
|
+
expect {
|
154
|
+
delete :destroy, {:id => static_module.to_param}, valid_session
|
155
|
+
}.to change(StaticModule, :count).by(-1)
|
156
|
+
end
|
157
|
+
|
158
|
+
it "redirects to the static_modules list" do
|
159
|
+
static_module = StaticModule.create! valid_attributes
|
160
|
+
delete :destroy, {:id => static_module.to_param}, valid_session
|
161
|
+
response.should redirect_to(static_modules_url)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
end
|
@@ -2,7 +2,7 @@ require 'faker'
|
|
2
2
|
|
3
3
|
FactoryGirl.define do
|
4
4
|
|
5
|
-
factory :content, traits: [:with_intro_and_content] do
|
5
|
+
factory :content, traits: [:with_intro_and_content], :class=> Mokio::Content do
|
6
6
|
title Faker::Lorem.word
|
7
7
|
display_from '2013-12-02'
|
8
8
|
display_to '2013-12-31'
|
@@ -77,30 +77,30 @@ FactoryGirl.define do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
factory :article do
|
80
|
-
type 'Article'
|
80
|
+
type 'Mokio::Article'
|
81
81
|
end
|
82
82
|
|
83
83
|
factory :article_non_active do
|
84
|
-
type 'Article'
|
84
|
+
type 'Mokio::Article'
|
85
85
|
active false
|
86
86
|
end
|
87
87
|
|
88
88
|
factory :article_non_displayed do
|
89
|
-
type 'Article'
|
89
|
+
type 'Mokio::Article'
|
90
90
|
display_from '2011-12-12'
|
91
91
|
display_to '2011-12-25'
|
92
92
|
end
|
93
93
|
|
94
94
|
|
95
95
|
factory :article_displayed_and_active do
|
96
|
-
type 'Article'
|
96
|
+
type 'Mokio::Article'
|
97
97
|
display_from nil
|
98
98
|
display_to nil
|
99
99
|
active true
|
100
100
|
end
|
101
101
|
|
102
102
|
factory :pic_gallery do
|
103
|
-
type 'PicGallery'
|
103
|
+
type 'Mokio::PicGallery'
|
104
104
|
gallery_type 'pic'
|
105
105
|
|
106
106
|
factory :home_page_pic_gallery, traits: [:home_page]
|
@@ -109,7 +109,7 @@ FactoryGirl.define do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
factory :mov_gallery do
|
112
|
-
type 'MovGallery'
|
112
|
+
type 'Mokio::MovGallery'
|
113
113
|
gallery_type 'mov'
|
114
114
|
|
115
115
|
factory :home_page_mov_gallery, traits: [:home_page]
|
@@ -119,7 +119,7 @@ FactoryGirl.define do
|
|
119
119
|
|
120
120
|
factory :contact do
|
121
121
|
contact true
|
122
|
-
type '
|
122
|
+
type 'Mokio::Contact'
|
123
123
|
|
124
124
|
factory :not_editable_contact, traits: [:not_editable]
|
125
125
|
factory :not_deletable_contact, traits: [:not_deletable]
|
data/spec/factories/gmaps.rb
CHANGED
data/spec/factories/langs.rb
CHANGED
data/spec/factories/meta.rb
CHANGED
@@ -2,7 +2,7 @@ require 'faker'
|
|
2
2
|
|
3
3
|
FactoryGirl.define do
|
4
4
|
|
5
|
-
factory :static_module, traits: [:with_intro_and_content] do
|
5
|
+
factory :static_module, traits: [:with_intro_and_content], :class => Mokio::StaticModule do
|
6
6
|
title Faker::Lorem.word
|
7
7
|
display_from '2013-12-02'
|
8
8
|
display_to '2013-12-31'
|
@@ -22,7 +22,7 @@ FactoryGirl.define do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
factory :module_position do
|
25
|
+
factory :module_position, :class => Mokio::ModulePosition do
|
26
26
|
name Faker::Lorem.word
|
27
27
|
end
|
28
28
|
end
|
data/spec/factories/users.rb
CHANGED