xing-framework 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/default_configuration/base_app/API_DOC/README +23 -0
- data/default_configuration/base_app/API_DOC/admin-menus +167 -0
- data/default_configuration/base_app/API_DOC/admin-pages +173 -0
- data/default_configuration/base_app/API_DOC/content-block +10 -0
- data/default_configuration/base_app/API_DOC/navigation +54 -0
- data/default_configuration/base_app/API_DOC/page +38 -0
- data/default_configuration/base_app/CHANGELOG.md +122 -0
- data/default_configuration/base_app/Capfile +26 -0
- data/default_configuration/base_app/Gemfile +7 -0
- data/default_configuration/base_app/Gemfile.lock +155 -0
- data/default_configuration/base_app/README.md +24 -0
- data/default_configuration/base_app/Rakefile +25 -0
- data/default_configuration/base_app/backend/Gemfile +45 -0
- data/default_configuration/base_app/backend/Gemfile.lock +292 -0
- data/default_configuration/base_app/backend/README +12 -0
- data/default_configuration/base_app/backend/Rakefile +10 -0
- data/default_configuration/base_app/backend/app/controllers/application_controller.rb +3 -0
- data/default_configuration/base_app/backend/app/controllers/confirmations_controller.rb +3 -0
- data/default_configuration/base_app/backend/app/controllers/passwords_controller.rb +3 -0
- data/default_configuration/base_app/backend/app/controllers/registrations_controller.rb +15 -0
- data/default_configuration/base_app/backend/app/models/ability.rb +13 -0
- data/default_configuration/base_app/backend/app/models/role/admin.rb +8 -0
- data/default_configuration/base_app/backend/app/models/user.rb +43 -0
- data/default_configuration/base_app/backend/autotest/discover.rb +2 -0
- data/default_configuration/base_app/backend/bin/bundle +3 -0
- data/default_configuration/base_app/backend/bin/rails +4 -0
- data/default_configuration/base_app/backend/bin/rake +4 -0
- data/default_configuration/base_app/backend/config.ru +6 -0
- data/default_configuration/base_app/backend/config/application.rb +71 -0
- data/default_configuration/base_app/backend/config/boot.rb +4 -0
- data/default_configuration/base_app/backend/config/database.yml.ci +9 -0
- data/default_configuration/base_app/backend/config/database.yml.example +22 -0
- data/default_configuration/base_app/backend/config/environment.rb +5 -0
- data/default_configuration/base_app/backend/config/environments/development.rb +45 -0
- data/default_configuration/base_app/backend/config/environments/production.rb +78 -0
- data/default_configuration/base_app/backend/config/environments/staging.rb +48 -0
- data/default_configuration/base_app/backend/config/environments/test.rb +47 -0
- data/default_configuration/base_app/backend/config/initializers/assets.rb +8 -0
- data/default_configuration/base_app/backend/config/initializers/backtrace_silencers.rb +7 -0
- data/default_configuration/base_app/backend/config/initializers/constants.rb +1 -0
- data/default_configuration/base_app/backend/config/initializers/cookies_serializer.rb +3 -0
- data/default_configuration/base_app/backend/config/initializers/devise.rb +241 -0
- data/default_configuration/base_app/backend/config/initializers/devise_token_auth.rb +22 -0
- data/default_configuration/base_app/backend/config/initializers/filter_parameter_logging.rb +4 -0
- data/default_configuration/base_app/backend/config/initializers/inflections.rb +16 -0
- data/default_configuration/base_app/backend/config/initializers/mime_types.rb +4 -0
- data/default_configuration/base_app/backend/config/initializers/session_store.rb +3 -0
- data/default_configuration/base_app/backend/config/initializers/smtp.rb +25 -0
- data/default_configuration/base_app/backend/config/initializers/time_formats.rb +12 -0
- data/default_configuration/base_app/backend/config/initializers/wrap_parameters.rb +14 -0
- data/default_configuration/base_app/backend/config/locales/en.yml +23 -0
- data/default_configuration/base_app/backend/config/locales/json.yml +29 -0
- data/default_configuration/base_app/backend/config/routes.rb +33 -0
- data/default_configuration/base_app/backend/config/secrets.yml.ci +22 -0
- data/default_configuration/base_app/backend/config/secrets.yml.example +57 -0
- data/default_configuration/base_app/backend/config/sidekiq.yml +4 -0
- data/default_configuration/base_app/backend/db/sample_data/users.rake +10 -0
- data/default_configuration/base_app/backend/db/seeds.rb +14 -0
- data/default_configuration/base_app/backend/lib/static-app.rb +15 -0
- data/default_configuration/base_app/backend/public/404.html +26 -0
- data/default_configuration/base_app/backend/public/422.html +26 -0
- data/default_configuration/base_app/backend/public/500.html +26 -0
- data/default_configuration/base_app/backend/public/favicon.ico +0 -0
- data/default_configuration/base_app/backend/public/index.html +0 -0
- data/default_configuration/base_app/backend/public/robots.txt +5 -0
- data/default_configuration/base_app/backend/script/rails +6 -0
- data/default_configuration/base_app/backend/spec/factories/user_sessions_factory.rb +6 -0
- data/default_configuration/base_app/backend/spec/factories/users_factory.rb +35 -0
- data/default_configuration/base_app/backend/spec/features/user_sends_reset_password_email_spec.rb +30 -0
- data/default_configuration/base_app/backend/spec/features/user_signs_up_spec.rb +32 -0
- data/default_configuration/base_app/backend/spec/models/role/admin_spec.rb +12 -0
- data/default_configuration/base_app/backend/spec/models/role_spec.rb +48 -0
- data/default_configuration/base_app/backend/spec/models/user_spec.rb +59 -0
- data/default_configuration/base_app/backend/spec/requests/resources_index_spec.rb +22 -0
- data/default_configuration/base_app/backend/spec/spec_helper.rb +65 -0
- data/default_configuration/base_app/backend/spec/support/devise_helper.rb +78 -0
- data/default_configuration/base_app/backend/spec/support/log_tests.rb +5 -0
- data/default_configuration/base_app/backend/spec/support/session_helpers.rb +67 -0
- data/default_configuration/base_app/backend/spec/tasks/sample_data_rake_spec.rb +17 -0
- data/default_configuration/base_app/backend/static-app.ru +3 -0
- data/default_configuration/base_app/codeclimate.yml +7 -0
- data/default_configuration/base_app/config/compass.rb +21 -0
- data/default_configuration/base_app/config/deploy.rb +157 -0
- data/default_configuration/base_app/config/deploy/bundle-config +4 -0
- data/default_configuration/base_app/config/deploy/production.rb +7 -0
- data/default_configuration/base_app/config/deploy/staging.rb +6 -0
- data/default_configuration/base_app/doc/01_fail_resources.txt +173 -0
- data/default_configuration/base_app/doc/02_fail_auth.txt +165 -0
- data/default_configuration/base_app/doc/03_fail_menus.txt +174 -0
- data/default_configuration/base_app/dummy-api/admin/menu_items/10.json +15 -0
- data/default_configuration/base_app/dummy-api/admin/menu_items/11.json +15 -0
- data/default_configuration/base_app/dummy-api/admin/menu_items/12.json +15 -0
- data/default_configuration/base_app/dummy-api/admin/menu_items/13.json +15 -0
- data/default_configuration/base_app/dummy-api/admin/menu_items/14.json +15 -0
- data/default_configuration/base_app/dummy-api/admin/menu_items/15.json +15 -0
- data/default_configuration/base_app/dummy-api/admin/menu_items/16.json +15 -0
- data/default_configuration/base_app/dummy-api/admin/menus.json +23 -0
- data/default_configuration/base_app/dummy-api/admin/menus/1.json +118 -0
- data/default_configuration/base_app/dummy-api/admin/menus/2.json +8 -0
- data/default_configuration/base_app/dummy-api/admin/pages.json +105 -0
- data/default_configuration/base_app/dummy-api/admin/pages/about_us.json +45 -0
- data/default_configuration/base_app/dummy-api/admin/pages/contact_us.json +36 -0
- data/default_configuration/base_app/dummy-api/admin/pages/gallery.json +36 -0
- data/default_configuration/base_app/dummy-api/admin/pages/home.json +36 -0
- data/default_configuration/base_app/dummy-api/admin/pages/homepage.json +18 -0
- data/default_configuration/base_app/dummy-api/admin/pages/links.json +36 -0
- data/default_configuration/base_app/dummy-api/admin/pages/newsletter.json +54 -0
- data/default_configuration/base_app/dummy-api/homepage.json +14 -0
- data/default_configuration/base_app/dummy-api/navigation/main.json +119 -0
- data/default_configuration/base_app/dummy-api/pages/about_us.json +41 -0
- data/default_configuration/base_app/dummy-api/pages/contact_us.json +32 -0
- data/default_configuration/base_app/dummy-api/pages/gallery.json +32 -0
- data/default_configuration/base_app/dummy-api/pages/home.json +32 -0
- data/default_configuration/base_app/dummy-api/pages/homepage.json +14 -0
- data/default_configuration/base_app/dummy-api/pages/links.json +32 -0
- data/default_configuration/base_app/dummy-api/pages/newsletter.json +50 -0
- data/default_configuration/base_app/dump.rdb +0 -0
- data/default_configuration/base_app/example-lrd-dev-tmux.conf +17 -0
- data/default_configuration/base_app/frontend/CHANGELOG.md +125 -0
- data/default_configuration/base_app/frontend/Gemfile +5 -0
- data/default_configuration/base_app/frontend/Gemfile.lock +34 -0
- data/default_configuration/base_app/frontend/Gruntfile.js +3 -0
- data/default_configuration/base_app/frontend/LICENSE +19 -0
- data/default_configuration/base_app/frontend/README.md +5 -0
- data/default_configuration/base_app/frontend/bin/index.html +0 -0
- data/default_configuration/base_app/frontend/build.config.js +110 -0
- data/default_configuration/base_app/frontend/changelog.tpl +23 -0
- data/default_configuration/base_app/frontend/config/compass.rb +33 -0
- data/default_configuration/base_app/frontend/config/environments/development.js +4 -0
- data/default_configuration/base_app/frontend/config/environments/integration.js +4 -0
- data/default_configuration/base_app/frontend/config/environments/production.js +3 -0
- data/default_configuration/base_app/frontend/config/environments/test.js +4 -0
- data/default_configuration/base_app/frontend/create +0 -0
- data/default_configuration/base_app/frontend/karma/karma-unit.tpl.js +80 -0
- data/default_configuration/base_app/frontend/module.prefix +1 -0
- data/default_configuration/base_app/frontend/module.suffix +1 -0
- data/default_configuration/base_app/frontend/npm-shrinkwrap.json +4334 -0
- data/default_configuration/base_app/frontend/package.json +75 -0
- data/default_configuration/base_app/frontend/sprockets/index.tpl.js +2 -0
- data/default_configuration/base_app/frontend/src/README.md +48 -0
- data/default_configuration/base_app/frontend/src/app/README.md +68 -0
- data/default_configuration/base_app/frontend/src/app/app.js +47 -0
- data/default_configuration/base_app/frontend/src/app/appConfig.js +19 -0
- data/default_configuration/base_app/frontend/src/app/auth/auth.js +66 -0
- data/default_configuration/base_app/frontend/src/app/auth/config.js +22 -0
- data/default_configuration/base_app/frontend/src/app/auth/confirmations/confirmations-success.tpl.html +1 -0
- data/default_configuration/base_app/frontend/src/app/auth/confirmations/confirmations.js +8 -0
- data/default_configuration/base_app/frontend/src/app/auth/confirmations/confirmationsStates.js +12 -0
- data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-request-success.tpl.html +3 -0
- data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-request.tpl.html +16 -0
- data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-update-success.tpl.html +3 -0
- data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords-update.tpl.html +21 -0
- data/default_configuration/base_app/frontend/src/app/auth/passwords/passwords.js +11 -0
- data/default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js +47 -0
- data/default_configuration/base_app/frontend/src/app/auth/passwords/passwordsStates.js +38 -0
- data/default_configuration/base_app/frontend/src/app/auth/registrations/registrations-success.tpl.html +1 -0
- data/default_configuration/base_app/frontend/src/app/auth/registrations/registrations.js +14 -0
- data/default_configuration/base_app/frontend/src/app/auth/registrations/registrations.tpl.html +37 -0
- data/default_configuration/base_app/frontend/src/app/auth/registrations/registrationsControllers.js +25 -0
- data/default_configuration/base_app/frontend/src/app/auth/registrations/registrationsStates.js +18 -0
- data/default_configuration/base_app/frontend/src/app/auth/sessions/sessions-success.tpl.html +1 -0
- data/default_configuration/base_app/frontend/src/app/auth/sessions/sessions.js +18 -0
- data/default_configuration/base_app/frontend/src/app/auth/sessions/sessions.tpl.html +25 -0
- data/default_configuration/base_app/frontend/src/app/auth/sessions/sessionsControllers.js +26 -0
- data/default_configuration/base_app/frontend/src/app/auth/sessions/sessionsStates.js +20 -0
- data/default_configuration/base_app/frontend/src/app/homepage/homepage-show.tpl.html +2 -0
- data/default_configuration/base_app/frontend/src/app/homepage/homepage.js +10 -0
- data/default_configuration/base_app/frontend/src/app/homepage/homepage.tpl.html +13 -0
- data/default_configuration/base_app/frontend/src/app/homepage/homepageControllers.js +9 -0
- data/default_configuration/base_app/frontend/src/app/homepage/homepageStates.js +22 -0
- data/default_configuration/base_app/frontend/src/app/inner.tpl.html +16 -0
- data/default_configuration/base_app/frontend/src/app/root.tpl.html +2 -0
- data/default_configuration/base_app/frontend/src/app/rootController.js +8 -0
- data/default_configuration/base_app/frontend/src/app/rootStates.js +20 -0
- data/default_configuration/base_app/frontend/src/assets/README.md +4 -0
- data/default_configuration/base_app/frontend/src/assets/icons/alert.svg +1 -0
- data/default_configuration/base_app/frontend/src/common/README.md +19 -0
- data/default_configuration/base_app/frontend/src/common/components/OnLoginDirective/OnLoginDirective.js +17 -0
- data/default_configuration/base_app/frontend/src/common/components/adminOnly/admin-only.tpl.html +4 -0
- data/default_configuration/base_app/frontend/src/common/components/adminOnly/adminOnly.js +23 -0
- data/default_configuration/base_app/frontend/src/common/components/sessionLinks/session-links.tpl.html +5 -0
- data/default_configuration/base_app/frontend/src/common/components/sessionLinks/sessionLinks.js +25 -0
- data/default_configuration/base_app/frontend/src/common/components/signOut/signOut.js +19 -0
- data/default_configuration/base_app/frontend/src/common/config.js +27 -0
- data/default_configuration/base_app/frontend/src/index.html +86 -0
- data/default_configuration/base_app/frontend/src/styles/_constants.sass +14 -0
- data/default_configuration/base_app/frontend/src/styles/main.sass +52 -0
- data/default_configuration/base_app/frontend/src/styles/partials/_footer.sass +18 -0
- data/default_configuration/base_app/frontend/src/styles/partials/_forms.sass +9 -0
- data/default_configuration/base_app/frontend/src/styles/partials/_layout.sass +17 -0
- data/default_configuration/base_app/frontend/src/styles/partials/_navbar.sass +10 -0
- data/default_configuration/base_app/frontend/src/styles/partials/_typography.sass +18 -0
- data/default_configuration/base_app/frontend/src/styles/states/_errorFallback.sass +7 -0
- data/default_configuration/base_app/frontend/src/styles/states/_root_homepage.sass +8 -0
- data/default_configuration/base_app/frontend/test-help/xpath.js +9 -0
- data/default_configuration/base_app/frontend/test/app.js +24 -0
- data/default_configuration/base_app/frontend/test/auth/confirmations/confirmationsStates.js +46 -0
- data/default_configuration/base_app/frontend/test/auth/passwords/passwordsControllers.js +193 -0
- data/default_configuration/base_app/frontend/test/auth/passwords/passwordsStates.js +108 -0
- data/default_configuration/base_app/frontend/test/auth/registrations/registrationsControllers.js +117 -0
- data/default_configuration/base_app/frontend/test/auth/registrations/registrationsStates.js +64 -0
- data/default_configuration/base_app/frontend/test/auth/sessions/sessionsControllers.js +95 -0
- data/default_configuration/base_app/frontend/test/auth/sessions/sessionsStates.js +67 -0
- data/default_configuration/base_app/frontend/test/specHelper.js +33 -0
- data/default_configuration/base_app/frontend/test/support/mockDirective.js +13 -0
- data/default_configuration/base_app/frontend/test/support/stateResolveFn.js +3 -0
- data/default_configuration/base_app/frontend/test/support/testStates.js +20 -0
- data/default_configuration/base_app/frontend/tools.md +223 -0
- data/default_configuration/base_app/lib/capistrano/tasks/sidekiq.rake +218 -0
- data/default_configuration/base_app/static-app.ru +3 -0
- data/default_configuration/base_app/tmux-windows +68 -0
- data/default_configuration/base_app/tmux-windows.txt +53 -0
- data/lib/xing/cli.rb +8 -3
- data/lib/xing/cli/generators/new_project.rb +48 -13
- metadata +219 -7
@@ -0,0 +1,59 @@
|
|
1
|
+
# == Schema Information
|
2
|
+
#
|
3
|
+
# Table name: users
|
4
|
+
#
|
5
|
+
# id :integer not null, primary key
|
6
|
+
# login :string(20) not null
|
7
|
+
# email :string(255)
|
8
|
+
# first_name :string(60)
|
9
|
+
# last_name :string(60)
|
10
|
+
# sign_in_count :integer default(0), not null
|
11
|
+
# failed_attempts :integer default(0), not null
|
12
|
+
# last_request_at :datetime
|
13
|
+
# current_sign_in_at :datetime
|
14
|
+
# last_sign_in_at :datetime
|
15
|
+
# current_sign_in_ip :string(255)
|
16
|
+
# last_sign_in_ip :string(255)
|
17
|
+
# created_at :datetime
|
18
|
+
# updated_at :datetime
|
19
|
+
# encrypted_password :string(255)
|
20
|
+
# confirmation_token :string(255)
|
21
|
+
# confirmed_at :datetime
|
22
|
+
# confirmation_sent_at :datetime
|
23
|
+
# reset_password_token :string(255)
|
24
|
+
# reset_password_sent_at :datetime
|
25
|
+
# remember_token :string(255)
|
26
|
+
# remember_created_at :datetime
|
27
|
+
# unlock_token :string(255)
|
28
|
+
# locked_at :datetime
|
29
|
+
#
|
30
|
+
|
31
|
+
require 'spec_helper'
|
32
|
+
|
33
|
+
describe User do
|
34
|
+
describe "validations" do
|
35
|
+
describe "uniqueness" do
|
36
|
+
it "should not create two users with the same email" do
|
37
|
+
user_1 = FactoryGirl.create(:user, :email => 'foo@foo.com')
|
38
|
+
user_2 = FactoryGirl.build(:user, :email => 'foo@foo.com')
|
39
|
+
expect(user_1).to be_valid
|
40
|
+
expect(user_2).not_to be_valid
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "email confirmation" do
|
45
|
+
it "validations confirmation on create" do
|
46
|
+
user = FactoryGirl.build(:user, :email => 'foo@foo.com', :email_confirmation => "bar@bar.com")
|
47
|
+
expect(user).not_to be_valid
|
48
|
+
end
|
49
|
+
|
50
|
+
it "can update without checking confirmation" do
|
51
|
+
user = FactoryGirl.create(:user, :email => 'foo@foo.com')
|
52
|
+
user.reload
|
53
|
+
user.email = "bar@bar.com"
|
54
|
+
expect(user).to be_valid
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
# example JSON output from request
|
5
|
+
# {"links"=>{
|
6
|
+
# lists of route names and their uri templates
|
7
|
+
# (e.g "page" => "/pages/{url_slug}")
|
8
|
+
# },
|
9
|
+
# "data"=>
|
10
|
+
# {}
|
11
|
+
|
12
|
+
describe "resources#index", :type => :request do
|
13
|
+
|
14
|
+
describe "GET /resources" do
|
15
|
+
it "shows route templates asjson" do
|
16
|
+
json_get "/resources"
|
17
|
+
|
18
|
+
expect(response).to be_success
|
19
|
+
expect(parse_json(response.body,"links/validate_token")).to eq("/users/validate_token")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
|
6
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
+
# in spec/support/ and its subdirectories.
|
8
|
+
require 'waterpig'
|
9
|
+
require 'capybara/email/rspec'
|
10
|
+
require 'sidekiq/testing'
|
11
|
+
require 'xing/spec_helpers'
|
12
|
+
|
13
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
14
|
+
|
15
|
+
|
16
|
+
ActiveSupport::Deprecation.debug = true
|
17
|
+
|
18
|
+
TEST_PASSWORD = 'password'
|
19
|
+
TEST_IMAGE = File.join(Rails.root, '/spec/fixtures/test_image.png')
|
20
|
+
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.mock_with :rspec
|
24
|
+
|
25
|
+
config.use_transactional_fixtures = false
|
26
|
+
config.infer_spec_type_from_file_location!
|
27
|
+
config.waterpig_log_browser_console = true
|
28
|
+
|
29
|
+
config.waterpig_browser_sizes = {
|
30
|
+
:mobile => { :width => 348, :height => 480 },
|
31
|
+
:small => { :width => 550, :height => 700 },
|
32
|
+
:medium => { :width => 800, :height => 900 },
|
33
|
+
:desktop => { :width => 1024, :height => 1024 }
|
34
|
+
}
|
35
|
+
|
36
|
+
DatabaseCleaner.strategy = :transaction
|
37
|
+
|
38
|
+
|
39
|
+
config.before :all, :type => [ :view ] do
|
40
|
+
pending "Pending removal. Back-end does not use views."
|
41
|
+
end
|
42
|
+
|
43
|
+
config.before :each, :type => :controller do
|
44
|
+
@request.env['HTTP_ACCEPT'] = 'application/json'
|
45
|
+
@request.host = "api.example.com"
|
46
|
+
end
|
47
|
+
|
48
|
+
config.before :each, :type => :request do
|
49
|
+
host! "api.example.com"
|
50
|
+
end
|
51
|
+
|
52
|
+
config.before :each, :type => :request, :frontend => true do
|
53
|
+
host! "www.example.com"
|
54
|
+
end
|
55
|
+
|
56
|
+
config.waterpig_truncation_types = [:feature, :task]
|
57
|
+
end
|
58
|
+
|
59
|
+
def content_for(name)
|
60
|
+
view.instance_variable_get("@content_for_#{name}")
|
61
|
+
end
|
62
|
+
|
63
|
+
def routes
|
64
|
+
Rails.application.routes.url_helpers
|
65
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module DeviseExtraTestHelper
|
2
|
+
|
3
|
+
def current_user(stubs = {})
|
4
|
+
return nil if current_user_session.nil?
|
5
|
+
current_user_session.user
|
6
|
+
end
|
7
|
+
|
8
|
+
alias :current_person :current_user
|
9
|
+
|
10
|
+
def warden #:nodoc:
|
11
|
+
@warden ||= begin
|
12
|
+
manager = Warden::Manager.new(nil) do |config|
|
13
|
+
config.merge! Devise.warden_config
|
14
|
+
end
|
15
|
+
@request.env['warden'] = Warden::Proxy.new(@request.env, manager)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def sign_in(user)
|
20
|
+
warden
|
21
|
+
auth_header = user.create_new_auth_token
|
22
|
+
auth_header.each_pair do |k, v|
|
23
|
+
request.headers[k] = v
|
24
|
+
end
|
25
|
+
request.env['devise.mapping'] = :user
|
26
|
+
end
|
27
|
+
|
28
|
+
def sign_out(user)
|
29
|
+
end
|
30
|
+
|
31
|
+
def current_user_session(stubs = {}, user_stubs = {})
|
32
|
+
@current_user_session = UserSession.find
|
33
|
+
# else
|
34
|
+
# @current_user_session ||= mock_model(UserSession, {:person => current_user(user_stubs)}.merge(stubs))
|
35
|
+
# end
|
36
|
+
end
|
37
|
+
|
38
|
+
def login_as(user)
|
39
|
+
user = case user
|
40
|
+
when Symbol
|
41
|
+
Factory.create(user)
|
42
|
+
when String
|
43
|
+
FactoryGirl.create(user.to_sym)
|
44
|
+
when User
|
45
|
+
user
|
46
|
+
else
|
47
|
+
raise "Could not figure out login_as mapping for #{user.inspect}"
|
48
|
+
end
|
49
|
+
sign_in user
|
50
|
+
user
|
51
|
+
end
|
52
|
+
alias authenticate login_as
|
53
|
+
|
54
|
+
def logout
|
55
|
+
sign_out :user
|
56
|
+
end
|
57
|
+
|
58
|
+
def verify_authorization_successful
|
59
|
+
expect(response).not_to redirect_to(login_path)
|
60
|
+
end
|
61
|
+
|
62
|
+
def verify_authorization_unsuccessful
|
63
|
+
expect(response).to redirect_to(login_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
module RSpec::Rails::ControllerExampleGroup
|
69
|
+
include DeviseExtraTestHelper
|
70
|
+
end
|
71
|
+
|
72
|
+
module RSpec::Rails::ViewExampleGroup
|
73
|
+
include DeviseExtraTestHelper
|
74
|
+
end
|
75
|
+
|
76
|
+
module RSpec::Rails::HelperExampleGroup
|
77
|
+
include DeviseExtraTestHelper
|
78
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rspec-steps'
|
2
|
+
|
3
|
+
|
4
|
+
RSpec.shared_steps "expand the menu" do
|
5
|
+
collapsed_menu_sizes=[ :mobile, :small ]
|
6
|
+
|
7
|
+
it "clicks on the menu (if needed)" do |example|
|
8
|
+
if collapsed_menu_sizes.include?(Waterpig::BrowserSize.current_size(example))
|
9
|
+
click_on('Menu')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec.shared_steps "visit login" do
|
15
|
+
it "visits root" do
|
16
|
+
begin
|
17
|
+
visit '/'
|
18
|
+
rescue Object => ex
|
19
|
+
p ex
|
20
|
+
raise
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
perform_steps "expand the menu"
|
25
|
+
|
26
|
+
it "clicks on Sign In" do
|
27
|
+
within ".session-links" do
|
28
|
+
click_link "Sign In"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
RSpec.shared_steps "sign up with" do
|
34
|
+
it "visits root" do
|
35
|
+
visit '/'
|
36
|
+
end
|
37
|
+
|
38
|
+
perform_steps "expand the menu"
|
39
|
+
|
40
|
+
it "clicks Sign Up" do
|
41
|
+
click_on "Sign Up"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "fills in email and pasword" do
|
45
|
+
fill_in "Email", :with => @user.email
|
46
|
+
fill_in "Email Confirmation", :with => @user.email
|
47
|
+
fill_in "Password", :with => @user.password
|
48
|
+
fill_in "Password Confirmation", :with => @user.password
|
49
|
+
end
|
50
|
+
|
51
|
+
it "clicks Sign Up" do
|
52
|
+
click_button "Sign Up"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
RSpec.shared_steps "sign in with" do
|
57
|
+
perform_steps "visit login"
|
58
|
+
|
59
|
+
it "fills in email and password" do
|
60
|
+
fill_in "Email", :with => @user.email
|
61
|
+
fill_in "Password", :with => @user.password
|
62
|
+
end
|
63
|
+
|
64
|
+
it "clicks Sign In" do
|
65
|
+
click_button "Sign In"
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
describe 'db:sample_data namespace rake task',
|
5
|
+
:vcr => { :cassette_name => "rake_task/db_sample_data_load", :allow_playback_repeats => true},
|
6
|
+
:type => :task do
|
7
|
+
|
8
|
+
before do
|
9
|
+
Rake::Application.new.rake_require "xing/tasks/sample_data"
|
10
|
+
Rake::Task.define_task(:environment)
|
11
|
+
Rake::Task.define_task('db:seed')
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should succeed and create reasonable data" do
|
15
|
+
Rake::Task["db:sample_data:load"].invoke
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'compass/import-once/activate'
|
2
|
+
# Require any additional compass plugins here.
|
3
|
+
|
4
|
+
# Set this to the root of your project when deployed:
|
5
|
+
http_path = "/"
|
6
|
+
css_dir = "frontend/build/stylesheets"
|
7
|
+
sass_dir = "frontend/src/sass/"
|
8
|
+
images_dir = "images"
|
9
|
+
javascripts_dir = "javascripts"
|
10
|
+
|
11
|
+
add_import_path "frontend/vendor"
|
12
|
+
|
13
|
+
# You can select your preferred output style here (can be overridden via the
|
14
|
+
# command line):
|
15
|
+
# output_style = :expanded or :nested or :compact or :compressed
|
16
|
+
|
17
|
+
# To enable relative paths to assets via compass helper functions. Uncomment:
|
18
|
+
# relative_assets = true
|
19
|
+
|
20
|
+
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
21
|
+
# line_comments = false
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# config valid only for Capistrano 3.1
|
2
|
+
lock '3.4'
|
3
|
+
|
4
|
+
set :repo_url, 'git@git.lrdesign.com:lrd/cms2.git'
|
5
|
+
set :pty, true
|
6
|
+
|
7
|
+
# Default value for :format is :pretty
|
8
|
+
# set :format, :pretty
|
9
|
+
|
10
|
+
# Default value for :log_level is :debug
|
11
|
+
# set :log_level, :debug
|
12
|
+
|
13
|
+
set :linked_files, %w{
|
14
|
+
frontend/config/environments/production.js
|
15
|
+
backend/config/database.yml
|
16
|
+
backend/config/secrets.yml
|
17
|
+
backend/public/sitemap.xml
|
18
|
+
}
|
19
|
+
set :linked_dirs, %w{
|
20
|
+
frontend/node_modules
|
21
|
+
backend/log
|
22
|
+
backend/tmp/pids
|
23
|
+
backend/tmp/cache
|
24
|
+
backend/tmp/sockets
|
25
|
+
backend/vendor/bundle
|
26
|
+
backend/public/system
|
27
|
+
}
|
28
|
+
|
29
|
+
# These files and directories must be writeable by user 'apache'
|
30
|
+
# or deploy is not considered successful
|
31
|
+
set :required_writeable_files, %w{
|
32
|
+
backend/log
|
33
|
+
backend/tmp/pids
|
34
|
+
backend/tmp/cache
|
35
|
+
backend/public/system
|
36
|
+
backend/public/sitemap.xml
|
37
|
+
}
|
38
|
+
|
39
|
+
# Default value for default_env is {}
|
40
|
+
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
41
|
+
|
42
|
+
# Default value for keep_releases is 5
|
43
|
+
# set :keep_releases, 5
|
44
|
+
|
45
|
+
set :backend_path, proc{ File::join(release_path, "backend") }
|
46
|
+
set :backend_shared, proc{ File::join(shared_path, "backend") }
|
47
|
+
set :webserver_group, "apache"
|
48
|
+
set :webserver_user, "apache"
|
49
|
+
|
50
|
+
set :sidekiq_default_hooks, false
|
51
|
+
set :sidekiq_log, proc{ File::join(fetch(:backend_shared), "log", "sidekiq.log") }
|
52
|
+
set :sidekiq_pid, proc{ File::join(fetch(:backend_shared), 'tmp', 'pids', 'sidekiq.pid') }
|
53
|
+
set :sidekiq_path, proc{ fetch(:backend_path) }
|
54
|
+
|
55
|
+
namespace :deploy do
|
56
|
+
desc 'Build app'
|
57
|
+
task :build do
|
58
|
+
on roles(:app), :in => :parallel do
|
59
|
+
within release_path do
|
60
|
+
with :rails_env => fetch(:stage) do
|
61
|
+
rake "build"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
after 'symlink:shared', :build
|
67
|
+
|
68
|
+
task :bundle_config do
|
69
|
+
on roles(:app), :in => :parallel do
|
70
|
+
execute "mkdir -p #{fetch(:backend_path)}/.bundle"
|
71
|
+
bundle_config = StringIO.new(<<-EOC)
|
72
|
+
---
|
73
|
+
BUNDLE_FROZEN: '1'
|
74
|
+
BUNDLE_PATH: "#{File::join(shared_path, "backend/vendor/bundle")}"
|
75
|
+
BUNDLE_DISABLE_SHARED_GEMS: '1'
|
76
|
+
EOC
|
77
|
+
upload! bundle_config, "#{fetch(:backend_path)}/.bundle/config"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
before :build, :bundle_config
|
81
|
+
|
82
|
+
task :perms do
|
83
|
+
on roles(:app), :in => :parallel do
|
84
|
+
%w{.bundle public tmp log}.each do |dir|
|
85
|
+
within File::join(release_path, "backend") do
|
86
|
+
as(:root) do
|
87
|
+
execute "chown", [fetch(:webserver_user),fetch(:webserver_group)].join(":"), "-RL", dir
|
88
|
+
execute "chmod", "g+wX", "-R", dir
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
after 'symlink:shared', :perms
|
95
|
+
|
96
|
+
task :confirm_writeable_files do
|
97
|
+
on roles(:app), :in => :parallel do
|
98
|
+
fetch(:required_writeable_files).each do |filename|
|
99
|
+
can_write = capture("sudo -u apache test -w #{File::join(release_path, filename)} && echo yes || echo no")
|
100
|
+
unless can_write == "yes"
|
101
|
+
error "Test for writeability failed. User 'apache' cannot write #{filename}."
|
102
|
+
exit 1
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
after 'symlink:shared', :confirm_writeable_files
|
108
|
+
|
109
|
+
desc 'Restart application'
|
110
|
+
task :restart do
|
111
|
+
on roles(:app), in: :sequence, wait: 5 do
|
112
|
+
within fetch(:backend_path) do
|
113
|
+
execute :touch, 'tmp/restart.txt'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
desc "Preload the rails app"
|
119
|
+
task :warm_up_rails do
|
120
|
+
if url = fetch(:rails_warmup_url)
|
121
|
+
puts "Attempting to warm up the rails app."
|
122
|
+
sh "curl -H \"Accept: application/json\" #{url} > /dev/null"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
desc "Update site snapshots"
|
127
|
+
task :take_snapshot do
|
128
|
+
on roles(:app), in: :sequence, wait: 5 do
|
129
|
+
within fetch(:backend_path) do
|
130
|
+
with :rails_env => fetch(:stage) do
|
131
|
+
execute :bundle, 'exec', 'rake', "take_snapshot"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
after 'symlink:shared', :build
|
138
|
+
|
139
|
+
after :publishing, :restart
|
140
|
+
after :publishing, :warm_up_rails
|
141
|
+
after :restart, :take_snapshot
|
142
|
+
|
143
|
+
after :take_snapshot, 'sidekiq:restart'
|
144
|
+
after :published, 'sidekiq:start'
|
145
|
+
|
146
|
+
|
147
|
+
# after :restart, :clear_cache do
|
148
|
+
# on roles(:web), in: :groups, limit: 3, wait: 10 do
|
149
|
+
# # Here we can do anything such as:
|
150
|
+
# within fetch(:backend_path) do
|
151
|
+
# with :rails_env => fetch(:stage) do
|
152
|
+
# execute :bundle, 'exec', 'rake', 'cache:clear'
|
153
|
+
# end
|
154
|
+
# end
|
155
|
+
# end
|
156
|
+
# end
|
157
|
+
end
|