flms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.md +3 -0
- data/Rakefile +33 -0
- data/app/assets/images/img/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/img/glyphicons-halflings.png +0 -0
- data/app/assets/javascripts/flms/blocks/index.coffee +6 -0
- data/app/assets/javascripts/flms/bootstrap.js +6 -0
- data/app/assets/javascripts/flms/flms.js +17 -0
- data/app/assets/javascripts/flms/layout.coffee +8 -0
- data/app/assets/stylesheets/flms/blocks/index.sass +28 -0
- data/app/assets/stylesheets/flms/bootstrap.css +6159 -0
- data/app/assets/stylesheets/flms/flms.css +7 -0
- data/app/assets/stylesheets/flms/home.sass +30 -0
- data/app/assets/stylesheets/flms/layout.sass +19 -0
- data/app/assets/stylesheets/flms/login.sass +32 -0
- data/app/controllers/flms/admin_controller.rb +11 -0
- data/app/controllers/flms/application_controller.rb +4 -0
- data/app/controllers/flms/blocks_controller.rb +55 -0
- data/app/controllers/flms/dashboard_controller.rb +13 -0
- data/app/controllers/flms/pages_controller.rb +47 -0
- data/app/controllers/flms/sessions_controller.rb +16 -0
- data/app/controllers/flms/users_controller.rb +31 -0
- data/app/helpers/flms/application_helper.rb +4 -0
- data/app/models/flms/block.rb +10 -0
- data/app/models/flms/blocks_page.rb +8 -0
- data/app/models/flms/page.rb +14 -0
- data/app/models/flms/user.rb +10 -0
- data/app/views/flms/blocks/_form.html.haml +25 -0
- data/app/views/flms/blocks/edit.html.haml +3 -0
- data/app/views/flms/blocks/index.html.haml +41 -0
- data/app/views/flms/blocks/new.html.haml +2 -0
- data/app/views/flms/blocks/show.html.haml +1 -0
- data/app/views/flms/dashboard/index.html.haml +5 -0
- data/app/views/flms/pages/_form.html.haml +30 -0
- data/app/views/flms/pages/edit.html.haml +3 -0
- data/app/views/flms/pages/index.html.haml +21 -0
- data/app/views/flms/pages/new.html.haml +2 -0
- data/app/views/flms/pages/show.html.haml +8 -0
- data/app/views/flms/sessions/new.html.haml +21 -0
- data/app/views/flms/users/_form.html.haml +28 -0
- data/app/views/flms/users/index.html.haml +22 -0
- data/app/views/flms/users/new.html.haml +3 -0
- data/app/views/layouts/flms/admin.html.haml +40 -0
- data/app/views/layouts/flms/admin_login.html.haml +18 -0
- data/app/views/layouts/flms/application.html.erb +14 -0
- data/config/initializers/devise.rb +243 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/routes.rb +23 -0
- data/db/migrate/20130208224914_flms_devise_create_users.rb +47 -0
- data/db/migrate/20130216032241_flms_create_pages.rb +12 -0
- data/db/migrate/20130302011705_create_flms_blocks.rb +10 -0
- data/db/migrate/20130302015459_create_flms_blocks_pages.rb +12 -0
- data/lib/flms.rb +7 -0
- data/lib/flms/engine.rb +5 -0
- data/lib/flms/version.rb +3 -0
- data/lib/tasks/flms_tasks.rake +26 -0
- data/spec/controllers/blocks_controller_spec.rb +61 -0
- data/spec/controllers/dashboard_controller_spec.rb +12 -0
- data/spec/controllers/pages_controller_spec.rb +60 -0
- data/spec/controllers/users_controller_spec.rb +37 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +12 -0
- data/spec/dummy/app/controllers/home_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/user.rb +8 -0
- data/spec/dummy/app/views/home/index.html.haml +10 -0
- data/spec/dummy/app/views/layouts/application.html.haml +10 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +69 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +52 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +244 -0
- data/spec/dummy/config/initializers/flms.rb +1 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/schema.rb +60 -0
- data/spec/dummy/log/development.log +39893 -0
- data/spec/dummy/log/test.log +42855 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/tmp/cache/assets/C9D/180/sprockets%2Fad74b633d2447502477133032afac84b +0 -0
- data/spec/dummy/tmp/cache/assets/CAB/C80/sprockets%2Fc4e739111d82c7189113aeb228816ba8 +0 -0
- data/spec/dummy/tmp/cache/assets/CB9/E30/sprockets%2F588cf5763c29e490d026f24e8aa90343 +0 -0
- data/spec/dummy/tmp/cache/assets/CCF/210/sprockets%2F43b5c2ffc8a62726b4ed6234001571a4 +0 -0
- data/spec/dummy/tmp/cache/assets/CDB/510/sprockets%2Fd61745a24c4636f8813fa14038bac69a +0 -0
- data/spec/dummy/tmp/cache/assets/CDE/D90/sprockets%2Fcc733e310d9646637216c4ffe109ea35 +0 -0
- data/spec/dummy/tmp/cache/assets/CE4/6B0/sprockets%2F6e38aec803936176be248f507eb3432d +0 -0
- data/spec/dummy/tmp/cache/assets/CED/6A0/sprockets%2Fcc221f5201d658cf456836f8b5547f9d +0 -0
- data/spec/dummy/tmp/cache/assets/CF6/740/sprockets%2F0cb88349ae46593e396c4bd68854ed08 +0 -0
- data/spec/dummy/tmp/cache/assets/D01/E80/sprockets%2Fc1a3694915166d6a041afa4bb062fd84 +0 -0
- data/spec/dummy/tmp/cache/assets/D06/AF0/sprockets%2F02a9a4f214368781ba86ed42d5bef203 +0 -0
- data/spec/dummy/tmp/cache/assets/D07/250/sprockets%2Fa8bf27de087b582dc454910a060e0b84 +0 -0
- data/spec/dummy/tmp/cache/assets/D09/5C0/sprockets%2F7cd3521c63623eb6f02dbb514991a6f6 +0 -0
- data/spec/dummy/tmp/cache/assets/D0C/570/sprockets%2F7e3d63e1412ae56b44b23d95547f0cc7 +0 -0
- data/spec/dummy/tmp/cache/assets/D0D/510/sprockets%2Fa189f1a8718ff11152feb3c43c75b841 +0 -0
- data/spec/dummy/tmp/cache/assets/D1A/3F0/sprockets%2F84181c4b293f3a1c4efe9226652f9e6e +0 -0
- data/spec/dummy/tmp/cache/assets/D1E/1D0/sprockets%2Ffeec495723d877b92c74db2055516bc9 +0 -0
- data/spec/dummy/tmp/cache/assets/D2E/F10/sprockets%2F156bfd6b405a129f5f003243cf60aea9 +0 -0
- data/spec/dummy/tmp/cache/assets/D35/470/sprockets%2F2c0a647ea89470a8285b9acb2006dbd5 +0 -0
- data/spec/dummy/tmp/cache/assets/D3B/440/sprockets%2Fabe31f236167ba051f6ff849d0a7282f +0 -0
- data/spec/dummy/tmp/cache/assets/D3B/550/sprockets%2Fb61caf9834ac8c31691851ac024f26ef +0 -0
- data/spec/dummy/tmp/cache/assets/D44/A50/sprockets%2F7602cd388554ba54eb914c1b2d7ff68c +0 -0
- data/spec/dummy/tmp/cache/assets/D46/210/sprockets%2F45a8d49c8edbaf91f38ab1495430384c +0 -0
- data/spec/dummy/tmp/cache/assets/D4A/B40/sprockets%2F509d2dc1350975d781c50dffc58ef53f +0 -0
- data/spec/dummy/tmp/cache/assets/D54/DE0/sprockets%2F77af3e306bb966f71f83e90e2a8868db +0 -0
- data/spec/dummy/tmp/cache/assets/D5B/1F0/sprockets%2F4d98e747aa4bb9fc8859f49a45159e1c +0 -0
- data/spec/dummy/tmp/cache/assets/D65/690/sprockets%2F511f71e32f87da06df67250bb39abdc2 +0 -0
- data/spec/dummy/tmp/cache/assets/D6E/870/sprockets%2F3f77e0b5396013fd145a6fdd21bc9b7f +0 -0
- data/spec/dummy/tmp/cache/assets/D74/EA0/sprockets%2Fccfc557971c4d47336cab75db207b89a +0 -0
- data/spec/dummy/tmp/cache/assets/D77/D80/sprockets%2F7ad794c63274a9812dfbabc1dae69692 +0 -0
- data/spec/dummy/tmp/cache/assets/D79/DE0/sprockets%2F9e7131d002f39be972e9918bdfbbcc66 +0 -0
- data/spec/dummy/tmp/cache/assets/D7C/3A0/sprockets%2Fec63717067efd6b2daf3423edf70f689 +0 -0
- data/spec/dummy/tmp/cache/assets/D81/300/sprockets%2F9543b0420abb11b0a126a8384edddafe +0 -0
- data/spec/dummy/tmp/cache/assets/D81/400/sprockets%2F566656e2cc9e698b1dbbd56d6e2e6b36 +0 -0
- data/spec/dummy/tmp/cache/assets/D93/0C0/sprockets%2Fab900c084c9c51c312ee3457cee8cdc2 +0 -0
- data/spec/dummy/tmp/cache/assets/D98/FD0/sprockets%2F6f253bd2bf824ac38c69bfe1418a04be +0 -0
- data/spec/dummy/tmp/cache/assets/D9E/220/sprockets%2Fd129fcf804e89814c2f4abbe0336cba9 +0 -0
- data/spec/dummy/tmp/cache/assets/DA0/9F0/sprockets%2Fd7c0d94bf0df6b0e03f83dcaf8873631 +0 -0
- data/spec/dummy/tmp/cache/assets/DA3/920/sprockets%2F6c45b9f8e0152c78b3c9be1c2e8be53c +0 -0
- data/spec/dummy/tmp/cache/assets/DA5/BC0/sprockets%2F5b86068a872e5bd841750d6cbd2dfdbf +0 -0
- data/spec/dummy/tmp/cache/assets/DA8/4A0/sprockets%2Ff8ba39d58ace11df624bf7e24c7b5882 +0 -0
- data/spec/dummy/tmp/cache/assets/DA8/C30/sprockets%2Fb7d14d588a70a56d7ddac542eef557d6 +0 -0
- data/spec/dummy/tmp/cache/assets/DA9/370/sprockets%2Fdf257d496b11ea9c1bb7ee139d68c83e +0 -0
- data/spec/dummy/tmp/cache/assets/DAC/D80/sprockets%2Fb8ca14c15e0301b935aaaef327bdc40a +0 -0
- data/spec/dummy/tmp/cache/assets/DAE/F10/sprockets%2F46950fdbeed95ba83ca8e7215194ddf8 +0 -0
- data/spec/dummy/tmp/cache/assets/DB2/1F0/sprockets%2F9fe57997f92efbee3b03df4510a2df57 +0 -0
- data/spec/dummy/tmp/cache/assets/DB8/C30/sprockets%2Fca860af2d10e0c745b6e38b12dabe05f +0 -0
- data/spec/dummy/tmp/cache/assets/DC1/530/sprockets%2F4db0b289eee7dad03453a5924c20dcfa +0 -0
- data/spec/dummy/tmp/cache/assets/DC6/7D0/sprockets%2Ff7689ac5fafbf683c537892e6ff7f8c3 +0 -0
- data/spec/dummy/tmp/cache/assets/DCC/B80/sprockets%2Fb7ae6e7bfa8984c54a4dfaf0011617cd +0 -0
- data/spec/dummy/tmp/cache/assets/DCE/790/sprockets%2Fff77d67febbb3af024f721c0bb4c4749 +0 -0
- data/spec/dummy/tmp/cache/assets/DCF/0B0/sprockets%2F23db7ab96a5549546bbdd0bc2e6ea86f +0 -0
- data/spec/dummy/tmp/cache/assets/DD5/440/sprockets%2F9b3488ba6d62c3dcc809f8cd3dc2d1f5 +0 -0
- data/spec/dummy/tmp/cache/assets/DE6/B10/sprockets%2Fa0adf3fb2b0054d04dd44c08aff1d6c8 +0 -0
- data/spec/dummy/tmp/cache/assets/DF1/A10/sprockets%2Fa925a815ca0bff4d6f42fbdf0d323a4f +0 -0
- data/spec/dummy/tmp/cache/assets/DFA/FF0/sprockets%2F75699fed9ddaecd89464492eeeef90d8 +0 -0
- data/spec/dummy/tmp/cache/assets/DFD/540/sprockets%2F181ef7a7c275dd2872aa1ed1fcfab75f +0 -0
- data/spec/dummy/tmp/cache/assets/E0E/B50/sprockets%2Fe78fa5fc4cfb0979876d23ae1b1f3ffd +0 -0
- data/spec/dummy/tmp/cache/assets/E3A/110/sprockets%2Fb6d5158ff7ac6d2ca99bfe56a7ddd2e3 +0 -0
- data/spec/dummy/tmp/cache/assets/E6D/8B0/sprockets%2F9edfdf7e85cdd1a69b0eb14c6ce8ed19 +0 -0
- data/spec/factories/blocks.rb +6 -0
- data/spec/factories/pages.rb +6 -0
- data/spec/factories/users.rb +7 -0
- data/spec/features/blocks/create_spec.rb +19 -0
- data/spec/features/blocks/delete_spec.rb +17 -0
- data/spec/features/blocks/edit_spec.rb +20 -0
- data/spec/features/blocks/show_spec.rb +14 -0
- data/spec/features/dashboard_spec.rb +11 -0
- data/spec/features/login_spec.rb +50 -0
- data/spec/features/pages/create_spec.rb +18 -0
- data/spec/features/pages/delete_spec.rb +14 -0
- data/spec/features/pages/index_spec.rb +14 -0
- data/spec/features/pages/update_spec.rb +17 -0
- data/spec/features/users/create_spec.rb +20 -0
- data/spec/features/users/delete_spec.rb +13 -0
- data/spec/features/users/index_spec.rb +16 -0
- data/spec/flms_spec.rb +7 -0
- data/spec/models/block_spec.rb +14 -0
- data/spec/models/page_spec.rb +15 -0
- data/spec/models/user_spec.rb +5 -0
- data/spec/spec_helper.rb +53 -0
- data/spec/support/access_control.rb +87 -0
- data/spec/support/capybara_helpers.rb +7 -0
- data/spec/support/lets.rb +8 -0
- data/vendor/assets/javascripts/bootstrapSwitch.js +238 -0
- data/vendor/assets/javascripts/jquery-ui.js +2221 -0
- data/vendor/assets/stylesheets/bootstrapSwitch.css +210 -0
- data/vendor/assets/stylesheets/jquery-ui.css +88 -0
- metadata +607 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Flms::Engine.routes.draw do
|
2
|
+
|
3
|
+
resources :pages do
|
4
|
+
resources :blocks
|
5
|
+
end
|
6
|
+
|
7
|
+
devise_for :user,
|
8
|
+
class_name: 'Flms::User',
|
9
|
+
module: :devise,
|
10
|
+
controllers: { sessions: 'flms/sessions',
|
11
|
+
passwords: 'flms/passwords' },
|
12
|
+
path_names: { sign_out: 'logout' }
|
13
|
+
|
14
|
+
devise_scope :user do
|
15
|
+
get '/login', to: 'sessions#new', as: :login
|
16
|
+
post '/login', to: 'sessions#create'
|
17
|
+
get '/logout', to: 'sessions#destroy', as: :logout
|
18
|
+
end
|
19
|
+
|
20
|
+
resources :users, only: [:index, :new, :create, :destroy]
|
21
|
+
|
22
|
+
root :to => 'dashboard#index'
|
23
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class FlmsDeviseCreateUsers < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
create_table(:flms_users) do |t|
|
5
|
+
## Database authenticatable
|
6
|
+
t.string :email, :null => false, :default => ""
|
7
|
+
t.string :encrypted_password, :null => false, :default => ""
|
8
|
+
|
9
|
+
## Recoverable
|
10
|
+
t.string :reset_password_token
|
11
|
+
t.datetime :reset_password_sent_at
|
12
|
+
|
13
|
+
## Rememberable
|
14
|
+
t.datetime :remember_created_at
|
15
|
+
|
16
|
+
## Trackable
|
17
|
+
t.integer :sign_in_count, :default => 0
|
18
|
+
t.datetime :current_sign_in_at
|
19
|
+
t.datetime :last_sign_in_at
|
20
|
+
t.string :current_sign_in_ip
|
21
|
+
t.string :last_sign_in_ip
|
22
|
+
|
23
|
+
## Confirmable
|
24
|
+
# t.string :confirmation_token
|
25
|
+
# t.datetime :confirmed_at
|
26
|
+
# t.datetime :confirmation_sent_at
|
27
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
28
|
+
|
29
|
+
## Lockable
|
30
|
+
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
31
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
32
|
+
# t.datetime :locked_at
|
33
|
+
|
34
|
+
## Token authenticatable
|
35
|
+
# t.string :authentication_token
|
36
|
+
|
37
|
+
|
38
|
+
t.timestamps
|
39
|
+
end
|
40
|
+
|
41
|
+
add_index :flms_users, :email, :unique => true
|
42
|
+
add_index :flms_users, :reset_password_token, :unique => true
|
43
|
+
# add_index :users, :confirmation_token, :unique => true
|
44
|
+
# add_index :users, :unlock_token, :unique => true
|
45
|
+
# add_index :users, :authentication_token, :unique => true
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateFlmsBlocksPages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :flms_blocks_pages do |t|
|
4
|
+
t.integer :block_id
|
5
|
+
t.integer :page_id
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :flms_blocks_pages, :block_id
|
10
|
+
add_index :flms_blocks_pages, :page_id
|
11
|
+
end
|
12
|
+
end
|
data/lib/flms.rb
ADDED
data/lib/flms/engine.rb
ADDED
data/lib/flms/version.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
namespace :flms do
|
2
|
+
|
3
|
+
desc 'Creates a user account'
|
4
|
+
task :create_user, [:email] => :environment do |t, args|
|
5
|
+
|
6
|
+
# Check params.
|
7
|
+
unless args.email
|
8
|
+
puts "Error: parameter 'email' not provided."
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
# Read the password from the command line.
|
13
|
+
print "Please enter the password for the new user: "
|
14
|
+
password = STDIN.gets.chomp
|
15
|
+
|
16
|
+
# Get user.
|
17
|
+
unless Flms::User.create email: args.email, password: password, password_confirmation: password
|
18
|
+
puts "Error: user with email '#{args.email}' could not be created."
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
|
22
|
+
puts "User #{args.email} created."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Flms::BlocksController do
|
4
|
+
test_helpers
|
5
|
+
|
6
|
+
describe 'index' do
|
7
|
+
describe 'access control' do
|
8
|
+
let(:request) { get :index, page_id: page_1.url, use_route: :flms }
|
9
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'new' do
|
14
|
+
describe 'access control' do
|
15
|
+
let(:request) { get :new, page_id: page_1.url, use_route: :flms }
|
16
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'create' do
|
21
|
+
describe 'access control' do
|
22
|
+
let(:request) { post :create, page_id: page_1.url, block: attributes_for(:block), use_route: :flms }
|
23
|
+
let(:access_granted_check) { response.status == 302 && response.location == "http://test.host/flms/pages/#{page_1.url}/blocks" }
|
24
|
+
let(:database_performed_check) { Flms::Block.count == 1 }
|
25
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'show' do
|
30
|
+
describe 'access control' do
|
31
|
+
let(:request) { get :show, id: block_1.id, page_id: page_1.url, use_route: :flms }
|
32
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'edit' do
|
37
|
+
describe 'access control' do
|
38
|
+
let(:request) { get :edit, id: block_1.id, page_id: page_1.url, use_route: :flms }
|
39
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'update' do
|
44
|
+
describe 'access control' do
|
45
|
+
let(:request) { put :update, id: block_1.id, page_id: page_1.url, block: attributes_for(:block, name: 'new name'), use_route: :flms }
|
46
|
+
let(:access_granted_check) { response.status == 302 && response.location == "http://test.host/flms/pages/#{page_1.url}/blocks" }
|
47
|
+
let(:database_performed_check) { Flms::Block.count == 1 && block_1.reload.name == 'new name' }
|
48
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'delete' do
|
53
|
+
describe 'access control' do
|
54
|
+
let(:request) { delete :destroy, id: block_1.id, page_id: page_1.url, use_route: :flms }
|
55
|
+
let(:access_granted_check) { response.status == 302 && response.location == "http://test.host/flms/pages/#{page_1.url}/blocks" }
|
56
|
+
let(:database_performed_check) { Flms::Block.count == 0 }
|
57
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Flms::DashboardController do
|
4
|
+
test_helpers
|
5
|
+
|
6
|
+
describe 'index' do
|
7
|
+
describe 'access control' do
|
8
|
+
let(:request) { get :index, use_route: :flms }
|
9
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Flms::PagesController do
|
4
|
+
test_helpers
|
5
|
+
|
6
|
+
describe 'index' do
|
7
|
+
describe 'access control' do
|
8
|
+
let(:request) { get :index, use_route: :flms }
|
9
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'new' do
|
14
|
+
describe 'access control' do
|
15
|
+
let(:request) { get :new, use_route: :flms }
|
16
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'create' do
|
21
|
+
describe 'access control' do
|
22
|
+
let(:request) { post :create, page: attributes_for(:page), use_route: :flms }
|
23
|
+
let(:access_granted_check) { response.status == 302 && response.location == 'http://test.host/flms/pages' }
|
24
|
+
let(:database_performed_check) { Flms::Page.count == 1 }
|
25
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'show' do
|
30
|
+
describe 'access control' do
|
31
|
+
let(:request) { get :show, id: page_1.url, use_route: :flms }
|
32
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'edit' do
|
37
|
+
describe 'access control' do
|
38
|
+
let(:request) { get :edit, id: page_1.url, use_route: :flms }
|
39
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'update' do
|
44
|
+
describe 'access control' do
|
45
|
+
let(:request) { put :update, id: page_1.url, page: attributes_for(:page, title: 'new title', url: 'new-url'), use_route: :flms }
|
46
|
+
let(:access_granted_check) { response.status == 302 && response.location == 'http://test.host/flms/pages' }
|
47
|
+
let(:database_performed_check) { Flms::Page.count == 1 && page_1.reload.title == 'new title' }
|
48
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'delete' do
|
53
|
+
describe 'access control' do
|
54
|
+
let(:request) { delete :destroy, id: page_1.url, use_route: :flms }
|
55
|
+
let(:access_granted_check) { response.status == 302 && response.location == 'http://test.host/flms/pages' }
|
56
|
+
let(:database_performed_check) { Flms::Page.count == 0 }
|
57
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Flms::UsersController do
|
4
|
+
test_helpers
|
5
|
+
|
6
|
+
describe 'index' do
|
7
|
+
describe 'access control' do
|
8
|
+
let(:request) { get :index, use_route: :flms }
|
9
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'new' do
|
14
|
+
describe 'access control' do
|
15
|
+
let(:request) { get :new, use_route: :flms }
|
16
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'create' do
|
21
|
+
describe 'access control' do
|
22
|
+
let(:request) { post :create, user: attributes_for(:user), use_route: :flms }
|
23
|
+
let(:access_granted_check) { response.status == 302 && response.location == 'http://test.host/flms/users' }
|
24
|
+
let(:database_performed_check) { Flms::User.count == 2 }
|
25
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'delete' do
|
30
|
+
describe 'access control' do
|
31
|
+
let(:request) { delete :destroy, id: user_2.id, use_route: :flms }
|
32
|
+
let(:access_granted_check) { response.status == 302 && response.location == 'http://test.host/flms/users' }
|
33
|
+
let(:database_performed_check) { Flms::User.find_by_id(user_2.id) == nil }
|
34
|
+
it_should_behave_like 'an action accessible only to logged-in users'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
# Include default devise modules. Others available are:
|
3
|
+
# :token_authenticatable, :confirmable, :lockable, :timeoutable and :omniauthable
|
4
|
+
devise :database_authenticatable,
|
5
|
+
:recoverable, :rememberable, :trackable, :validatable
|
6
|
+
|
7
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
8
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require
|
6
|
+
require "flms"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
15
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
16
|
+
|
17
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
18
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
19
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
20
|
+
|
21
|
+
# Activate observers that should always be running.
|
22
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
23
|
+
|
24
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
27
|
+
|
28
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
|
+
# config.i18n.default_locale = :de
|
31
|
+
|
32
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
33
|
+
config.encoding = "utf-8"
|
34
|
+
|
35
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
36
|
+
config.filter_parameters += [:password]
|
37
|
+
|
38
|
+
# Enable escaping HTML in JSON.
|
39
|
+
config.active_support.escape_html_entities_in_json = true
|
40
|
+
|
41
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
42
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
43
|
+
# like if you have constraints or database-specific column types
|
44
|
+
# config.active_record.schema_format = :sql
|
45
|
+
|
46
|
+
# Enforce whitelist mode for mass assignment.
|
47
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
48
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
49
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
50
|
+
config.active_record.whitelist_attributes = true
|
51
|
+
|
52
|
+
# Enable the asset pipeline
|
53
|
+
config.assets.enabled = true
|
54
|
+
|
55
|
+
# Version of your assets, change this if you want to expire all your assets
|
56
|
+
config.assets.version = '1.0'
|
57
|
+
|
58
|
+
config.generators do |g|
|
59
|
+
g.fixture false
|
60
|
+
g.javascripts false
|
61
|
+
g.helpers false
|
62
|
+
g.helper_specs false # prevent generating helpers
|
63
|
+
g.stylesheets false
|
64
|
+
g.template_engine :haml # create HAML template
|
65
|
+
g.view_specs false # prevent generating view specs
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|