adminpanel 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/Gemfile +7 -7
- data/Rakefile +20 -4
- data/adminpanel.gemspec +7 -7
- data/app/controllers/adminpanel/categories_controller.rb +1 -5
- data/app/controllers/adminpanel/galleries_controller.rb +13 -18
- data/app/controllers/concerns/adminpanel/facebook_actions.rb +26 -18
- data/app/controllers/concerns/adminpanel/rest_actions.rb +8 -3
- data/app/helpers/adminpanel/router_helper.rb +4 -0
- data/app/models/adminpanel/section.rb +4 -4
- data/app/views/adminpanel/sessions/new.html.erb +1 -1
- data/app/views/layouts/_top_bar.html.erb +24 -2
- data/app/views/layouts/admin-login.html.erb +1 -2
- data/app/views/shared/fb_choose_page.html.erb +3 -3
- data/app/views/shared/new.html.erb +24 -23
- data/config/locales/es.yml +8 -3
- data/config/routes.rb +8 -3
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/gallery/templates/gallery_migration.rb +1 -1
- data/lib/generators/adminpanel/resource/resource_generator.rb +2 -2
- data/{spec → test}/dummy/.gitignore +0 -1
- data/{spec → test}/dummy/README.rdoc +0 -0
- data/{spec → test}/dummy/Rakefile +0 -0
- data/{spec → test}/dummy/app/assets/images/hipster.jpg +0 -0
- data/{spec → test}/dummy/app/assets/images/test.jpg +0 -0
- data/{spec → test}/dummy/app/assets/javascripts/application.js +0 -0
- data/{spec → test}/dummy/app/assets/stylesheets/application.css +0 -0
- data/{spec → test}/dummy/app/controllers/adminpanel/.gitkeep +0 -0
- data/{spec → test}/dummy/app/controllers/adminpanel/mugs_controller.rb +0 -0
- data/{spec → test}/dummy/app/controllers/adminpanel/products_controller.rb +0 -0
- data/{spec → test}/dummy/app/controllers/adminpanel/salesmen_controller.rb +0 -0
- data/{spec → test}/dummy/app/controllers/application_controller.rb +0 -0
- data/{spec → test}/dummy/app/helpers/application_helper.rb +0 -0
- data/{spec → test}/dummy/app/mailers/.gitkeep +0 -0
- data/{spec → test}/dummy/app/models/.gitkeep +0 -0
- data/{spec → test}/dummy/app/models/ability.rb +0 -0
- data/{spec → test}/dummy/app/models/adminpanel/categorization.rb +0 -0
- data/{spec → test}/dummy/app/models/adminpanel/category.rb +0 -0
- data/{spec → test}/dummy/app/models/adminpanel/mug.rb +0 -0
- data/{spec → test}/dummy/app/models/adminpanel/photo.rb +0 -0
- data/{spec → test}/dummy/app/models/adminpanel/product.rb +0 -0
- data/{spec → test}/dummy/app/models/adminpanel/salesman.rb +0 -0
- data/{spec → test}/dummy/app/uploader/adminpanel/photo_uploader.rb +0 -0
- data/{spec → test}/dummy/app/uploader/adminpanel/section_uploader.rb +0 -0
- data/{spec → test}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{spec → test}/dummy/config.ru +0 -0
- data/{spec → test}/dummy/config/application.rb +0 -0
- data/{spec → test}/dummy/config/boot.rb +0 -0
- data/{spec/dummy/config/carrierwve.rb → test/dummy/config/carrierwave.rb} +1 -1
- data/{spec → test}/dummy/config/database.yml +0 -0
- data/{spec → test}/dummy/config/environment.rb +0 -0
- data/{spec → test}/dummy/config/environments/development.rb +0 -0
- data/{spec → test}/dummy/config/environments/production.rb +0 -0
- data/{spec → test}/dummy/config/environments/test.rb +2 -2
- data/{spec → test}/dummy/config/initializers/adminpanel_setup.rb +0 -0
- data/{spec → test}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{spec → test}/dummy/config/initializers/mime_types.rb +0 -0
- data/{spec → test}/dummy/config/initializers/session_store.rb +0 -0
- data/{spec → test}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{spec → test}/dummy/config/locales/.keep +0 -0
- data/{spec → test}/dummy/config/routes.rb +0 -0
- data/test/dummy/config/secrets.yml +2 -0
- data/{spec → test}/dummy/db/schema.rb +0 -0
- data/{spec → test}/dummy/lib/assets/.gitkeep +0 -0
- data/{spec → test}/dummy/public/404.html +0 -0
- data/{spec → test}/dummy/public/422.html +0 -0
- data/{spec → test}/dummy/public/500.html +0 -0
- data/{spec → test}/dummy/public/favicon.ico +0 -0
- data/{spec → test}/dummy/script/rails +0 -0
- data/test/dummy/test/fixtures/adminpanel/galleries.yml +15 -0
- data/test/dummy/test/fixtures/adminpanel/groups.yml +4 -0
- data/test/dummy/test/fixtures/adminpanel/users.yml +8 -0
- data/test/features/session/login_test.rb +33 -0
- data/test/features/shared/new_test.rb +39 -0
- data/test/models/adminpanel/gallery_test.rb +37 -0
- data/test/models/adminpanel/section_test.rb +53 -0
- data/test/models/adminpanel/user_test.rb +51 -0
- data/test/test_helper.rb +71 -0
- data/test/unit/gallery_unit_test.rb +21 -0
- metadata +212 -246
- data/spec/features/authentication_pages_spec.rb +0 -45
- data/spec/models/gallery_spec.rb +0 -24
- data/spec/models/section_spec.rb +0 -61
- data/spec/models/user_spec.rb +0 -94
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Authentication" do
|
4
|
-
|
5
|
-
subject { page }
|
6
|
-
|
7
|
-
describe 'sign in page' do
|
8
|
-
before { visit adminpanel.signin_path }
|
9
|
-
|
10
|
-
it { should have_content(I18n.t("authentication.welcome")) }
|
11
|
-
|
12
|
-
it { expect(page).to have_title(I18n.t("Panel title")) }
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'signin' do
|
16
|
-
before { visit adminpanel.signin_path }
|
17
|
-
|
18
|
-
describe 'with invalid information' do
|
19
|
-
before do
|
20
|
-
click_button 'signin-button'
|
21
|
-
end
|
22
|
-
|
23
|
-
it { expect(page).to have_title(I18n.t("Panel title")) }
|
24
|
-
it { should have_selector('div.alert.alert-error', :text => I18n.t('authentication.signin_error')) }
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'with valid information' do
|
28
|
-
let(:user) { FactoryGirl.build(:user) }
|
29
|
-
before do
|
30
|
-
valid_signin_as_admin(user)
|
31
|
-
end
|
32
|
-
|
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
|
-
|
36
|
-
describe 'signing out' do
|
37
|
-
before { click_link 'signout-button'}
|
38
|
-
|
39
|
-
it { current_path.should == adminpanel.signin_path }
|
40
|
-
it { expect(page).to have_title(I18n.t("Panel title")) }
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/spec/models/gallery_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
describe Adminpanel::Gallery do
|
6
|
-
before do
|
7
|
-
@gallery = Adminpanel::Gallery.new(
|
8
|
-
:file => "Test file"
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
subject { @gallery }
|
13
|
-
|
14
|
-
it { should respond_to(:file) }
|
15
|
-
|
16
|
-
describe "when file is not present" do
|
17
|
-
before {@gallery.file = " "}
|
18
|
-
it {should_not be_valid}
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "default scope" do
|
22
|
-
it { expect(Adminpanel::Gallery.all.to_sql).to eq Adminpanel::Gallery.reorder('').order('position ASC').to_sql}
|
23
|
-
end
|
24
|
-
end
|
data/spec/models/section_spec.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
|
4
|
-
describe Adminpanel::Section do
|
5
|
-
before do
|
6
|
-
@section = Adminpanel::Section.new(
|
7
|
-
:name => "Section name",
|
8
|
-
:description => "Test description for index",
|
9
|
-
:has_image => true,
|
10
|
-
:key => "example_key",
|
11
|
-
:has_description => true,
|
12
|
-
:page => "index"
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
subject { @section }
|
17
|
-
|
18
|
-
describe 'when key is telephone and has less than 10 chars' do
|
19
|
-
before do
|
20
|
-
@section.key = 'telephone'
|
21
|
-
@section.description = '1' * 9
|
22
|
-
end
|
23
|
-
it { @section.valid? eq false}
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'when key is telephone and has more than 10 chars' do
|
27
|
-
before do
|
28
|
-
@section.key = 'telephone'
|
29
|
-
@section.description = '1' * 11
|
30
|
-
end
|
31
|
-
it { @section.valid? eq false}
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "when key is telephone and has 10 chars" do
|
35
|
-
before do
|
36
|
-
@section.key = "telephone"
|
37
|
-
@section.description = "1" * 10
|
38
|
-
end
|
39
|
-
it { @section.valid? eq true}
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "when key is blank" do
|
44
|
-
before {@section.key = " "}
|
45
|
-
it { @section.valid? eq false}
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "when name is blank" do
|
49
|
-
before {@section.name = " "}
|
50
|
-
it { @section.valid? eq false}
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "when description is blank" do
|
54
|
-
before {@section.description = " "}
|
55
|
-
it { @section.valid? eq false}
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "default scope" do
|
59
|
-
it { expect(Adminpanel::Section.all.to_sql).to eq Adminpanel::Section.reorder('').order('page ASC').to_sql}
|
60
|
-
end
|
61
|
-
end
|
data/spec/models/user_spec.rb
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Adminpanel::User do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@user = Adminpanel::User.new(
|
7
|
-
:name => "Example User",
|
8
|
-
:email => "user@example.com",
|
9
|
-
:password => "foobar",
|
10
|
-
:password_confirmation => "foobar",
|
11
|
-
:group_id => get_admin_group.id
|
12
|
-
)
|
13
|
-
end
|
14
|
-
|
15
|
-
subject { @user }
|
16
|
-
|
17
|
-
it { should be_valid }
|
18
|
-
|
19
|
-
describe "when name is not present" do
|
20
|
-
before { @user.name = " " }
|
21
|
-
it { should_not be_valid }
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "when email is not present" do
|
25
|
-
before { @user.email = " " }
|
26
|
-
it { should_not be_valid }
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "when name is too long" do
|
30
|
-
before { @user.name = "a" * 51 }
|
31
|
-
it { should_not be_valid }
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "when email format is invalid" do
|
35
|
-
it "should be invalid" do
|
36
|
-
addresses = %w[user@foo,com user_at_foo.org example.user@foo.
|
37
|
-
foo@bar_baz.com foo@bar+baz.com]
|
38
|
-
addresses.each do |invalid_address|
|
39
|
-
@user.email = invalid_address
|
40
|
-
expect(@user).not_to be_valid
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "when email format is valid" do
|
46
|
-
it "should be valid" do
|
47
|
-
addresses = %w[user@foo.COM A_US-ER@f.b.org frst.lst@foo.jp a+b@baz.cn]
|
48
|
-
addresses.each do |valid_address|
|
49
|
-
@user.email = valid_address
|
50
|
-
expect(@user).to be_valid
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "when email address is already taken" do
|
56
|
-
before do
|
57
|
-
user_with_same_email = @user.dup
|
58
|
-
user_with_same_email.email = @user.email.upcase
|
59
|
-
user_with_same_email.save
|
60
|
-
end
|
61
|
-
|
62
|
-
it { should_not be_valid }
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "when password is not present" do
|
66
|
-
before do
|
67
|
-
@user = Adminpanel::User.new(name: "Example User", email: "user@example.com",
|
68
|
-
password: " ", password_confirmation: " ")
|
69
|
-
end
|
70
|
-
it { should_not be_valid }
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "when password doesn't match confirmation" do
|
74
|
-
before { @user.password_confirmation = "mismatch" }
|
75
|
-
it { should_not be_valid }
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "with a password that's too short" do
|
79
|
-
before { @user.password = @user.password_confirmation = "a" * 5 }
|
80
|
-
it { should be_invalid }
|
81
|
-
end
|
82
|
-
|
83
|
-
describe "return value of authenticate method" do
|
84
|
-
before { @user.save }
|
85
|
-
let(:found_user) {Adminpanel::User.find_by(email: @user.email) }
|
86
|
-
|
87
|
-
describe "with invalid password" do
|
88
|
-
let(:user_for_invalid_password) { found_user.authenticate("invalid") }
|
89
|
-
|
90
|
-
it { should_not eq user_for_invalid_password }
|
91
|
-
specify { expect(user_for_invalid_password).to be_false }
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|