faalis 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +339 -0
- data/README.md +45 -0
- data/Rakefile +42 -0
- data/app/assets/fonts/DroidNaskh-Bold.ttf +0 -0
- data/app/assets/fonts/DroidNaskh-Regular.ttf +0 -0
- data/app/assets/fonts/OpenSans-Bold.ttf +0 -0
- data/app/assets/fonts/OpenSans-BoldItalic.ttf +0 -0
- data/app/assets/fonts/OpenSans-ExtraBold.ttf +0 -0
- data/app/assets/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- data/app/assets/fonts/OpenSans-Italic.ttf +0 -0
- data/app/assets/fonts/OpenSans-Light.ttf +0 -0
- data/app/assets/fonts/OpenSans-LightItalic.ttf +0 -0
- data/app/assets/fonts/OpenSans-Regular.ttf +0 -0
- data/app/assets/fonts/OpenSans-Semibold.ttf +0 -0
- data/app/assets/fonts/OpenSans-SemiboldItalic.ttf +0 -0
- data/app/assets/images/faalis/select2-spinner.gif +0 -0
- data/app/assets/images/faalis/select2.png +0 -0
- data/app/assets/images/faalis/select2x2.png +0 -0
- data/app/assets/javascripts/faalis/application.js +20 -0
- data/app/assets/javascripts/faalis/dashboard/angular.js +9 -0
- data/app/assets/javascripts/faalis/dashboard/app.js +75 -0
- data/app/assets/javascripts/faalis/dashboard/application.js.erb +21 -0
- data/app/assets/javascripts/faalis/dashboard/functions.js.erb +91 -0
- data/app/assets/javascripts/faalis/dashboard/init.js +38 -0
- data/app/assets/javascripts/faalis/dashboard/lib/angular-animate.js +1226 -0
- data/app/assets/javascripts/faalis/dashboard/lib/angular-gettext.js +202 -0
- data/app/assets/javascripts/faalis/dashboard/lib/angular-resource.js +578 -0
- data/app/assets/javascripts/faalis/dashboard/lib/angular-route.js +880 -0
- data/app/assets/javascripts/faalis/dashboard/lib/angular.js +20031 -0
- data/app/assets/javascripts/faalis/dashboard/lib/lodash.underscore.js +4893 -0
- data/app/assets/javascripts/faalis/dashboard/lib/ng-grid.js +3260 -0
- data/app/assets/javascripts/faalis/dashboard/lib/ng-quick-date.js +297 -0
- data/app/assets/javascripts/faalis/dashboard/lib/restangular.js +1066 -0
- data/app/assets/javascripts/faalis/dashboard/lib/select2.js +3255 -0
- data/app/assets/javascripts/faalis/dashboard/lib/ui.select2.js +217 -0
- data/app/assets/javascripts/faalis/dashboard/locale/translations.js +5 -0
- data/app/assets/javascripts/faalis/dashboard/modules/anim.js +32 -0
- data/app/assets/javascripts/faalis/dashboard/modules/api.js +32 -0
- data/app/assets/javascripts/faalis/dashboard/modules/auth/auth.js +34 -0
- data/app/assets/javascripts/faalis/dashboard/modules/auth/group.js +174 -0
- data/app/assets/javascripts/faalis/dashboard/modules/auth/profile.js +59 -0
- data/app/assets/javascripts/faalis/dashboard/modules/auth/user.js +123 -0
- data/app/assets/javascripts/faalis/dashboard/modules/errors.js +47 -0
- data/app/assets/javascripts/faalis/dashboard/modules/filter.js +44 -0
- data/app/assets/javascripts/faalis/dashboard/modules/list-view.js +310 -0
- data/app/assets/javascripts/faalis/dashboard/modules/logs.js +41 -0
- data/app/assets/javascripts/faalis/dashboard/modules/modules.js +50 -0
- data/app/assets/javascripts/faalis/dashboard/modules/nav.js.erb +97 -0
- data/app/assets/javascripts/faalis/dashboard/templates/application.handlebars.erb +42 -0
- data/app/assets/javascripts/faalis/dashboard/templates/auth/groups/details.handlebars.erb +15 -0
- data/app/assets/javascripts/faalis/dashboard/templates/auth/groups/index.handlebars.erb +7 -0
- data/app/assets/javascripts/faalis/dashboard/templates/auth/groups/new.handlebars.erb +39 -0
- data/app/assets/javascripts/faalis/dashboard/templates/auth/index.handlebars.erb +31 -0
- data/app/assets/javascripts/faalis/dashboard/templates/auth/users/details.handlebars.erb +15 -0
- data/app/assets/javascripts/faalis/dashboard/templates/auth/users/index.handlebars.erb +11 -0
- data/app/assets/javascripts/faalis/dashboard/templates/auth/users/new.handlebars.erb +33 -0
- data/app/assets/javascripts/faalis/dashboard/templates/components/list-view.handlebars.erb +59 -0
- data/app/assets/javascripts/faalis/dashboard/templates/components/model-form.handlebars.erb +3 -0
- data/app/assets/javascripts/faalis/dashboard/templates/modules.handlebars.erb +15 -0
- data/app/assets/javascripts/faalis/dashboard/templates/navigation.handlebars.erb +43 -0
- data/app/assets/javascripts/faalis/dashboard/templates/widgets.handlebars +23 -0
- data/app/assets/javascripts/faalis/dashboard/variables.js.erb +17 -0
- data/app/assets/javascripts/faalis/groups.js +2 -0
- data/app/assets/javascripts/faalis/home.js +2 -0
- data/app/assets/javascripts/faalis/i18n.js +13 -0
- data/app/assets/javascripts/faalis/locale/en.json +27 -0
- data/app/assets/javascripts/faalis/locale/fa.json +27 -0
- data/app/assets/javascripts/faalis/users.js +2 -0
- data/app/assets/stylesheets/faalis/base.css.scss +264 -0
- data/app/assets/stylesheets/faalis/dashboard/dashboard.css.scss +226 -0
- data/app/assets/stylesheets/faalis/dashboard/list_view.css.scss +169 -0
- data/app/assets/stylesheets/faalis/dashboard/ltr/application.css +26 -0
- data/app/assets/stylesheets/faalis/dashboard/ltr/base.css.scss.erb +28 -0
- data/app/assets/stylesheets/faalis/dashboard/ltr/buttons.css.scss.erb +48 -0
- data/app/assets/stylesheets/faalis/dashboard/ltr/direction.css.scss +38 -0
- data/app/assets/stylesheets/faalis/dashboard/ltr/foundation_and_overrides.css.scss +1014 -0
- data/app/assets/stylesheets/faalis/dashboard/ng-grid.css.scss +442 -0
- data/app/assets/stylesheets/faalis/dashboard/ng-quick-date-default-theme.css.scss +20 -0
- data/app/assets/stylesheets/faalis/dashboard/ng-quick-date.css.scss +19 -0
- data/app/assets/stylesheets/faalis/dashboard/rtl/application.css +26 -0
- data/app/assets/stylesheets/faalis/dashboard/rtl/base.css.scss.erb +31 -0
- data/app/assets/stylesheets/faalis/dashboard/rtl/base.css_flymake.scss +25 -0
- data/app/assets/stylesheets/faalis/dashboard/rtl/buttons.css.scss.erb +45 -0
- data/app/assets/stylesheets/faalis/dashboard/rtl/direction.css.scss +37 -0
- data/app/assets/stylesheets/faalis/dashboard/rtl/foundation_and_overrides.css.scss +1014 -0
- data/app/assets/stylesheets/faalis/dashboard/select2.css.scss.erb +618 -0
- data/app/assets/stylesheets/faalis/dashboard/sidebar.css.scss +93 -0
- data/app/assets/stylesheets/faalis/devise.css.scss +34 -0
- data/app/assets/stylesheets/faalis/groups.css +4 -0
- data/app/assets/stylesheets/faalis/home.css.scss +14 -0
- data/app/assets/stylesheets/faalis/ltr/application.css +20 -0
- data/app/assets/stylesheets/faalis/ltr/buttons.css.scss.erb +48 -0
- data/app/assets/stylesheets/faalis/ltr/foundation_and_overrides.scss.erb +1012 -0
- data/app/assets/stylesheets/faalis/mixins.css.scss +15 -0
- data/app/assets/stylesheets/faalis/rtl/application.css +20 -0
- data/app/assets/stylesheets/faalis/rtl/buttons.css.scss.erb +48 -0
- data/app/assets/stylesheets/faalis/rtl/foundation_and_overrides.scss.erb +1012 -0
- data/app/assets/stylesheets/faalis/users.css +4 -0
- data/app/assets/stylesheets/faalis/variables.css.scss +102 -0
- data/app/controllers/faalis/api/v1/groups_controller.rb +75 -0
- data/app/controllers/faalis/api/v1/logs_controller.rb +12 -0
- data/app/controllers/faalis/api/v1/permissions_controller.rb +17 -0
- data/app/controllers/faalis/api/v1/profiles_controller.rb +42 -0
- data/app/controllers/faalis/api/v1/users_controller.rb +75 -0
- data/app/controllers/faalis/api_controller.rb +51 -0
- data/app/controllers/faalis/application_controller.rb +34 -0
- data/app/controllers/faalis/dashboard_controller.rb +44 -0
- data/app/controllers/faalis/home_controller.rb +19 -0
- data/app/controllers/faalis/omniauth/callbacks_controller.rb +43 -0
- data/app/helpers/faalis/application_helper.rb +4 -0
- data/app/helpers/faalis/dashboard_helper.rb +5 -0
- data/app/helpers/faalis/groups_helper.rb +4 -0
- data/app/helpers/faalis/home_helper.rb +4 -0
- data/app/helpers/faalis/users_helper.rb +4 -0
- data/app/models/ability.rb +42 -0
- data/app/models/faalis/group.rb +27 -0
- data/app/models/faalis/permission.rb +15 -0
- data/app/models/faalis/user.rb +81 -0
- data/app/views/angularjs_templates/#index.html# +8 -0
- data/app/views/angularjs_templates/auth/groups/details.html +21 -0
- data/app/views/angularjs_templates/auth/groups/index.html +5 -0
- data/app/views/angularjs_templates/auth/groups/new.html +41 -0
- data/app/views/angularjs_templates/auth/index.html +30 -0
- data/app/views/angularjs_templates/auth/profile/edit.html +54 -0
- data/app/views/angularjs_templates/auth/users/details.html +28 -0
- data/app/views/angularjs_templates/auth/users/index.html +6 -0
- data/app/views/angularjs_templates/auth/users/new.html +56 -0
- data/app/views/angularjs_templates/filter/index.html +15 -0
- data/app/views/angularjs_templates/index.html +8 -0
- data/app/views/angularjs_templates/list-view/index.html +81 -0
- data/app/views/angularjs_templates/locale/fa.po +25 -0
- data/app/views/angularjs_templates/locale/templates.pot +24 -0
- data/app/views/angularjs_templates/logs/index.html +6 -0
- data/app/views/angularjs_templates/modules.html +17 -0
- data/app/views/angularjs_templates/nav.html.erb +38 -0
- data/app/views/devise/confirmations/new.html.erb +34 -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 +44 -0
- data/app/views/devise/passwords/new.html.erb +32 -0
- data/app/views/devise/registrations/edit.html.erb +29 -0
- data/app/views/devise/registrations/new.html.erb +91 -0
- data/app/views/devise/sessions/new.html.erb +98 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +30 -0
- data/app/views/faalis/api/v1/groups/create.json.jbuilder +4 -0
- data/app/views/faalis/api/v1/groups/destroy.html.erb +2 -0
- data/app/views/faalis/api/v1/groups/destroy.json.jbuilder +1 -0
- data/app/views/faalis/api/v1/groups/edit.html.erb +2 -0
- data/app/views/faalis/api/v1/groups/index.html.erb +2 -0
- data/app/views/faalis/api/v1/groups/index.json.jbuilder +6 -0
- data/app/views/faalis/api/v1/groups/new.html.erb +2 -0
- data/app/views/faalis/api/v1/groups/show.html.erb +2 -0
- data/app/views/faalis/api/v1/groups/show.json.jbuilder +5 -0
- data/app/views/faalis/api/v1/groups/update.json.jbuilder +4 -0
- data/app/views/faalis/api/v1/logs/index.json.jbuilder +1 -0
- data/app/views/faalis/api/v1/permissions/index.json.jbuilder +1 -0
- data/app/views/faalis/api/v1/users/create.html.erb +2 -0
- data/app/views/faalis/api/v1/users/create.json.jbuilder +1 -0
- data/app/views/faalis/api/v1/users/destroy.json.jbuilder +1 -0
- data/app/views/faalis/api/v1/users/distroy.html.erb +2 -0
- data/app/views/faalis/api/v1/users/edit.html.erb +2 -0
- data/app/views/faalis/api/v1/users/index.html.erb +2 -0
- data/app/views/faalis/api/v1/users/index.json.jbuilder +4 -0
- data/app/views/faalis/api/v1/users/show.html.erb +2 -0
- data/app/views/faalis/api/v1/users/show.json.jbuilder +2 -0
- data/app/views/faalis/api/v1/users/update.json.jbuilder +1 -0
- data/app/views/faalis/dashboard/index.html.erb +37 -0
- data/app/views/faalis/dashboard/login_required_page.html.erb +5 -0
- data/app/views/faalis/home/index.html.erb +119 -0
- data/app/views/layouts/faalis/application.html.erb +90 -0
- data/app/views/layouts/faalis/dashboard.html.erb +21 -0
- data/config/initializers/devise.rb +28 -0
- data/config/locales/devise.en.yml +59 -0
- data/config/locales/devise.fa.yml +56 -0
- data/config/locales/fa/LC_MESSAGES/faalis.mo +0 -0
- data/config/locales/fa/faalis.po +181 -0
- data/config/locales/fa/messages.mo +0 -0
- data/config/locales/faalis.pot +181 -0
- data/config/routes.rb +36 -0
- data/db/migrate/20131013091000_devise_create_red_base_users.rb +64 -0
- data/db/migrate/20131020124701_create_red_base_groups.rb +9 -0
- data/db/migrate/20131021170923_create_red_base_permissions.rb +10 -0
- data/db/migrate/20131123120422_add_permissions_groups_table.rb +8 -0
- data/db/seeds.rb +15 -0
- data/lib/faalis.rb +30 -0
- data/lib/faalis/active_record.rb +64 -0
- data/lib/faalis/api.rb +61 -0
- data/lib/faalis/api/groups_api.rb +41 -0
- data/lib/faalis/api/permissions_api.rb +24 -0
- data/lib/faalis/api/root.rb +15 -0
- data/lib/faalis/api/users_api.rb +20 -0
- data/lib/faalis/cucumber.rb +25 -0
- data/lib/faalis/cucumber/auth.rb +45 -0
- data/lib/faalis/cucumber/exceptions.rb +40 -0
- data/lib/faalis/cucumber/interaction.rb +43 -0
- data/lib/faalis/cucumber/query.rb +28 -0
- data/lib/faalis/cucumber/urls.rb +76 -0
- data/lib/faalis/dashboard.rb +60 -0
- data/lib/faalis/dashboard/controller.rb +42 -0
- data/lib/faalis/dashboard/module.rb +45 -0
- data/lib/faalis/engine.rb +128 -0
- data/lib/faalis/exceptions.rb +26 -0
- data/lib/faalis/i18n.rb +35 -0
- data/lib/faalis/initialize.rb +7 -0
- data/lib/faalis/omniauth.rb +24 -0
- data/lib/faalis/omniauth/callbacks.rb +58 -0
- data/lib/faalis/plugins.rb +44 -0
- data/lib/faalis/version.rb +22 -0
- data/lib/faalis_plugin.rb +476 -0
- data/lib/generators/faalis/USAGE +8 -0
- data/lib/generators/faalis/angularjs_resource_generator.rb +74 -0
- data/lib/generators/faalis/install_all_generator.rb +38 -0
- data/lib/generators/faalis/install_generator.rb +42 -0
- data/lib/generators/faalis/install_specs_generator.rb +48 -0
- data/lib/generators/faalis/js_scaffold_generator.rb +273 -0
- data/lib/generators/faalis/templates/README +41 -0
- data/lib/generators/faalis/templates/SPECS +13 -0
- data/lib/generators/faalis/templates/angularjs/details.html.erb +20 -0
- data/lib/generators/faalis/templates/angularjs/index.html.erb +62 -0
- data/lib/generators/faalis/templates/angularjs/module.js.erb +309 -0
- data/lib/generators/faalis/templates/angularjs/new.html.erb +105 -0
- data/lib/generators/faalis/templates/api/controller.rb.erb +56 -0
- data/lib/generators/faalis/templates/devise.rb +251 -0
- data/lib/generators/faalis/templates/faalis.rb +14 -0
- data/lib/generators/faalis/templates/fast_gettext.rb +4 -0
- data/lib/generators/faalis/templates/features/api.feature +92 -0
- data/lib/generators/faalis/templates/features/api.step.rb +7 -0
- data/lib/generators/faalis/templates/features/step_definitions/email_steps.rb +206 -0
- data/lib/generators/faalis/templates/features/support/email_spec.rb +1 -0
- data/lib/generators/faalis/templates/features/support/env.rb +79 -0
- data/lib/generators/faalis/templates/formtastic.rb +76 -0
- data/lib/generators/faalis/templates/js_scaffold.README +25 -0
- data/lib/generators/faalis/templates/seeds.rb +1 -0
- data/lib/generators/faalis/templates/spec/factories/groups.rb +5 -0
- data/lib/generators/faalis/templates/spec/factories/users.rb +10 -0
- data/lib/generators/faalis/templates/spec/spec_helper.rb +69 -0
- data/lib/generators/faalis/templates/spec/support/devise.rb +3 -0
- data/lib/generators/faalis/templates/views/create.json.jbuilder.erb +2 -0
- data/lib/generators/faalis/templates/views/destroy.json.jbuilder.erb +1 -0
- data/lib/generators/faalis/templates/views/index.json.jbuilder.erb +10 -0
- data/lib/generators/faalis/templates/views/show.json.jbuilder.erb +7 -0
- data/lib/generators/faalis/templates/views/update.json.jbuilder.erb +6 -0
- data/lib/generators/faalis/views_generator.rb +41 -0
- data/lib/tasks/faalis_tasks.rake +23 -0
- data/lib/tasks/grunt/Gruntfile.js +25 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +15 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/ember-rails/ember-data.js +10204 -0
- data/spec/dummy/tmp/ember-rails/ember.js +36991 -0
- data/spec/spec_helper.rb +52 -0
- metadata +678 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Commonly used email steps
|
|
2
|
+
#
|
|
3
|
+
# To add your own steps make a custom_email_steps.rb
|
|
4
|
+
# The provided methods are:
|
|
5
|
+
#
|
|
6
|
+
# last_email_address
|
|
7
|
+
# reset_mailer
|
|
8
|
+
# open_last_email
|
|
9
|
+
# visit_in_email
|
|
10
|
+
# unread_emails_for
|
|
11
|
+
# mailbox_for
|
|
12
|
+
# current_email
|
|
13
|
+
# open_email
|
|
14
|
+
# read_emails_for
|
|
15
|
+
# find_email
|
|
16
|
+
#
|
|
17
|
+
# General form for email scenarios are:
|
|
18
|
+
# - clear the email queue (done automatically by email_spec)
|
|
19
|
+
# - execute steps that sends an email
|
|
20
|
+
# - check the user received an/no/[0-9] emails
|
|
21
|
+
# - open the email
|
|
22
|
+
# - inspect the email contents
|
|
23
|
+
# - interact with the email (e.g. click links)
|
|
24
|
+
#
|
|
25
|
+
# The Cucumber steps below are setup in this order.
|
|
26
|
+
|
|
27
|
+
module EmailHelpers
|
|
28
|
+
def current_email_address
|
|
29
|
+
# Replace with your a way to find your current email. e.g @current_user.email
|
|
30
|
+
# last_email_address will return the last email address used by email spec to find an email.
|
|
31
|
+
# Note that last_email_address will be reset after each Scenario.
|
|
32
|
+
last_email_address || "example@example.com"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
World(EmailHelpers)
|
|
37
|
+
|
|
38
|
+
#
|
|
39
|
+
# Reset the e-mail queue within a scenario.
|
|
40
|
+
# This is done automatically before each scenario.
|
|
41
|
+
#
|
|
42
|
+
|
|
43
|
+
Given /^(?:a clear email queue|no emails have been sent)$/ do
|
|
44
|
+
reset_mailer
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
#
|
|
48
|
+
# Check how many emails have been sent/received
|
|
49
|
+
#
|
|
50
|
+
|
|
51
|
+
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/ do |address, amount|
|
|
52
|
+
unread_emails_for(address).size.should == parse_email_count(amount)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
Then /^(?:I|they|"([^"]*?)") should have (an|no|\d+) emails?$/ do |address, amount|
|
|
56
|
+
mailbox_for(address).size.should == parse_email_count(amount)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([^"]*?)"$/ do |address, amount, subject|
|
|
60
|
+
unread_emails_for(address).select { |m| m.subject =~ Regexp.new(Regexp.escape(subject)) }.size.should == parse_email_count(amount)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject \/([^"]*?)\/$/ do |address, amount, subject|
|
|
64
|
+
unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size.should == parse_email_count(amount)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body|
|
|
68
|
+
open_email(address, :with_text => expected_body)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
#
|
|
72
|
+
# Accessing emails
|
|
73
|
+
#
|
|
74
|
+
|
|
75
|
+
# Opens the most recently received email
|
|
76
|
+
When /^(?:I|they|"([^"]*?)") opens? the email$/ do |address|
|
|
77
|
+
open_email(address)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
When /^(?:I|they|"([^"]*?)") opens? the email with subject "([^"]*?)"$/ do |address, subject|
|
|
81
|
+
open_email(address, :with_subject => subject)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
When /^(?:I|they|"([^"]*?)") opens? the email with subject \/([^"]*?)\/$/ do |address, subject|
|
|
85
|
+
open_email(address, :with_subject => Regexp.new(subject))
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
When /^(?:I|they|"([^"]*?)") opens? the email with text "([^"]*?)"$/ do |address, text|
|
|
89
|
+
open_email(address, :with_text => text)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
When /^(?:I|they|"([^"]*?)") opens? the email with text \/([^"]*?)\/$/ do |address, text|
|
|
93
|
+
open_email(address, :with_text => Regexp.new(text))
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
#
|
|
97
|
+
# Inspect the Email Contents
|
|
98
|
+
#
|
|
99
|
+
|
|
100
|
+
Then /^(?:I|they) should see "([^"]*?)" in the email subject$/ do |text|
|
|
101
|
+
current_email.should have_subject(text)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
Then /^(?:I|they) should see \/([^"]*?)\/ in the email subject$/ do |text|
|
|
105
|
+
current_email.should have_subject(Regexp.new(text))
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
Then /^(?:I|they) should see "([^"]*?)" in the email body$/ do |text|
|
|
109
|
+
current_email.default_part_body.to_s.should include(text)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
Then /^(?:I|they) should see \/([^"]*?)\/ in the email body$/ do |text|
|
|
113
|
+
current_email.default_part_body.to_s.should =~ Regexp.new(text)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
Then /^(?:I|they) should see the email delivered from "([^"]*?)"$/ do |text|
|
|
117
|
+
current_email.should be_delivered_from(text)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
Then /^(?:I|they) should see "([^\"]*)" in the email "([^"]*?)" header$/ do |text, name|
|
|
121
|
+
current_email.should have_header(name, text)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
Then /^(?:I|they) should see \/([^\"]*)\/ in the email "([^"]*?)" header$/ do |text, name|
|
|
125
|
+
current_email.should have_header(name, Regexp.new(text))
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
Then /^I should see it is a multi\-part email$/ do
|
|
129
|
+
current_email.should be_multipart
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
Then /^(?:I|they) should see "([^"]*?)" in the email html part body$/ do |text|
|
|
133
|
+
current_email.html_part.body.to_s.should include(text)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
Then /^(?:I|they) should see "([^"]*?)" in the email text part body$/ do |text|
|
|
137
|
+
current_email.text_part.body.to_s.should include(text)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
#
|
|
141
|
+
# Inspect the Email Attachments
|
|
142
|
+
#
|
|
143
|
+
|
|
144
|
+
Then /^(?:I|they) should see (an|no|\d+) attachments? with the email$/ do |amount|
|
|
145
|
+
current_email_attachments.size.should == parse_email_count(amount)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename|
|
|
149
|
+
current_email_attachments.select { |a| a.filename == filename }.size.should == parse_email_count(amount)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
|
|
153
|
+
current_email_attachments[(index.to_i - 1)].filename.should == filename
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type|
|
|
157
|
+
current_email_attachments.select { |a| a.content_type.include?(content_type) }.size.should == parse_email_count(amount)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type|
|
|
161
|
+
current_email_attachments[(index.to_i - 1)].content_type.should include(content_type)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
Then /^all attachments should not be blank$/ do
|
|
165
|
+
current_email_attachments.each do |attachment|
|
|
166
|
+
attachment.read.size.should_not == 0
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
Then /^show me a list of email attachments$/ do
|
|
171
|
+
EmailSpec::EmailViewer::save_and_open_email_attachments_list(current_email)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
#
|
|
175
|
+
# Interact with Email Contents
|
|
176
|
+
#
|
|
177
|
+
|
|
178
|
+
When /^(?:I|they|"([^"]*?)") follows? "([^"]*?)" in the email$/ do |address, link|
|
|
179
|
+
visit_in_email(link, address)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
When /^(?:I|they) click the first link in the email$/ do
|
|
183
|
+
click_first_link_in_email
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
#
|
|
187
|
+
# Debugging
|
|
188
|
+
# These only work with Rails and OSx ATM since EmailViewer uses RAILS_ROOT and OSx's 'open' command.
|
|
189
|
+
# Patches accepted. ;)
|
|
190
|
+
#
|
|
191
|
+
|
|
192
|
+
Then /^save and open current email$/ do
|
|
193
|
+
EmailSpec::EmailViewer::save_and_open_email(current_email)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
Then /^save and open all text emails$/ do
|
|
197
|
+
EmailSpec::EmailViewer::save_and_open_all_text_emails
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
Then /^save and open all html emails$/ do
|
|
201
|
+
EmailSpec::EmailViewer::save_and_open_all_html_emails
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
Then /^save and open all raw emails$/ do
|
|
205
|
+
EmailSpec::EmailViewer::save_and_open_all_raw_emails
|
|
206
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'email_spec/cucumber'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
|
5
|
+
# files.
|
|
6
|
+
|
|
7
|
+
require 'cucumber/rails'
|
|
8
|
+
require 'capybara/rails'
|
|
9
|
+
require 'capybara/cucumber'
|
|
10
|
+
require 'capybara/session'
|
|
11
|
+
require "json_spec/cucumber"
|
|
12
|
+
require "faalis/cucumber"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def last_json
|
|
16
|
+
page.source
|
|
17
|
+
end
|
|
18
|
+
# Capybara defaults to CSS3 selectors rather than XPath.
|
|
19
|
+
# If you'd prefer to use XPath, just uncomment this line and adjust any
|
|
20
|
+
# selectors in your step definitions to use the XPath syntax.
|
|
21
|
+
# Capybara.default_selector = :xpath
|
|
22
|
+
|
|
23
|
+
# By default, any exception happening in your Rails application will bubble up
|
|
24
|
+
# to Cucumber so that your scenario will fail. This is a different from how
|
|
25
|
+
# your application behaves in the production environment, where an error page will
|
|
26
|
+
# be rendered instead.
|
|
27
|
+
#
|
|
28
|
+
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
|
29
|
+
# exceptions and display an error page (just like when the app is running in production).
|
|
30
|
+
# Typical scenarios where you want to do this is when you test your error pages.
|
|
31
|
+
# There are two ways to allow Rails to rescue exceptions:
|
|
32
|
+
#
|
|
33
|
+
# 1) Tag your scenario (or feature) with @allow-rescue
|
|
34
|
+
#
|
|
35
|
+
# 2) Set the value below to true. Beware that doing this globally is not
|
|
36
|
+
# recommended as it will mask a lot of errors for you!
|
|
37
|
+
#
|
|
38
|
+
ActionController::Base.allow_rescue = false
|
|
39
|
+
|
|
40
|
+
# Remove/comment out the lines below if your app doesn't have a database.
|
|
41
|
+
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
|
|
42
|
+
|
|
43
|
+
begin
|
|
44
|
+
require 'database_cleaner'
|
|
45
|
+
require 'database_cleaner/cucumber'
|
|
46
|
+
|
|
47
|
+
DatabaseCleaner.strategy = :transaction
|
|
48
|
+
rescue NameError
|
|
49
|
+
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
Before do
|
|
53
|
+
DatabaseCleaner.start
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
After do |scenario|
|
|
57
|
+
DatabaseCleaner.clean
|
|
58
|
+
end
|
|
59
|
+
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
|
|
60
|
+
# See the DatabaseCleaner documentation for details. Example:
|
|
61
|
+
#
|
|
62
|
+
Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
|
|
63
|
+
# # { :except => [:widgets] } may not do what you expect here
|
|
64
|
+
# # as Cucumber::Rails::Database.javascript_strategy overrides
|
|
65
|
+
# # this setting.
|
|
66
|
+
DatabaseCleaner.strategy = :truncation
|
|
67
|
+
end
|
|
68
|
+
#
|
|
69
|
+
Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
|
|
70
|
+
DatabaseCleaner.strategy = :transaction
|
|
71
|
+
end
|
|
72
|
+
#
|
|
73
|
+
|
|
74
|
+
# Possible values are :truncation and :transaction
|
|
75
|
+
# The :transaction strategy is faster, but might give you threading problems.
|
|
76
|
+
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
|
|
77
|
+
Cucumber::Rails::Database.javascript_strategy = :truncation
|
|
78
|
+
#Capybara.default_driver = :webkit
|
|
79
|
+
Capybara.javascript_driver = :webkit
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
# Set the default text field size when input is a string. Default is nil.
|
|
4
|
+
# Formtastic::FormBuilder.default_text_field_size = 50
|
|
5
|
+
|
|
6
|
+
# Set the default text area height when input is a text. Default is 20.
|
|
7
|
+
# Formtastic::FormBuilder.default_text_area_height = 5
|
|
8
|
+
|
|
9
|
+
# Set the default text area width when input is a text. Default is nil.
|
|
10
|
+
# Formtastic::FormBuilder.default_text_area_width = 50
|
|
11
|
+
|
|
12
|
+
# Should all fields be considered "required" by default?
|
|
13
|
+
# Defaults to true.
|
|
14
|
+
# Formtastic::FormBuilder.all_fields_required_by_default = true
|
|
15
|
+
|
|
16
|
+
# Should select fields have a blank option/prompt by default?
|
|
17
|
+
# Defaults to true.
|
|
18
|
+
# Formtastic::FormBuilder.include_blank_for_select_by_default = true
|
|
19
|
+
|
|
20
|
+
# Set the string that will be appended to the labels/fieldsets which are required
|
|
21
|
+
# It accepts string or procs and the default is a localized version of
|
|
22
|
+
# '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
|
|
23
|
+
# in your locale, it will replace the abbr title properly. But if you don't want to use
|
|
24
|
+
# abbr tag, you can simply give a string as below
|
|
25
|
+
# Formtastic::FormBuilder.required_string = "(required)"
|
|
26
|
+
|
|
27
|
+
# Set the string that will be appended to the labels/fieldsets which are optional
|
|
28
|
+
# Defaults to an empty string ("") and also accepts procs (see required_string above)
|
|
29
|
+
# Formtastic::FormBuilder.optional_string = "(optional)"
|
|
30
|
+
|
|
31
|
+
# Set the way inline errors will be displayed.
|
|
32
|
+
# Defaults to :sentence, valid options are :sentence, :list, :first and :none
|
|
33
|
+
# Formtastic::FormBuilder.inline_errors = :sentence
|
|
34
|
+
# Formtastic uses the following classes as default for hints, inline_errors and error list
|
|
35
|
+
|
|
36
|
+
# If you override the class here, please ensure to override it in your stylesheets as well
|
|
37
|
+
# Formtastic::FormBuilder.default_hint_class = "inline-hints"
|
|
38
|
+
# Formtastic::FormBuilder.default_inline_error_class = "inline-errors"
|
|
39
|
+
# Formtastic::FormBuilder.default_error_list_class = "errors"
|
|
40
|
+
|
|
41
|
+
# Set the method to call on label text to transform or format it for human-friendly
|
|
42
|
+
# reading when formtastic is used without object. Defaults to :humanize.
|
|
43
|
+
# Formtastic::FormBuilder.label_str_method = :humanize
|
|
44
|
+
|
|
45
|
+
# Set the array of methods to try calling on parent objects in :select and :radio inputs
|
|
46
|
+
# for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
|
|
47
|
+
# that is found on the object will be used.
|
|
48
|
+
# Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
|
|
49
|
+
# Formtastic::FormBuilder.collection_label_methods = [
|
|
50
|
+
# "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
|
|
51
|
+
|
|
52
|
+
# Specifies if labels/hints for input fields automatically be looked up using I18n.
|
|
53
|
+
# Default value: true. Overridden for specific fields by setting value to true,
|
|
54
|
+
# i.e. :label => true, or :hint => true (or opposite depending on initialized value)
|
|
55
|
+
# Formtastic::FormBuilder.i18n_lookups_by_default = false
|
|
56
|
+
|
|
57
|
+
# Specifies if I18n lookups of the default I18n Localizer should be cached to improve performance.
|
|
58
|
+
# Defaults to true.
|
|
59
|
+
# Formtastic::FormBuilder.i18n_cache_lookups = false
|
|
60
|
+
|
|
61
|
+
# Specifies the class to use for localization lookups. You can create your own
|
|
62
|
+
# class and use it instead by subclassing Formtastic::Localizer (which is the default).
|
|
63
|
+
# Formtastic::FormBuilder.i18n_localizer = MyOwnLocalizer
|
|
64
|
+
|
|
65
|
+
# You can add custom inputs or override parts of Formtastic by subclassing Formtastic::FormBuilder and
|
|
66
|
+
# specifying that class here. Defaults to Formtastic::FormBuilder.
|
|
67
|
+
# Formtastic::Helpers::FormHelper.builder = MyCustomBuilder
|
|
68
|
+
|
|
69
|
+
# You can opt-in to Formtastic's use of the HTML5 `required` attribute on `<input>`, `<select>`
|
|
70
|
+
# and `<textarea>` tags by setting this to false (defaults to true).
|
|
71
|
+
# Formtastic::FormBuilder.use_required_attribute = true
|
|
72
|
+
|
|
73
|
+
# You can opt-in to new HTML5 browser validations (for things like email and url inputs) by setting
|
|
74
|
+
# this to false. Doing so will add a `novalidate` attribute to the `<form>` tag.
|
|
75
|
+
# See http://diveintohtml5.org/forms.html#validation for more info.
|
|
76
|
+
# Formtastic::FormBuilder.perform_browser_validations = true
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
==================================================
|
|
2
|
+
Steps to installation:
|
|
3
|
+
|
|
4
|
+
0. You have to have a working model to use this scaffold. So create
|
|
5
|
+
your model and setup validations, relations and other stuff.
|
|
6
|
+
|
|
7
|
+
1. Add resource to routes.rb for example in case of `car` scaffold do:
|
|
8
|
+
|
|
9
|
+
namespace :api, :defaults => {:format => :json} do
|
|
10
|
+
namespace :v1 do
|
|
11
|
+
resources :cars
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
2. The Angularjs module of your resource should be added as an dependency
|
|
16
|
+
to another Angularjs module. Add it by hand or if you want to view module
|
|
17
|
+
in dashboard's main page add your resource to `config/initializers/faalis.rb`
|
|
18
|
+
like this:
|
|
19
|
+
|
|
20
|
+
config.dashboard_modules = {
|
|
21
|
+
:car => {
|
|
22
|
+
:icon => "fa fa-car",
|
|
23
|
+
:sidemenu => true,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Faalis::Engine.load_seed
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :faalis_user, :class => Faalis::User do
|
|
3
|
+
email "admin@example.com"
|
|
4
|
+
first_name "admin"
|
|
5
|
+
last_name "admin"
|
|
6
|
+
password "123123123"
|
|
7
|
+
password_confirmation "123123123"
|
|
8
|
+
association :group, :factory => :faalis_group, :name => "admin"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
require 'rspec/autorun'
|
|
6
|
+
require 'factory_girl_rails'
|
|
7
|
+
require 'email_spec'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Rails.backtrace_cleaner.remove_silencers!
|
|
11
|
+
|
|
12
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
13
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
14
|
+
# run as spec files by default. This means that files in spec/support that end
|
|
15
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
16
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
|
17
|
+
# end with _spec.rb. You can configure this pattern with with the --pattern
|
|
18
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
19
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
|
20
|
+
|
|
21
|
+
# Checks for pending migrations before tests are run.
|
|
22
|
+
# If you are not using ActiveRecord, you can remove this line.
|
|
23
|
+
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
|
24
|
+
|
|
25
|
+
RSpec.configure do |config|
|
|
26
|
+
config.include(EmailSpec::Helpers)
|
|
27
|
+
config.include(EmailSpec::Matchers)
|
|
28
|
+
|
|
29
|
+
# ## Mock Framework
|
|
30
|
+
#
|
|
31
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
32
|
+
#
|
|
33
|
+
# config.mock_with :mocha
|
|
34
|
+
# config.mock_with :flexmock
|
|
35
|
+
# config.mock_with :rr
|
|
36
|
+
config.mock_with :rspec
|
|
37
|
+
|
|
38
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
39
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
40
|
+
|
|
41
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
42
|
+
# examples within a transaction, remove the following line or assign false
|
|
43
|
+
# instead of true.
|
|
44
|
+
config.use_transactional_fixtures = true
|
|
45
|
+
|
|
46
|
+
# If true, the base class of anonymous controllers will be inferred
|
|
47
|
+
# automatically. This will be the default behavior in future versions of
|
|
48
|
+
# rspec-rails.
|
|
49
|
+
config.infer_base_class_for_anonymous_controllers = false
|
|
50
|
+
|
|
51
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
52
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
53
|
+
# the seed, which is printed after each run.
|
|
54
|
+
# --seed 1234
|
|
55
|
+
config.order = "random"
|
|
56
|
+
|
|
57
|
+
# database cleaner config
|
|
58
|
+
config.before(:suite) do
|
|
59
|
+
DatabaseCleaner.strategy = :truncation
|
|
60
|
+
end
|
|
61
|
+
config.before(:each) do
|
|
62
|
+
DatabaseCleaner.start
|
|
63
|
+
end
|
|
64
|
+
config.after(:each) do
|
|
65
|
+
DatabaseCleaner.clean
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
end
|