adminpanel 1.2.12 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -4
- data/Gemfile +22 -20
- data/README.md +12 -9
- data/adminpanel.gemspec +29 -28
- data/app/assets/fonts/.keep +0 -0
- data/app/assets/javascripts/adminpanel/images_form.js +5 -2
- data/app/assets/javascripts/adminpanel/imagesloaded.js +5 -2
- data/app/assets/javascripts/adminpanel/tables.js +6 -3
- data/app/assets/javascripts/application-admin.js +2 -1
- data/app/assets/stylesheets/adminpanel/{_clearfix.css.scss → _clearfix.css} +0 -0
- data/app/assets/stylesheets/adminpanel/bootstrap.css +2 -2
- data/app/assets/stylesheets/adminpanel/medium-editor.css.scss +1 -1
- data/app/assets/stylesheets/application-admin.css +2 -1
- data/app/controllers/adminpanel/application_controller.rb +28 -21
- data/app/controllers/adminpanel/categories_controller.rb +16 -5
- data/app/controllers/adminpanel/galleries_controller.rb +11 -5
- data/app/controllers/adminpanel/sections_controller.rb +14 -0
- data/app/controllers/adminpanel/users_controller.rb +10 -80
- data/app/controllers/concerns/adminpanel/galleryzable_actions.rb +33 -0
- data/app/controllers/concerns/adminpanel/rest_actions.rb +109 -0
- data/app/helpers/adminpanel/application_helper.rb +0 -1
- data/app/helpers/adminpanel/custom_form_builder.rb +12 -13
- data/app/helpers/adminpanel/router_helper.rb +11 -2
- data/app/helpers/adminpanel/shared_pages_helper.rb +0 -1
- data/app/models/adminpanel/analytic.rb +3 -2
- data/app/models/adminpanel/gallery.rb +8 -4
- data/app/models/adminpanel/group.rb +1 -1
- data/app/models/adminpanel/image.rb +1 -2
- data/app/models/adminpanel/section.rb +19 -10
- data/app/models/adminpanel/user.rb +11 -3
- data/app/models/concerns/adminpanel/base.rb +149 -0
- data/app/models/concerns/adminpanel/galleryzation.rb +66 -0
- data/app/models/contact.rb +16 -9
- data/app/views/adminpanel/analytics/index.html.erb +2 -1
- data/app/views/adminpanel/categories/_categories_table.html.erb +6 -7
- data/app/views/adminpanel/categories/_category_form.html.erb +2 -2
- data/app/views/adminpanel/categories/create.js.erb +2 -2
- data/app/views/adminpanel/categories/index.html.erb +1 -1
- data/app/views/adminpanel/galleries/_galleries_table.html.erb +7 -7
- data/app/views/adminpanel/galleries/index.html.erb +6 -5
- data/app/views/adminpanel/sections/_sections_table.html.erb +2 -2
- data/app/views/adminpanel/sections/edit.html.erb +5 -3
- data/app/views/adminpanel/sections/show.html.erb +3 -3
- data/app/views/adminpanel/sessions/new.html.erb +1 -1
- data/app/views/layouts/_side_menu.html.erb +2 -2
- data/app/views/layouts/_top_bar.html.erb +3 -3
- data/app/views/layouts/admin-login.html.erb +0 -1
- data/app/views/layouts/admin.html.erb +3 -3
- data/app/views/shared/_delete_icon_button.html.erb +16 -0
- data/app/views/shared/_edit_icon_button.html.erb +14 -0
- data/app/views/shared/_error_messages.html.erb +1 -1
- data/app/views/shared/_form_fields.html.erb +15 -13
- data/app/views/shared/_gallery_entries.html.erb +2 -2
- data/app/views/shared/_init_editor.html.erb +5 -2
- data/app/views/shared/_new_resource_button.html.erb +18 -0
- data/app/views/shared/_remote_form_fields.html.erb +1 -1
- data/app/views/shared/_show_icon_button.html.erb +14 -0
- data/app/views/shared/edit.html.erb +3 -3
- data/app/views/shared/index.html.erb +13 -48
- data/app/views/shared/new.html.erb +3 -3
- data/app/views/shared/show.html.erb +5 -5
- data/config/initializers/pluralization_es.rb +16 -0
- data/config/locales/en.yml +89 -0
- data/config/locales/es.yml +4 -4
- data/config/routes.rb +15 -16
- data/lib/adminpanel.rb +8 -8
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/gallery/gallery_generator.rb +12 -8
- data/lib/generators/adminpanel/gallery/templates/gallery_template.rb +2 -3
- data/lib/generators/adminpanel/initialize/templates/category_template.rb +2 -3
- data/lib/generators/adminpanel/resource/resource_generator.rb +24 -18
- data/lib/generators/adminpanel/resource/templates/controller.rb +5 -0
- data/lib/generators/adminpanel/resource/templates/resource.rb +3 -3
- data/lib/tasks/adminpanel/adminpanel.rake +43 -90
- data/spec/dummy/app/controllers/adminpanel/mugs_controller.rb +9 -0
- data/spec/dummy/app/controllers/adminpanel/products_controller.rb +12 -0
- data/spec/dummy/app/models/ability.rb +1 -1
- data/spec/dummy/app/models/adminpanel/categorization.rb +1 -2
- data/spec/dummy/app/models/adminpanel/category.rb +18 -19
- data/spec/dummy/app/models/adminpanel/mug.rb +37 -0
- data/spec/dummy/app/models/adminpanel/photo.rb +3 -3
- data/spec/dummy/app/models/adminpanel/product.rb +2 -2
- data/spec/dummy/config/application.rb +2 -11
- data/spec/dummy/config/database.yml +0 -6
- data/spec/dummy/config/environments/development.rb +11 -23
- data/spec/dummy/config/environments/production.rb +40 -32
- data/spec/dummy/config/environments/test.rb +13 -18
- data/spec/dummy/config/initializers/adminpanel_setup.rb +2 -1
- data/spec/dummy/config/locales/.keep +0 -0
- data/spec/dummy/db/schema.rb +68 -2
- data/spec/features/authentication_pages_spec.rb +15 -15
- data/spec/features/galleries_pages_spec.rb +30 -22
- data/spec/features/section_pages_spec.rb +15 -18
- data/spec/features/shared_pages_spec.rb +97 -127
- data/spec/generators/gallery_generator_spec.rb +2 -3
- data/spec/generators/resource_generator_spec.rb +20 -3
- data/spec/models/gallery_spec.rb +2 -2
- data/spec/models/section_spec.rb +8 -15
- data/spec/models/user_spec.rb +23 -39
- data/spec/spec_helper.rb +9 -1
- data/spec/support/factories.rb +52 -0
- data/spec/support/helper_methods.rb +25 -5
- data/spec/tasks/adminpanel_rake_spec.rb +11 -10
- metadata +361 -353
- data/app/assets/fonts/FontAwesome.otf +0 -0
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +0 -255
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/stylesheets/adminpanel/colorpicker.css +0 -7
- data/app/assets/stylesheets/adminpanel/elfinder.min.css +0 -59
- data/app/assets/stylesheets/adminpanel/font-awesome.min.css +0 -34
- data/app/helpers/adminpanel/pluralizations_helper.rb +0 -25
- data/app/helpers/adminpanel/rest_actions_helper.rb +0 -128
- data/app/views/adminpanel/galleries/delete.html.erb +0 -2
- data/app/views/adminpanel/galleries/edit.html.erb +0 -19
- data/app/views/adminpanel/galleries/new.html.erb +0 -18
- data/app/views/adminpanel/galleries/show.html.erb +0 -18
- data/app/views/adminpanel/galleries/update.html.erb +0 -2
- data/lib/adminpanel/active_record/adminpanel_extension.rb +0 -187
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/support/define_factory_models.rb +0 -45
- data/spec/support/submit_forms_without_button.rb +0 -17
- data/spec/support/test_database.rb +0 -76
- data/spec/uploaders/gallery_uploader_spec.rb +0 -37
- data/spec/uploaders/image_uploader_spec.rb +0 -31
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'support/test_database'
|
3
2
|
|
4
3
|
describe "Authentication" do
|
5
4
|
|
6
|
-
|
5
|
+
subject { page }
|
7
6
|
|
8
|
-
describe
|
7
|
+
describe 'sign in page' do
|
9
8
|
before { visit adminpanel.signin_path }
|
10
9
|
|
11
10
|
it { should have_content(I18n.t("authentication.welcome")) }
|
@@ -13,28 +12,29 @@ describe "Authentication" do
|
|
13
12
|
it { expect(page).to have_title(I18n.t("Panel title")) }
|
14
13
|
end
|
15
14
|
|
16
|
-
describe
|
15
|
+
describe 'signin' do
|
17
16
|
before { visit adminpanel.signin_path }
|
18
17
|
|
19
|
-
describe
|
20
|
-
|
18
|
+
describe 'with invalid information' do
|
19
|
+
before do
|
20
|
+
click_button 'signin-button'
|
21
|
+
end
|
21
22
|
|
22
23
|
it { expect(page).to have_title(I18n.t("Panel title")) }
|
23
|
-
|
24
|
-
it { should have_selector('div.alert.alert-error', :text => I18n.t("authentication.signin_error")) }
|
24
|
+
it { should have_selector('div.alert.alert-error', :text => I18n.t('authentication.signin_error')) }
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
28
|
-
let(:user) {
|
27
|
+
describe 'with valid information' do
|
28
|
+
let(:user) { FactoryGirl.build(:user) }
|
29
29
|
before do
|
30
|
-
|
30
|
+
valid_signin_as_admin(user)
|
31
31
|
end
|
32
32
|
|
33
|
-
it { should have_selector('div.alert.alert-success', :text => I18n.t(
|
34
|
-
it { should have_selector('i.
|
33
|
+
it { should have_selector('div.alert.alert-success', :text => I18n.t('authentication.signin_success')) }
|
34
|
+
it { should have_selector('i.fa-power-off') }
|
35
35
|
|
36
|
-
describe
|
37
|
-
before { click_link
|
36
|
+
describe 'signing out' do
|
37
|
+
before { click_link 'signout-button'}
|
38
38
|
|
39
39
|
it { current_path.should == adminpanel.signin_path }
|
40
40
|
it { expect(page).to have_title(I18n.t("Panel title")) }
|
@@ -1,41 +1,50 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'support/test_database'
|
3
2
|
|
3
|
+
describe 'Gallery pages' do
|
4
|
+
let(:gallery) { FactoryGirl.build(:gallery) }
|
5
|
+
let(:user) { FactoryGirl.build(:user) }
|
4
6
|
|
5
|
-
|
6
|
-
subject {page}
|
7
|
+
subject { page }
|
7
8
|
|
8
|
-
let(:user) { Factory(:user) }
|
9
9
|
before do
|
10
|
+
gallery.save
|
10
11
|
visit adminpanel.signin_path
|
11
|
-
|
12
|
+
valid_signin_as_admin(user)
|
12
13
|
clean_uploads_folder
|
13
14
|
end
|
14
15
|
|
15
|
-
describe
|
16
|
-
let(:gallery) { Factory(:gallery) }
|
16
|
+
describe 'galleries' do
|
17
17
|
before do
|
18
18
|
visit adminpanel.galleries_path
|
19
19
|
end
|
20
20
|
|
21
|
-
it { should have_link(I18n.t(
|
22
|
-
it { should have_link(
|
23
|
-
it { should have_link(
|
24
|
-
it { should have_link(
|
25
|
-
it { should have_link(
|
21
|
+
it { should have_link(I18n.t('gallery.new'), adminpanel.new_gallery_path)}
|
22
|
+
it { should have_link('i', adminpanel.gallery_path(gallery)) }
|
23
|
+
it { should have_link('i', adminpanel.edit_gallery_path(gallery)) }
|
24
|
+
it { should have_link('i', adminpanel.move_to_better_gallery_path(gallery)) }
|
25
|
+
it { should have_link('i', adminpanel.move_to_worst_gallery_path(gallery)) }
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
context 'when creating' do
|
29
|
+
let(:gallery_1) { FactoryGirl.build(:gallery) }
|
30
|
+
let(:gallery_2) { FactoryGirl.build(:gallery) }
|
31
|
+
let(:gallery_3) { FactoryGirl.build(:gallery) }
|
32
|
+
|
33
|
+
before do
|
34
|
+
Adminpanel::Gallery.delete_all
|
35
|
+
gallery_1.save
|
32
36
|
end
|
33
37
|
|
34
|
-
describe
|
35
|
-
|
36
|
-
|
37
|
-
let!(:gallery_3) { Factory(:gallery) }
|
38
|
+
describe 'a single image' do
|
39
|
+
it { gallery_1.position.should eq 1 }
|
40
|
+
end
|
38
41
|
|
42
|
+
describe '3 images' do
|
43
|
+
|
44
|
+
before do
|
45
|
+
gallery_2.save
|
46
|
+
gallery_3.save
|
47
|
+
end
|
39
48
|
it { gallery_2.position.should eq 2 }
|
40
49
|
it { gallery_3.position.should eq 3 }
|
41
50
|
describe "when moving down the image in position 1" do
|
@@ -92,11 +101,10 @@ describe "Gallery pages" do
|
|
92
101
|
end
|
93
102
|
|
94
103
|
describe "show" do
|
95
|
-
let(:gallery) { Factory(:gallery) }
|
96
104
|
before do
|
97
105
|
visit adminpanel.gallery_path(gallery)
|
98
106
|
end
|
99
107
|
|
100
|
-
it { page.should have_selector("img
|
108
|
+
it { page.should have_selector("img[src='#{gallery.file_url(:thumb)}']") }
|
101
109
|
end
|
102
110
|
end
|
@@ -1,39 +1,36 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'support/test_database'
|
3
2
|
|
4
|
-
describe "Section pages" do
|
5
|
-
subject {page}
|
6
3
|
|
7
|
-
|
4
|
+
describe 'Section pages' do
|
5
|
+
subject { page }
|
6
|
+
|
7
|
+
let(:user) { get_user }
|
8
8
|
before do
|
9
|
+
Adminpanel::Section.delete_all
|
9
10
|
visit adminpanel.signin_path
|
10
|
-
|
11
|
+
valid_signin_as_admin(user)
|
11
12
|
end
|
12
13
|
|
13
|
-
describe
|
14
|
-
let(:section) {
|
14
|
+
describe 'index' do
|
15
|
+
let!(:section) { FactoryGirl.create(:section_with_gallery) }
|
15
16
|
before do
|
16
17
|
visit adminpanel.sections_path
|
17
18
|
end
|
18
19
|
|
19
|
-
it { should have_link(
|
20
|
-
it { should have_link(
|
20
|
+
it { should have_link('i', adminpanel.section_path(section)) }
|
21
|
+
it { should have_link('i', adminpanel.edit_section_path(section)) }
|
21
22
|
end
|
22
23
|
|
23
|
-
describe
|
24
|
-
describe
|
25
|
-
let(:section) {
|
26
|
-
let(:image) { Factory(:image_section, :section_id => section.id) }
|
27
|
-
# let(:image2) { Factory(:image_section, :foreign_key => section.id) }
|
28
|
-
# let(:image3) { Factory(:image_section, :foreign_key => section.id) }
|
24
|
+
describe 'show' do
|
25
|
+
describe 'with gallery' do
|
26
|
+
let(:section) { FactoryGirl.create(:section_with_gallery) }
|
29
27
|
|
30
28
|
before do
|
31
29
|
visit adminpanel.section_path(section)
|
32
30
|
end
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
it { should have_link("i", adminpanel.edit_section_path(section)) }
|
32
|
+
it { should have_content(section.description) }
|
33
|
+
it { should have_link('i', adminpanel.edit_section_path(section)) }
|
37
34
|
end
|
38
35
|
end
|
39
36
|
end
|
@@ -1,158 +1,128 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'support/test_database'
|
3
2
|
|
4
|
-
describe '
|
3
|
+
describe 'Shared pages' do
|
5
4
|
subject { page }
|
6
5
|
|
7
|
-
|
6
|
+
|
7
|
+
let(:user) { get_user }
|
8
|
+
let!(:product) { FactoryGirl.create(:product) }
|
9
|
+
let!(:category){ FactoryGirl.create(:category) }
|
10
|
+
let!(:photo) { FactoryGirl.create(:photo) }
|
11
|
+
let!(:mug) { FactoryGirl.create(:mug) }
|
12
|
+
|
8
13
|
before do
|
14
|
+
Adminpanel::User.delete_all
|
9
15
|
visit adminpanel.signin_path
|
10
|
-
|
16
|
+
valid_signin_as_admin(user)
|
11
17
|
end
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
before do
|
17
|
-
visit adminpanel.products_path
|
18
|
-
end
|
19
|
+
after do
|
20
|
+
Adminpanel::User.delete_all
|
21
|
+
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
describe 'mugs#index excluding every rest action but index' do
|
24
|
+
before do
|
25
|
+
visit adminpanel.mugs_path
|
23
26
|
end
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
it { should have_title(I18n.t("action.create") + " " + Adminpanel::Product.display_name) }
|
35
|
-
|
36
|
-
it 'should have add remote category button' do
|
37
|
-
should have_selector(
|
38
|
-
'a.btn-info',
|
39
|
-
:text => I18n.t(
|
40
|
-
'other.add',
|
41
|
-
:model => Adminpanel::Category.display_name
|
42
|
-
)
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
describe 'submtting with invalid information' do
|
47
|
-
before do
|
48
|
-
find("form#new_resource").submit_form!
|
49
|
-
end
|
50
|
-
|
51
|
-
it { should have_title(I18n.t("action.create") + " " + Adminpanel::Product.display_name) }
|
52
|
-
it { should have_selector("div#alerts") }
|
53
|
-
end
|
54
|
-
|
55
|
-
# describe 'opening the remote form modal' do
|
56
|
-
# before do
|
57
|
-
# page.find("a##{Adminpanel::Category.name.demodulize.downcase}-modal-link").click
|
58
|
-
# end
|
59
|
-
#
|
60
|
-
# it 'should have modal with correct #modal-title' do
|
61
|
-
# page.should have_selector(
|
62
|
-
# :css,
|
63
|
-
# 'h3#modal-title',
|
64
|
-
# :content => I18n.t('other.add', :model => Adminpanel::Category.display_name)
|
65
|
-
# )
|
66
|
-
# end
|
67
|
-
#
|
68
|
-
# it 'should have the modal with the correct fields' do
|
69
|
-
# should have_selector("input#category_name")
|
70
|
-
# end
|
71
|
-
|
72
|
-
# describe 'sending the resource remotely with invalid information' do
|
73
|
-
# before do
|
74
|
-
# find('#new-Category-button').click
|
75
|
-
# end
|
76
|
-
# it 'should display error message' do
|
77
|
-
# page.should have_selector("div#alerts")
|
78
|
-
# end
|
79
|
-
# end
|
80
|
-
|
81
|
-
# end
|
82
|
-
|
83
|
-
describe 'submitting with valid information' do
|
84
|
-
before do
|
85
|
-
fill_in "product_name", :with => "product name"
|
86
|
-
fill_in "product_price", :with => "855.5"
|
87
|
-
find(:css, "#product_category_ids_[value='1']").set(true)
|
88
|
-
find(:xpath, "//input[@id='description-field']").set "<p>a little longer text</p>"
|
89
|
-
find("form#new_resource").submit_form!
|
90
|
-
end
|
91
|
-
|
92
|
-
it { should have_content(I18n.t("action.save_success"))}
|
93
|
-
it { Adminpanel::Categorization.count.should equal(1)}
|
94
|
-
end
|
95
|
-
end
|
28
|
+
it 'should not have create mug button' do
|
29
|
+
should_not have_link('a', href:'/adminpanel/tazas/new')
|
30
|
+
end
|
31
|
+
it 'should not have show or destroy button' do
|
32
|
+
should_not have_link('a', href:'/adminpanel/tazas/1')
|
33
|
+
end
|
34
|
+
it 'should not have edit button' do
|
35
|
+
should_not have_link('a', href:'/adminpanel/tazas/1/edit')
|
96
36
|
end
|
37
|
+
end
|
97
38
|
|
98
|
-
describe "edit" do
|
99
|
-
let(:category){ Factory(:category) }
|
100
|
-
let(:product){ Factory(:product) }
|
101
39
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
40
|
+
describe 'index' do
|
41
|
+
before do
|
42
|
+
visit adminpanel.products_path
|
43
|
+
end
|
107
44
|
|
108
|
-
|
45
|
+
it { should have_link(Adminpanel::Product.display_name, adminpanel.new_product_path)}
|
46
|
+
it { should have_link('i', adminpanel.product_path(product)) }
|
47
|
+
it { should have_link('i', adminpanel.edit_product_path(product)) }
|
48
|
+
end
|
109
49
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
find("form#edit_resource").submit_form!
|
115
|
-
end
|
50
|
+
describe 'new' do
|
51
|
+
before do
|
52
|
+
visit adminpanel.new_product_path
|
53
|
+
end
|
116
54
|
|
117
|
-
|
118
|
-
|
119
|
-
|
55
|
+
it 'should have add remote category button' do
|
56
|
+
should have_selector(
|
57
|
+
'a.btn-info',
|
58
|
+
:text => I18n.t(
|
59
|
+
'other.add',
|
60
|
+
:model => Adminpanel::Category.display_name
|
61
|
+
)
|
62
|
+
)
|
63
|
+
end
|
120
64
|
|
121
|
-
describe "with same information" do
|
122
|
-
before do
|
123
|
-
find("form#edit_resource").submit_form!
|
124
|
-
end
|
125
65
|
|
126
|
-
|
66
|
+
describe 'submtting with invalid information' do
|
67
|
+
before do
|
68
|
+
find("#new-Product-button").click
|
127
69
|
end
|
128
70
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
fill_in "product_name", :with => "product name"
|
133
|
-
fill_in "product_price", :with => "855.5"
|
134
|
-
find(:xpath, "//input[@id='description-field']").set "<p>a little longer text</p>"
|
135
|
-
find("form#edit_resource").submit_form!
|
136
|
-
end
|
137
|
-
|
138
|
-
it { should have_content(I18n.t("action.save_success"))}
|
71
|
+
it { should have_title(I18n.t("action.create") + " " + Adminpanel::Product.display_name) }
|
72
|
+
it 'should stay in products#new' do
|
73
|
+
current_url.should eq adminpanel.new_product_url
|
139
74
|
end
|
140
75
|
end
|
141
76
|
|
142
|
-
describe
|
143
|
-
|
144
|
-
|
77
|
+
# describe 'submitting with valid information' do
|
78
|
+
# before do
|
79
|
+
# fill_in "product_name", :with => "product name"
|
80
|
+
# fill_in "product_price", :with => "855.5"
|
81
|
+
# find(:css, "#product_category_ids_[value='1']").set(true)
|
82
|
+
# find(:xpath, "//input[@id='description-field']").set "<p>a little longer text</p>"
|
83
|
+
# find("#new-Product-button").click
|
84
|
+
# end
|
85
|
+
#
|
86
|
+
# # it { should have_content(I18n.t("action.save_success"))}
|
87
|
+
# # it { expect(Adminpanel::Categorization.count).to eq(1)}
|
88
|
+
# end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "edit" do
|
92
|
+
|
93
|
+
before do
|
94
|
+
product.category_ids = [category.id]
|
95
|
+
visit adminpanel.edit_product_path(product)
|
96
|
+
end
|
97
|
+
|
98
|
+
it { should have_title(I18n.t("action.update") + " " + Adminpanel::Product.display_name) }
|
145
99
|
|
100
|
+
describe "with invalid information" do
|
146
101
|
before do
|
147
|
-
|
148
|
-
|
102
|
+
fill_in "product_name", :with => ""
|
103
|
+
fill_in "product_price", :with => ""
|
104
|
+
find("#new-resource-button").click
|
149
105
|
end
|
150
106
|
|
151
|
-
it
|
152
|
-
|
153
|
-
|
154
|
-
it { should
|
155
|
-
|
107
|
+
it 'should stay to products#edit' do
|
108
|
+
current_url.should eq adminpanel.edit_product_url(product)
|
109
|
+
end
|
110
|
+
it { should have_title(I18n.t("action.update") + " " + Adminpanel::Product.display_name) }
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
describe 'show' do
|
116
|
+
|
117
|
+
before do
|
118
|
+
photo.product_id = product.id
|
119
|
+
visit adminpanel.product_path(product)
|
156
120
|
end
|
121
|
+
|
122
|
+
it { page.should have_selector('div', :text => product.name) }
|
123
|
+
it { page.should have_selector('div', :text => product.price) }
|
124
|
+
it { page.should have_selector('div', :text => product.description) }
|
125
|
+
it { should have_content("#{I18n.t("Gallery")}: #{Adminpanel::Product.display_name}")}
|
126
|
+
it { should have_link('i', adminpanel.edit_product_path(product)) }
|
157
127
|
end
|
158
128
|
end
|