web_admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +32 -0
- data/Gemfile.lock +335 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +22 -0
- data/app/assets/images/web_admin/.keep +0 -0
- data/app/assets/images/web_admin/avatar.jpg +0 -0
- data/app/assets/images/web_admin/first_icon.png +0 -0
- data/app/assets/images/web_admin/render-1-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-1.jpg +0 -0
- data/app/assets/images/web_admin/render-2-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-2.jpg +0 -0
- data/app/assets/images/web_admin/render-3-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-3.jpg +0 -0
- data/app/assets/images/web_admin/render-4-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-4.jpg +0 -0
- data/app/assets/images/web_admin/responsive.png +0 -0
- data/app/assets/javascripts/web_admin/app.data.js +336 -0
- data/app/assets/javascripts/web_admin/app.js +172 -0
- data/app/assets/javascripts/web_admin/app.plugin.js +220 -0
- data/app/assets/javascripts/web_admin/application.js +20 -0
- data/app/assets/javascripts/web_admin/bootstrap-filestyle.min.js +1 -0
- data/app/assets/javascripts/web_admin/bootstrap.js +1951 -0
- data/app/assets/javascripts/web_admin/charts/easypiechart/jquery.easy-pie-chart.js +184 -0
- data/app/assets/javascripts/web_admin/charts/sparkline/jquery.sparkline.min.js +5 -0
- data/app/assets/javascripts/web_admin/combodate/combodate.js +453 -0
- data/app/assets/javascripts/web_admin/combodate/moment.min.js +6 -0
- data/app/assets/javascripts/web_admin/data/datagrid.json +1900 -0
- data/app/assets/javascripts/web_admin/data/datatable.json +401 -0
- data/app/assets/javascripts/web_admin/datatables/jquery.dataTables.min.js +155 -0
- data/app/assets/javascripts/web_admin/datepicker/bootstrap-datepicker.js +474 -0
- data/app/assets/javascripts/web_admin/datepicker.js +3 -0
- data/app/assets/javascripts/web_admin/fuelux/fuelux.js +1645 -0
- data/app/assets/javascripts/web_admin/fullcalendar/fullcalendar.min.js +7 -0
- data/app/assets/javascripts/web_admin/grid/gallery.js +14 -0
- data/app/assets/javascripts/web_admin/grid/jquery.grid-a-licious.min.js +15 -0
- data/app/assets/javascripts/web_admin/grid/masonry.pkgd.min.js +9 -0
- data/app/assets/javascripts/web_admin/ie/excanvas.js +924 -0
- data/app/assets/javascripts/web_admin/ie/html5.js +9 -0
- data/app/assets/javascripts/web_admin/ie/respond.min.js +6 -0
- data/app/assets/javascripts/web_admin/jquery-ui-1.10.3.custom.min.js +6 -0
- data/app/assets/javascripts/web_admin/jquery.datetimepicker.js +1851 -0
- data/app/assets/javascripts/web_admin/jquery.ui.touch-punch.min.js +11 -0
- data/app/assets/javascripts/web_admin/parsley/parsley.min.js +35 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/default_thumb.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/loader.gif +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_next.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_prev.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_x.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_y.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/jquery.prettyPhoto.js +7 -0
- data/app/assets/javascripts/web_admin/prettyphoto/prettyPhoto.css +170 -0
- data/app/assets/javascripts/web_admin/select2/select2.css +652 -0
- data/app/assets/javascripts/web_admin/select2/select2.min.js +22 -0
- data/app/assets/javascripts/web_admin/slider/bootstrap-slider.js +388 -0
- data/app/assets/javascripts/web_admin/underscore-min.js +7 -0
- data/app/assets/javascripts/web_admin/underscore-min.map +1 -0
- data/app/assets/javascripts/web_admin/upload_image.js +39 -0
- data/app/assets/stylesheets/web_admin/application.css +15 -0
- data/app/assets/stylesheets/web_admin/bootstrap.css +5784 -0
- data/app/assets/stylesheets/web_admin/font-awesome.min.css +4 -0
- data/app/assets/stylesheets/web_admin/font.css +18 -0
- data/app/assets/stylesheets/web_admin/fonts/FontAwesome.otf +0 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.svg +414 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-bold-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-light-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/landing.css +272 -0
- data/app/assets/stylesheets/web_admin/plugin.css +1132 -0
- data/app/assets/stylesheets/web_admin/style.css +613 -0
- data/app/assets/stylesheets/web_admin/style2.css +21 -0
- data/app/controllers/web_admin/albums_controller.rb +8 -0
- data/app/controllers/web_admin/application_controller.rb +10 -0
- data/app/controllers/web_admin/crud_controller.rb +61 -0
- data/app/controllers/web_admin/events_controller.rb +9 -0
- data/app/controllers/web_admin/images_controller.rb +8 -0
- data/app/controllers/web_admin/institutionals_controller.rb +8 -0
- data/app/controllers/web_admin/main_controller.rb +7 -0
- data/app/controllers/web_admin/posts_controller.rb +19 -0
- data/app/controllers/web_admin/users_controller.rb +15 -0
- data/app/controllers/web_admin/videos_controller.rb +8 -0
- data/app/enumerations/web_admin/permission_type.rb +5 -0
- data/app/enumerations/web_admin/user_type.rb +6 -0
- data/app/helpers/web_admin/application_helper.rb +20 -0
- data/app/models/ability.rb +14 -0
- data/app/models/ckeditor/asset.rb +7 -0
- data/app/models/ckeditor/attachment_file.rb +7 -0
- data/app/models/ckeditor/picture.rb +7 -0
- data/app/models/web_admin/album.rb +13 -0
- data/app/models/web_admin/event.rb +20 -0
- data/app/models/web_admin/image.rb +10 -0
- data/app/models/web_admin/institutional.rb +11 -0
- data/app/models/web_admin/permission.rb +9 -0
- data/app/models/web_admin/post.rb +14 -0
- data/app/models/web_admin/user.rb +25 -0
- data/app/models/web_admin/video.rb +17 -0
- data/app/uploaders/ckeditor_attachment_file_uploader.rb +36 -0
- data/app/uploaders/ckeditor_picture_uploader.rb +47 -0
- data/app/uploaders/web_admin/image_post_uploader.rb +55 -0
- data/app/uploaders/web_admin/image_uploader.rb +52 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +29 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +16 -0
- data/app/views/devise/shared/_links.html.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/layouts/web_admin/devise.html.erb +42 -0
- data/app/views/shared/403.html +57 -0
- data/app/views/shared/_header.html.erb +16 -0
- data/app/views/shared/_navbar.html.erb +23 -0
- data/app/views/shared/_notice.html.erb +12 -0
- data/app/views/web_admin/albums/_form.html.erb +23 -0
- data/app/views/web_admin/albums/edit.html.erb +4 -0
- data/app/views/web_admin/albums/index.html.erb +39 -0
- data/app/views/web_admin/albums/new.html.erb +4 -0
- data/app/views/web_admin/albums/show.html.erb +4 -0
- data/app/views/web_admin/events/_form.html.erb +37 -0
- data/app/views/web_admin/events/edit.html.erb +4 -0
- data/app/views/web_admin/events/index.html.erb +39 -0
- data/app/views/web_admin/events/new.html.erb +4 -0
- data/app/views/web_admin/images/_form.html.erb +23 -0
- data/app/views/web_admin/images/_images.html.erb +10 -0
- data/app/views/web_admin/images/create.js.erb +2 -0
- data/app/views/web_admin/images/update.js.erb +2 -0
- data/app/views/web_admin/institutionals/_form.html.erb +22 -0
- data/app/views/web_admin/institutionals/edit.html.erb +4 -0
- data/app/views/web_admin/institutionals/index.html.erb +35 -0
- data/app/views/web_admin/institutionals/new.html.erb +4 -0
- data/app/views/web_admin/layouts/application.html.erb +77 -0
- data/app/views/web_admin/main/index.html.erb +1 -0
- data/app/views/web_admin/posts/_form.html.erb +27 -0
- data/app/views/web_admin/posts/edit.html.erb +4 -0
- data/app/views/web_admin/posts/index.html.erb +37 -0
- data/app/views/web_admin/posts/new.html.erb +4 -0
- data/app/views/web_admin/users/_form.html.erb +49 -0
- data/app/views/web_admin/users/edit.html.erb +4 -0
- data/app/views/web_admin/users/index.html.erb +35 -0
- data/app/views/web_admin/users/new.html.erb +4 -0
- data/app/views/web_admin/videos/_form.html.erb +22 -0
- data/app/views/web_admin/videos/edit.html.erb +4 -0
- data/app/views/web_admin/videos/index.html.erb +37 -0
- data/app/views/web_admin/videos/new.html.erb +4 -0
- data/bin/rails +12 -0
- data/config/initializers/ckeditor.rb +39 -0
- data/config/initializers/devise.rb +261 -0
- data/config/initializers/enumerate_it.rb +1 -0
- data/config/initializers/simple_form.rb +145 -0
- data/config/initializers/simple_form_bootstrap.rb +46 -0
- data/config/locales/buttons.yml +3 -0
- data/config/locales/controllers.yml +9 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/devise.pt.yml +62 -0
- data/config/locales/models.yml +54 -0
- data/config/locales/rails.yml +219 -0
- data/config/locales/responders.yml +10 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20141023223026_devise_create_admin_web_users.rb +42 -0
- data/db/migrate/20141023223656_create_admin_web_posts.rb +15 -0
- data/db/migrate/20141026181117_create_ckeditor_assets.rb +26 -0
- data/db/migrate/20141028020102_create_admin_web_institutionals.rb +10 -0
- data/db/migrate/20141028135201_create_admin_web_videos.rb +10 -0
- data/db/migrate/20141114020551_create_admin_web_albums.rb +12 -0
- data/db/migrate/20141117183405_create_admin_web_images.rb +11 -0
- data/db/migrate/20141130203155_add_user_type_to_users.rb +5 -0
- data/db/migrate/20141224221959_create_admin_web_events.rb +18 -0
- data/db/migrate/20150130140502_create_admin_web_permissions.rb +13 -0
- data/db/migrate/20150510191213_rename_tables.rb +12 -0
- data/lib/application_responder.rb +12 -0
- data/lib/tasks/web_admin_tasks.rake +4 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/lib/web_admin/engine.rb +15 -0
- data/lib/web_admin/version.rb +3 -0
- data/lib/web_admin.rb +18 -0
- data/spec/factories/admin_web_users.rb +24 -0
- data/spec/features/admin_web/albums_spec.rb +74 -0
- data/spec/features/admin_web/event_spec.rb +85 -0
- data/spec/features/admin_web/institutionals_spec.rb +47 -0
- data/spec/features/admin_web/login_spec.rb +18 -0
- data/spec/features/admin_web/permissions_spec.rb +40 -0
- data/spec/features/admin_web/posts_spec.rb +55 -0
- data/spec/features/admin_web/users_spec.rb +73 -0
- data/spec/features/admin_web/videos_spec.rb +51 -0
- data/spec/fixtures/p3-single.jpg +0 -0
- data/spec/models/admin_web/album_spec.rb +20 -0
- data/spec/models/admin_web/event_spec.rb +42 -0
- data/spec/models/admin_web/image_spec.rb +14 -0
- data/spec/models/admin_web/institutional_spec.rb +19 -0
- data/spec/models/admin_web/permission_spec.rb +14 -0
- data/spec/models/admin_web/post_spec.rb +25 -0
- data/spec/models/admin_web/user_spec.rb +18 -0
- data/spec/models/admin_web/video_spec.rb +26 -0
- data/spec/rails_helper.rb +52 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/capybara.rb +53 -0
- data/spec/support/database_cleaner.rb +25 -0
- data/spec/support/devise.rb +5 -0
- data/spec/support/factory_girl.rb +4 -0
- data/spec/support/helpers.rb +82 -0
- data/spec/support/shared_connection.rb +10 -0
- data/spec/test_app/README.rdoc +28 -0
- data/spec/test_app/Rakefile +6 -0
- data/spec/test_app/app/assets/images/.keep +0 -0
- data/spec/test_app/app/assets/javascripts/application.js +13 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/controllers/application_controller.rb +5 -0
- data/spec/test_app/app/controllers/concerns/.keep +0 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/mailers/.keep +0 -0
- data/spec/test_app/app/models/.keep +0 -0
- data/spec/test_app/app/models/concerns/.keep +0 -0
- data/spec/test_app/app/views/layouts/application.html.erb +14 -0
- data/spec/test_app/bin/bundle +3 -0
- data/spec/test_app/bin/rails +4 -0
- data/spec/test_app/bin/rake +4 -0
- data/spec/test_app/config/application.rb +29 -0
- data/spec/test_app/config/boot.rb +5 -0
- data/spec/test_app/config/database.yml +85 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +37 -0
- data/spec/test_app/config/environments/production.rb +78 -0
- data/spec/test_app/config/environments/test.rb +39 -0
- data/spec/test_app/config/initializers/assets.rb +8 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/test_app/config/initializers/cookies_serializer.rb +3 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/test_app/config/initializers/inflections.rb +16 -0
- data/spec/test_app/config/initializers/mime_types.rb +4 -0
- data/spec/test_app/config/initializers/session_store.rb +3 -0
- data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/test_app/config/locales/en.yml +23 -0
- data/spec/test_app/config/routes.rb +4 -0
- data/spec/test_app/config/secrets.yml +22 -0
- data/spec/test_app/config.ru +4 -0
- data/spec/test_app/db/schema.rb +121 -0
- data/spec/test_app/lib/assets/.keep +0 -0
- data/spec/test_app/log/.keep +0 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/spec/factories/admin_web_albums.rb +7 -0
- data/spec/test_app/spec/factories/admin_web_users.rb +24 -0
- data/spec/test_app/spec/factories/permissions.rb +36 -0
- data/web_admin.gemspec +38 -0
- data/wercker.yml +16 -0
- metadata +530 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateAdminWebPermissions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :admin_web_permissions do |t|
|
4
|
+
t.references :user
|
5
|
+
t.string :model
|
6
|
+
t.string :permission_type
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :admin_web_permissions, :user_id
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class RenameTables < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
rename_table :admin_web_albums, :web_admin_albums
|
4
|
+
rename_table :admin_web_users, :web_admin_users
|
5
|
+
rename_table :admin_web_posts, :web_admin_posts
|
6
|
+
rename_table :admin_web_institutionals, :web_admin_institutionals
|
7
|
+
rename_table :admin_web_videos, :web_admin_videos
|
8
|
+
rename_table :admin_web_images, :web_admin_images
|
9
|
+
rename_table :admin_web_events, :web_admin_events
|
10
|
+
rename_table :admin_web_permissions, :web_admin_permissions
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class ApplicationResponder < ActionController::Responder
|
2
|
+
include Responders::FlashResponder
|
3
|
+
include Responders::HttpCacheResponder
|
4
|
+
|
5
|
+
# Redirects resources to the collection path (index action) instead
|
6
|
+
# of the resource path (show action) for POST/PUT/DELETE requests.
|
7
|
+
include Responders::CollectionResponder
|
8
|
+
|
9
|
+
# Allows to use a callable object as the redirect location with respond_with,
|
10
|
+
# eg a route that requires persisted objects when the validation may fail.
|
11
|
+
# include Responders::LocationResponder
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="form-inputs">
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
+
<%- end -%>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-actions">
|
11
|
+
<%%= f.button :submit %>
|
12
|
+
</div>
|
13
|
+
<%% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module WebAdmin
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace WebAdmin
|
4
|
+
|
5
|
+
config.generators do |g|
|
6
|
+
g.test_framework :rspec
|
7
|
+
g.fixture_replacement :factory_girl, :dir => '../factories'
|
8
|
+
end
|
9
|
+
|
10
|
+
initializer("web_admin.locales") do |app|
|
11
|
+
WebAdmin::Engine.config.i18n.load_path += Dir[Rails.root.join('../../config/locales/', '*.{rb,yml}').to_s]
|
12
|
+
WebAdmin::Engine.config.i18n.default_locale = 'pt-BR'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/web_admin.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'devise'
|
2
|
+
require 'simple_form'
|
3
|
+
require 'ckeditor'
|
4
|
+
require 'carrierwave'
|
5
|
+
require 'i18n_alchemy'
|
6
|
+
require 'jquery-fileupload-rails'
|
7
|
+
require 'enumerate_it'
|
8
|
+
require 'cancan'
|
9
|
+
require 'responders'
|
10
|
+
require "web_admin/engine"
|
11
|
+
|
12
|
+
module WebAdmin
|
13
|
+
class Engine < ::Rails::Engine
|
14
|
+
config.to_prepare do
|
15
|
+
Devise::SessionsController.layout "web_admin/devise"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :web_admin_user, :class => 'WebAdmin::User' do
|
3
|
+
email "user@email.com"
|
4
|
+
password "12345678"
|
5
|
+
password_confirmation "12345678"
|
6
|
+
|
7
|
+
factory :web_admin_user_with_permission do
|
8
|
+
transient do
|
9
|
+
permissions_count 1
|
10
|
+
end
|
11
|
+
|
12
|
+
after(:create) do |user, evaluator|
|
13
|
+
create_list(:manager_user, evaluator.permissions_count, user: user)
|
14
|
+
create_list(:manager_video, evaluator.permissions_count, user: user)
|
15
|
+
create_list(:manager_post, evaluator.permissions_count, user: user)
|
16
|
+
create_list(:manager_album, evaluator.permissions_count, user: user)
|
17
|
+
create_list(:manager_image, evaluator.permissions_count, user: user)
|
18
|
+
create_list(:manager_insitutional, evaluator.permissions_count, user: user)
|
19
|
+
create_list(:manager_event, evaluator.permissions_count, user: user)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature WebAdmin::Album do
|
4
|
+
background do
|
5
|
+
sign_in
|
6
|
+
end
|
7
|
+
|
8
|
+
scenario "create, update and destroy a institucional" do
|
9
|
+
click_link 'Álbuns'
|
10
|
+
|
11
|
+
expect(page).to have_content 'Cadastro de álbuns'
|
12
|
+
|
13
|
+
click_link 'Novo'
|
14
|
+
|
15
|
+
fill_in 'Título', with: "Álbum 1"
|
16
|
+
fill_in 'Local', with: "Local Álbum 1"
|
17
|
+
fill_in 'Data', with: I18n.l(Date.current)
|
18
|
+
|
19
|
+
click_button 'Salvar'
|
20
|
+
|
21
|
+
expect(page).to have_content "Álbum criado(a) com sucesso"
|
22
|
+
|
23
|
+
expect(page).to have_content "Álbum 1"
|
24
|
+
expect(page).to have_content "Local Álbum 1"
|
25
|
+
expect(page).to have_content I18n.l(Date.current)
|
26
|
+
|
27
|
+
click_link 'Álbum 1'
|
28
|
+
|
29
|
+
expect(page).to have_field "Título", with: "Álbum 1"
|
30
|
+
expect(page).to have_field "Local", with: "Local Álbum 1"
|
31
|
+
expect(page).to have_field "Data", with: I18n.l(Date.current)
|
32
|
+
|
33
|
+
fill_in 'Título', with: "Alterando o álbum 1"
|
34
|
+
fill_in 'Local', with: "Alterando o Local Álbum 1"
|
35
|
+
fill_in 'Data', with: I18n.l(Date.current + 3.day)
|
36
|
+
|
37
|
+
click_button "Salvar"
|
38
|
+
|
39
|
+
expect(page).to have_content "Álbum editado(a) com sucesso"
|
40
|
+
|
41
|
+
expect(page).to have_content "Alterando o álbum 1"
|
42
|
+
expect(page).to have_content "Alterando o Local Álbum 1"
|
43
|
+
expect(page).to have_content I18n.l(Date.current + 3.day)
|
44
|
+
|
45
|
+
click_link 'Alterando o álbum 1'
|
46
|
+
|
47
|
+
expect(page).to have_field "Título", with: "Alterando o álbum 1"
|
48
|
+
expect(page).to have_field "Local", with: "Alterando o Local Álbum 1"
|
49
|
+
expect(page).to have_field "Data", with: I18n.l(Date.current + 3.day)
|
50
|
+
|
51
|
+
click_link 'Apagar'
|
52
|
+
|
53
|
+
expect(page).to have_content "Álbum apagado(a) com sucesso"
|
54
|
+
end
|
55
|
+
|
56
|
+
scenario 'add images to album' do
|
57
|
+
create(:web_admin_album)
|
58
|
+
|
59
|
+
click_link 'Álbuns'
|
60
|
+
|
61
|
+
click_link 'Álbum 1'
|
62
|
+
|
63
|
+
expect(page).to have_field "Título", with: "Álbum 1"
|
64
|
+
expect(page).to have_field "Local", with: "Local album 1"
|
65
|
+
expect(page).to have_field "Data", with: I18n.l(Date.current)
|
66
|
+
|
67
|
+
click_link 'Adicionar imagens'
|
68
|
+
|
69
|
+
attach_file('Selecione o(s) arquivo(s)', "spec/fixtures/p3-single.jpg")
|
70
|
+
|
71
|
+
expect(page).to have_no_checked_field 'cover'
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature WebAdmin::Event do
|
4
|
+
background do
|
5
|
+
sign_in
|
6
|
+
end
|
7
|
+
|
8
|
+
scenario "create, update and destroy a event" do
|
9
|
+
click_link 'Eventos'
|
10
|
+
|
11
|
+
expect(page).to have_content 'Cadastro de eventos'
|
12
|
+
|
13
|
+
click_link 'Novo'
|
14
|
+
|
15
|
+
fill_in 'Título', with: "Evento 1"
|
16
|
+
fill_in 'Início às', with: '30/01/2015 21:00'
|
17
|
+
fill_in 'Término às', with: '31/01/2015 00:00'
|
18
|
+
fill_in 'Descrição', with: 'Descrição do evento 1'
|
19
|
+
fill_in 'CEP', with: '64000-128'
|
20
|
+
fill_in 'Logradouro', with: 'Rua João Damasceno'
|
21
|
+
fill_in 'Número', with: '3201'
|
22
|
+
fill_in 'Bairro', with: 'Planalto Ininga'
|
23
|
+
fill_in 'Cidade', with: 'Teresina'
|
24
|
+
fill_in 'Estado', with: 'Piauí'
|
25
|
+
|
26
|
+
click_button 'Salvar'
|
27
|
+
|
28
|
+
expect(page).to have_content "Evento criado(a) com sucesso"
|
29
|
+
|
30
|
+
expect(page).to have_content "Evento 1"
|
31
|
+
expect(page).to have_content "30/01/2015 21:00"
|
32
|
+
expect(page).to have_content "31/01/2015 00:00"
|
33
|
+
expect(page).to have_content I18n.l(Date.current)
|
34
|
+
|
35
|
+
click_link 'Evento 1'
|
36
|
+
|
37
|
+
expect(page).to have_field 'Título', with: "Evento 1"
|
38
|
+
expect(page).to have_field 'Início às', with: '30/01/2015 21:00'
|
39
|
+
expect(page).to have_field 'Término às', with: '31/01/2015 00:00'
|
40
|
+
expect(page).to have_field 'Descrição', with: 'Descrição do evento 1'
|
41
|
+
expect(page).to have_field 'CEP', with: '64000-128'
|
42
|
+
expect(page).to have_field 'Logradouro', with: 'Rua João Damasceno'
|
43
|
+
expect(page).to have_field 'Número', with: '3201'
|
44
|
+
expect(page).to have_field 'Bairro', with: 'Planalto Ininga'
|
45
|
+
expect(page).to have_field 'Cidade', with: 'Teresina'
|
46
|
+
expect(page).to have_field 'Estado', with: 'Piauí'
|
47
|
+
|
48
|
+
fill_in 'Título', with: "Alterando Evento 1"
|
49
|
+
fill_in 'Início às', with: '01/02/2015 21:00'
|
50
|
+
fill_in 'Término às', with: '02/02/2015 00:00'
|
51
|
+
fill_in 'Descrição', with: 'Alterando Descrição do evento 1'
|
52
|
+
fill_in 'CEP', with: '64000-128'
|
53
|
+
fill_in 'Logradouro', with: 'Rua Magalhães Filho'
|
54
|
+
fill_in 'Número', with: '712'
|
55
|
+
fill_in 'Bairro', with: 'Centro/Sul'
|
56
|
+
fill_in 'Cidade', with: 'Teresina'
|
57
|
+
fill_in 'Estado', with: 'Piauí'
|
58
|
+
|
59
|
+
click_button "Salvar"
|
60
|
+
|
61
|
+
expect(page).to have_content "Evento editado(a) com sucesso"
|
62
|
+
|
63
|
+
expect(page).to have_content "Alterando Evento 1"
|
64
|
+
expect(page).to have_content "01/02/2015 21:00"
|
65
|
+
expect(page).to have_content "02/02/2015 00:00"
|
66
|
+
expect(page).to have_content I18n.l(Date.current)
|
67
|
+
|
68
|
+
click_link 'Alterando Evento 1'
|
69
|
+
|
70
|
+
expect(page).to have_field 'Título', with: "Alterando Evento 1"
|
71
|
+
expect(page).to have_field 'Início às', with: '01/02/2015 21:00'
|
72
|
+
expect(page).to have_field 'Término às', with: '02/02/2015 00:00'
|
73
|
+
expect(page).to have_field 'Descrição', with: 'Alterando Descrição do evento 1'
|
74
|
+
expect(page).to have_field 'CEP', with: '64000-128'
|
75
|
+
expect(page).to have_field 'Logradouro', with: 'Rua Magalhães Filho'
|
76
|
+
expect(page).to have_field 'Número', with: '712'
|
77
|
+
expect(page).to have_field 'Bairro', with: 'Centro/Sul'
|
78
|
+
expect(page).to have_field 'Cidade', with: 'Teresina'
|
79
|
+
expect(page).to have_field 'Estado', with: 'Piauí'
|
80
|
+
|
81
|
+
click_link 'Apagar'
|
82
|
+
|
83
|
+
expect(page).to have_content "Evento apagado(a) com sucesso"
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature WebAdmin::Institutional do
|
4
|
+
background do
|
5
|
+
sign_in
|
6
|
+
end
|
7
|
+
|
8
|
+
scenario "create, update and destroy a institucional" do
|
9
|
+
click_link 'Institucionais'
|
10
|
+
|
11
|
+
expect(page).to have_content 'Cadastro de institucionais'
|
12
|
+
|
13
|
+
click_link 'Novo'
|
14
|
+
|
15
|
+
fill_in 'Título', with: "Institucional 1"
|
16
|
+
fill_in_ckeditor 'institutional_body', with: "Corpo da primeira página institucional"
|
17
|
+
|
18
|
+
click_button 'Salvar'
|
19
|
+
|
20
|
+
expect(page).to have_content "Institucional criado(a) com sucesso"
|
21
|
+
|
22
|
+
expect(page).to have_content "Institucional 1"
|
23
|
+
expect(page).to have_content I18n.l(Date.current)
|
24
|
+
|
25
|
+
click_link 'Institucional 1'
|
26
|
+
|
27
|
+
expect(page).to have_field "Título", with: "Institucional 1"
|
28
|
+
|
29
|
+
fill_in 'Título', with: "Alterando a institucional 1"
|
30
|
+
fill_in_ckeditor 'institutional_body', with: "Alterando o corpo da primeira página institucional"
|
31
|
+
|
32
|
+
click_button "Salvar"
|
33
|
+
|
34
|
+
expect(page).to have_content "Institucional editado(a) com sucesso"
|
35
|
+
|
36
|
+
expect(page).to have_content "Alterando a institucional 1"
|
37
|
+
expect(page).to have_content I18n.l(Date.current)
|
38
|
+
|
39
|
+
click_link 'Alterando a institucional 1'
|
40
|
+
|
41
|
+
expect(page).to have_field "Título", with: "Alterando a institucional 1"
|
42
|
+
|
43
|
+
click_link 'Apagar'
|
44
|
+
|
45
|
+
expect(page).to have_content "Institucional apagado(a) com sucesso"
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "Login", :type => :feature do
|
4
|
+
it "login" do
|
5
|
+
user = create(:web_admin_user)
|
6
|
+
|
7
|
+
visit web_admin.root_path
|
8
|
+
|
9
|
+
expect(page).to have_content "Acesso"
|
10
|
+
|
11
|
+
fill_in 'Email', with: "user@email.com"
|
12
|
+
fill_in 'Senha', with: "12345678"
|
13
|
+
|
14
|
+
click_button 'Entrar'
|
15
|
+
|
16
|
+
expect(page).to have_content "Bem vindo"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature WebAdmin::Permission do
|
4
|
+
scenario "verify permission to user" do
|
5
|
+
user = create(:web_admin_user)
|
6
|
+
user.permissions = [
|
7
|
+
create(:manage_post, permission_type: WebAdmin::PermissionType::DENY),
|
8
|
+
create(:manage_user, permission_type: WebAdmin::PermissionType::ACCESS),
|
9
|
+
create(:manage_video, permission_type: WebAdmin::PermissionType::READ),
|
10
|
+
create(:manage_album, permission_type: WebAdmin::PermissionType::ACCESS),
|
11
|
+
create(:manage_image, permission_type: WebAdmin::PermissionType::ACCESS),
|
12
|
+
create(:manage_institutional, permission_type: WebAdmin::PermissionType::MODIFY),
|
13
|
+
create(:manage_event, permission_type: WebAdmin::PermissionType::ACCESS),
|
14
|
+
]
|
15
|
+
|
16
|
+
visit web_admin.root_path
|
17
|
+
fill_in 'Email', with: user.email
|
18
|
+
fill_in 'Senha', with: user.password
|
19
|
+
|
20
|
+
click_button 'Entrar'
|
21
|
+
|
22
|
+
expect(page).to_not have_link 'Notícias'
|
23
|
+
expect(page).to have_link 'Institucionais'
|
24
|
+
expect(page).to have_link 'Vídeos'
|
25
|
+
expect(page).to have_link 'Álbuns'
|
26
|
+
expect(page).to have_link 'Usuários'
|
27
|
+
expect(page).to have_link 'Eventos'
|
28
|
+
|
29
|
+
visit '/web_admin/posts'
|
30
|
+
expect(page).to have_content "Você não tem acesso a essa página. Contate o administrador do sistema, para maiores informações."
|
31
|
+
|
32
|
+
visit web_admin.root_path
|
33
|
+
|
34
|
+
click_link 'Institucionais'
|
35
|
+
|
36
|
+
expect(page).to have_content "Cadastro de institucionais"
|
37
|
+
expect(page).to_not have_link 'Novo'
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
feature WebAdmin::Post do
|
4
|
+
background do
|
5
|
+
sign_in
|
6
|
+
end
|
7
|
+
|
8
|
+
scenario "create, update and destroy a post" do
|
9
|
+
click_link 'Notícias'
|
10
|
+
|
11
|
+
expect(page).to have_content 'Cadastro de notícias'
|
12
|
+
|
13
|
+
click_link 'Nova'
|
14
|
+
|
15
|
+
fill_in 'Título', with: "Primeira notícia"
|
16
|
+
fill_in 'Resumo', with: "Resumo da primeira notícia"
|
17
|
+
|
18
|
+
attach_file('Image', "spec/fixtures/p3-single.jpg")
|
19
|
+
|
20
|
+
fill_in_ckeditor 'post_body', with: "Corpo da primeira notícia"
|
21
|
+
|
22
|
+
click_button 'Salvar'
|
23
|
+
|
24
|
+
expect(page).to have_content "Notícia criado(a) com sucesso"
|
25
|
+
|
26
|
+
expect(page).to have_content "Primeira notícia"
|
27
|
+
expect(page).to have_content I18n.l(Date.current)
|
28
|
+
|
29
|
+
click_link 'Primeira notícia'
|
30
|
+
|
31
|
+
expect(page).to have_field "Título", with: "Primeira notícia"
|
32
|
+
expect(page).to have_field "Resumo", with: "Resumo da primeira notícia"
|
33
|
+
|
34
|
+
fill_in 'Título', with: "Alterando a primeira notícia"
|
35
|
+
fill_in 'Resumo', with: "Alterando o resumo da primeira notícia"
|
36
|
+
|
37
|
+
fill_in_ckeditor 'post_body', with: "Alterando o corpo da primeira notícia"
|
38
|
+
|
39
|
+
click_button "Salvar"
|
40
|
+
|
41
|
+
expect(page).to have_content "Notícia editado(a) com sucesso"
|
42
|
+
|
43
|
+
expect(page).to have_content "Alterando a primeira notícia"
|
44
|
+
expect(page).to have_content I18n.l(Date.current)
|
45
|
+
|
46
|
+
click_link 'Alterando a primeira notícia'
|
47
|
+
|
48
|
+
expect(page).to have_field "Título", with: "Alterando a primeira notícia"
|
49
|
+
expect(page).to have_field "Resumo", with: "Alterando o resumo da primeira notícia"
|
50
|
+
|
51
|
+
click_link 'Apagar'
|
52
|
+
|
53
|
+
expect(page).to have_content "Notícia apagado(a) com sucesso"
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
feature WebAdmin::User do
|
4
|
+
background do
|
5
|
+
sign_in
|
6
|
+
end
|
7
|
+
|
8
|
+
scenario "create, update and destroy a user" do
|
9
|
+
click_link 'Usuários'
|
10
|
+
|
11
|
+
expect(page).to have_content 'Cadastro de usuários'
|
12
|
+
|
13
|
+
click_link 'Novo'
|
14
|
+
|
15
|
+
fill_in 'Email', with: "email@email.com"
|
16
|
+
fill_in 'Senha', with: "12345678"
|
17
|
+
fill_in 'Confirmação de senha', with: "12345678"
|
18
|
+
select 'Acesso total', from: 'user_permissions_attributes_0_permission_type'
|
19
|
+
select 'Acesso total', from: 'user_permissions_attributes_1_permission_type'
|
20
|
+
select 'Acesso total', from: 'user_permissions_attributes_2_permission_type'
|
21
|
+
select 'Acesso total', from: 'user_permissions_attributes_3_permission_type'
|
22
|
+
select 'Acesso total', from: 'user_permissions_attributes_4_permission_type'
|
23
|
+
select 'Acesso total', from: 'user_permissions_attributes_5_permission_type'
|
24
|
+
|
25
|
+
click_button 'Salvar'
|
26
|
+
|
27
|
+
expect(page).to have_content "Usuário criado(a) com sucesso"
|
28
|
+
|
29
|
+
expect(page).to have_content "email@email.com"
|
30
|
+
expect(page).to have_content I18n.l(Date.current)
|
31
|
+
|
32
|
+
click_link 'email@email.com'
|
33
|
+
|
34
|
+
expect(page).to have_field "Email", with: "email@email.com"
|
35
|
+
expect(page).to have_field "Senha", with: ""
|
36
|
+
expect(page).to have_field "Confirmação de senha", with: ""
|
37
|
+
expect(page).to have_select 'user_permissions_attributes_0_permission_type', selected: 'Acesso total'
|
38
|
+
expect(page).to have_select 'user_permissions_attributes_1_permission_type', selected: 'Acesso total'
|
39
|
+
expect(page).to have_select 'user_permissions_attributes_2_permission_type', selected: 'Acesso total'
|
40
|
+
expect(page).to have_select 'user_permissions_attributes_3_permission_type', selected: 'Acesso total'
|
41
|
+
expect(page).to have_select 'user_permissions_attributes_4_permission_type', selected: 'Acesso total'
|
42
|
+
expect(page).to have_select 'user_permissions_attributes_5_permission_type', selected: 'Acesso total'
|
43
|
+
|
44
|
+
fill_in 'Email', with: "email1@email.com"
|
45
|
+
select 'Acesso total', from: 'user_permissions_attributes_0_permission_type'
|
46
|
+
select 'Apenas leitura', from: 'user_permissions_attributes_1_permission_type'
|
47
|
+
select 'Bloqueado', from: 'user_permissions_attributes_2_permission_type'
|
48
|
+
select 'Atualizar', from: 'user_permissions_attributes_3_permission_type'
|
49
|
+
select 'Acesso total', from: 'user_permissions_attributes_4_permission_type'
|
50
|
+
select 'Acesso total', from: 'user_permissions_attributes_5_permission_type'
|
51
|
+
|
52
|
+
click_button "Salvar"
|
53
|
+
|
54
|
+
expect(page).to have_content "Usuário editado(a) com sucesso"
|
55
|
+
|
56
|
+
expect(page).to have_content "email1@email.com"
|
57
|
+
expect(page).to have_content I18n.l(Date.current)
|
58
|
+
|
59
|
+
click_link 'email1@email.com'
|
60
|
+
|
61
|
+
expect(page).to have_field "Email", with: "email1@email.com"
|
62
|
+
expect(page).to have_select 'user_permissions_attributes_0_permission_type', selected: 'Acesso total'
|
63
|
+
expect(page).to have_select 'user_permissions_attributes_1_permission_type', selected: 'Apenas leitura'
|
64
|
+
expect(page).to have_select 'user_permissions_attributes_2_permission_type', selected: 'Bloqueado'
|
65
|
+
expect(page).to have_select 'user_permissions_attributes_3_permission_type', selected: 'Atualizar'
|
66
|
+
expect(page).to have_select 'user_permissions_attributes_4_permission_type', selected: 'Acesso total'
|
67
|
+
expect(page).to have_select 'user_permissions_attributes_5_permission_type', selected: 'Acesso total'
|
68
|
+
|
69
|
+
click_link 'Apagar'
|
70
|
+
|
71
|
+
expect(page).to have_content "Usuário apagado(a) com sucesso"
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
feature WebAdmin::Video do
|
4
|
+
background do
|
5
|
+
sign_in
|
6
|
+
end
|
7
|
+
|
8
|
+
scenario "create, update and destroy a video" do
|
9
|
+
click_link 'Vídeos'
|
10
|
+
|
11
|
+
expect(page).to have_content 'Cadastro de vídeos'
|
12
|
+
|
13
|
+
click_link 'Novo'
|
14
|
+
|
15
|
+
fill_in 'Descrição', with: "Primeiro vídeo"
|
16
|
+
fill_in 'Link do Youtube', with: "www.youtube.com/watch?v=uzxpH-MtIts"
|
17
|
+
|
18
|
+
click_button 'Salvar'
|
19
|
+
|
20
|
+
expect(page).to have_content "Vídeo criado(a) com sucesso"
|
21
|
+
|
22
|
+
expect(page).to have_content "Primeiro vídeo"
|
23
|
+
expect(page).to have_content "uzxpH-MtIts"
|
24
|
+
expect(page).to have_content I18n.l(Date.current)
|
25
|
+
|
26
|
+
click_link 'Primeiro vídeo'
|
27
|
+
|
28
|
+
expect(page).to have_field "Descrição", with: "Primeiro vídeo"
|
29
|
+
expect(page).to have_field "Link do Youtube", with: "uzxpH-MtIts"
|
30
|
+
|
31
|
+
fill_in 'Descrição', with: "Alterando a Primeiro vídeo"
|
32
|
+
fill_in 'Link do Youtube', with: "www.youtube.com/watch?v=uzxpH-MtItsdadada"
|
33
|
+
|
34
|
+
click_button "Salvar"
|
35
|
+
|
36
|
+
expect(page).to have_content "Vídeo editado(a) com sucesso"
|
37
|
+
|
38
|
+
expect(page).to have_content "Alterando a Primeiro vídeo"
|
39
|
+
expect(page).to have_content "uzxpH-MtItsdadada"
|
40
|
+
expect(page).to have_content I18n.l(Date.current)
|
41
|
+
|
42
|
+
click_link 'Alterando a Primeiro vídeo'
|
43
|
+
|
44
|
+
expect(page).to have_field "Descrição", with: "Alterando a Primeiro vídeo"
|
45
|
+
expect(page).to have_field 'Link do Youtube', with: "uzxpH-MtItsdadada"
|
46
|
+
|
47
|
+
click_link 'Apagar'
|
48
|
+
|
49
|
+
expect(page).to have_content "Vídeo apagado(a) com sucesso"
|
50
|
+
end
|
51
|
+
end
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module WebAdmin
|
4
|
+
RSpec.describe Album, :type => :model do
|
5
|
+
context "Validations" do
|
6
|
+
it { should validate_presence_of :title }
|
7
|
+
it { should validate_presence_of :date }
|
8
|
+
it { should validate_presence_of :local }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "to_s" do
|
12
|
+
it 'return title' do
|
13
|
+
subject.stub(title: "Primeiro Post")
|
14
|
+
|
15
|
+
expect(subject.to_s).to eq "Primeiro Post"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module WebAdmin
|
4
|
+
RSpec.describe Event, :type => :model do
|
5
|
+
context "Validations" do
|
6
|
+
it { should validate_presence_of :title }
|
7
|
+
it { should validate_presence_of :start_date }
|
8
|
+
it { should validate_presence_of :end_date }
|
9
|
+
it { should validate_presence_of :description }
|
10
|
+
|
11
|
+
context "when end_date is greater than start_date" do
|
12
|
+
it 'is valid' do
|
13
|
+
subject.stub(start_date: Time.current)
|
14
|
+
subject.stub(end_date: Time.current + 3.days)
|
15
|
+
|
16
|
+
subject.valid?
|
17
|
+
|
18
|
+
expect(subject.errors[:end_date]).to be_empty
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when end_date is less than start_date" do
|
23
|
+
it 'is not valid' do
|
24
|
+
subject.stub(start_date: Time.current)
|
25
|
+
subject.stub(end_date: Time.current - 3.days)
|
26
|
+
|
27
|
+
subject.valid?
|
28
|
+
|
29
|
+
expect(subject.errors[:end_date]).to eq([I18n.t('activerecord.errors.messages.end_date_is_greater_than_start_date')])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "to_s" do
|
35
|
+
it 'return title' do
|
36
|
+
subject.stub(title: "Primeiro Evento")
|
37
|
+
|
38
|
+
expect(subject.to_s).to eq "Primeiro Evento"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module WebAdmin
|
4
|
+
RSpec.describe Image, :type => :model do
|
5
|
+
context "Relationships" do
|
6
|
+
it { should belong_to :album }
|
7
|
+
end
|
8
|
+
|
9
|
+
context "Validations" do
|
10
|
+
it { should validate_presence_of :album }
|
11
|
+
it { should validate_presence_of :file }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|