genkan 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +94 -0
- data/Rakefile +26 -0
- data/app/controllers/concerns/genkan/authenticatable.rb +29 -0
- data/app/controllers/concerns/genkan/helper.rb +18 -0
- data/app/controllers/genkan/application_controller.rb +7 -0
- data/app/controllers/genkan/sessions_controller.rb +50 -0
- data/app/models/concerns/genkan/auth.rb +78 -0
- data/app/models/genkan/application_record.rb +5 -0
- data/config/locales/en.yml +11 -0
- data/config/locales/ja.yml +11 -0
- data/config/routes.rb +6 -0
- data/lib/generators/genkan/USAGE +9 -0
- data/lib/generators/genkan/helper.rb +57 -0
- data/lib/generators/genkan/install_generator.rb +45 -0
- data/lib/generators/genkan/templates/initializer.erb +21 -0
- data/lib/generators/genkan/templates/migration.erb +17 -0
- data/lib/generators/genkan/templates/model.erb +3 -0
- data/lib/generators/genkan/templates/view.erb +3 -0
- data/lib/genkan/config.rb +22 -0
- data/lib/genkan/engine.rb +13 -0
- data/lib/genkan/version.rb +3 -0
- data/lib/genkan.rb +12 -0
- data/lib/tasks/genkan_tasks.rake +4 -0
- data/spec/controllers/genkan/sessions_controller_spec.rb +74 -0
- data/spec/controllers/welcome_controller_spec.rb +26 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/javascripts/welcome.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/assets/stylesheets/welcome.css +4 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/controllers/welcome_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/welcome_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/genkan/sessions/new.html.erb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +21 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/app/views/welcome/index.html.erb +2 -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/bin/setup +38 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +18 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +91 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/genkan.rb +16 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +56 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/config/secrets.yml +32 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20170705145634_create_users.rb +17 -0
- data/spec/dummy/db/schema.rb +26 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +106 -0
- data/spec/dummy/log/test.log +21007 -0
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-a/-anb1le1UfL1rAsfL6vauFV9hAwJ5gMXKUu3xL08kUk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-z/-zggpD8P_aYMr6NLbWRYgnYvBbziQZBeEx1PktCGEXI.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0g/0g2prc3JF5Bmp09lvpxf98IkTOH2vTxfSTcGrRF7tDY.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0j/0j0It68B_34E2bHwElTlWS0Y6kgaf45ST90payRW4Jo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2S/2SUXxOYN50uS4DQcyysYjnfZtLXl9Hlk0t2N9SgLB0Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3a/3azp7y1RT8w2JtT4ezvBIXEk5T85Hn6MyEi8d0vG8y4.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4p/4pPp889DYAQDA_jytD7lOck7mxgU0Yd6fnfZHXLdoCc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5J/5JNEPK3X_MzDSfrmiIhbHj9YsSU_eVLAbgBHdiTrNi8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5L/5LHD8D4FTU8esjUNnebxaJfBYlkScZM7mfUgifmcKXs.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5k/5k0_mK4ah0LyKz_V0L5ewQW69uKcg4AXcfFYl11LkkU.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/60/60UFBuw-joBLVwC7c_zp0kSHY1eFbRwZ_6dtpqrfqgE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6L/6LWZEU7dfxLMlAZC0dbWyFfAjZ4osHIEWZa3S944n3s.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6O/6OiuoEFcjfdg_T6P3vVSAbv8GEikjkFbJzAPqcjjIBQ.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6y/6yYtw9nBy5BQSaqXmBCmbMKZ2W9i-xXzDUipnQmPyBg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/79/79x651YgKUXaujQCdJ-pAEC5dZg_pn2dunb0jchMaDQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7D/7DA7NcBgtuGkw874ZnGGog86dav0rfRpwsOqr5NZn8w.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7G/7GfbUJUiFTReNmQLPaoNQb6zwaAn8V2F6TSbb6gHUe0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7H/7Hl6K8gEbb3P74YnUpKFaNJpP7D2xYYgOMGojcOa-ag.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8M/8MjSjTnG8bT0MHX2mtSwts_g41nf5tdQGu72StLOCH8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8S/8SvabF4ymQg1Bvye9LUpj_kgUYvtEyrC_IFy21I9QkQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8V/8Vuze0yfvn-ZGnSPhHfFylf_THj3OYxZ43MgYYietX8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8a/8ayEXSXjdhDv7nFgvX2HZLPF4zorczNuMB12acBi5Tg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9K/9KVq9HdUeF1QpFrSVJNkFVYSVnf6eBvjNOj1ScdcDBk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9X/9XpG6MU2DaMe_As-AVmJLHdetFNNVe6tuSzG3wdBFgw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9b/9bxqdiQYs5dr4yZ7AZfQuus70vM93F4H45nnz56elaM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AQ/AQwVruFOIEFAa6aCfUPI4NMLs5DcA7F9jJHINlokjdM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Aj/Aj4xA0Ms8-0zqpxEQL_wIoWFvtW6vqdbN03k7x-Zn_w.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Br/BrptdQg6UEupRauAlmc_iY-9bgz-lRY7XFQJWh1Cj-I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/C9/C9e7-Bx6ORaFLsjSigwMjM9wgB2SOEBIh9F7Nyuizi0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/CC/CCNBz0pRBBaXl9LPDXUwcU5GwnMhyMZ3hN9k8F_-y1k.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ch/ChbwGMU9eLsrC2zaGtMQmlI_cyC4LA1DM0edywF834E.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ck/CkC2Zx2KIvKFX2W5bsqxi-ykghbhqFnfPxba8Ox49hk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Cq/CqS8f-adc43tZVUYwbeYNlaAp68VAND9gSz75EJ_qIk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dh/DhvRJbXpx9vsnErI2VDpKjXz-hndz7cH_DPgu8PL6uo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dm/DmswZczHVjLH0N3U2GKkfL0rhDuMg5Q7FCoT8GxCaks.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/E1/E1DkSt3mnv_bJAuFVZ3AtOltVU6UNdTgKDBtGytXTW0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ED/EDJquckajF45p6W06qS_rw70poqK8SPCaVQ7SYdZaaI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/EE/EEplIoXGshtrgJgFxcH1B6LgetWrS_RuhCYsTuqiO6s.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/EH/EHIpjGxqjcpjWgDJnv5qyQoHj61Grtz_nBtM0MrfrpY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/EM/EM7lC_qW1a9LhesPkDChUijCpMMGIQ9anREMaOxeim0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ej/Ej3tOd_jldb5OqbeKuZTgniWmNEhB8SqUDrAf1AY2R8.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Es/EsAu2JEirIm31MKweNKHRZGJy0biOeEt5cQNLfnAURA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/F6/F6xGHKoJgwoM4vZWx9Tj5PdU-eQ1-7Bhnh-zagjLQDA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Fi/FixyVGg9bu3eRk3ddmMXWy7M33tm03pAi1P7UVxXCYs.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/G6/G6LBIUOF6NiEmJOb7yUEYKKwAEeqicAJ3W6n8UfEXOg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/GH/GHvnaT_97475zA0bbnVWENv13-dhtQlnj1Unf-tsl6U.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Gr/GrA-ejqbqUhgmuDXEav8TmwzP4fKgUcKhkZPhJDFW-s.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Gr/GrKBj_NUfuWBJQ-WIrEqu9R9SQR6cX9I8hb6Qw2F7hg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/H6/H64c-4CUUS2AfwaiQFio18rIyst_XRDM4GWgWYw8-Rc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KC/KCNxu9eZUWPxk72xh5pBqHgL9Mq1eQBX_hIxN3UffPk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KT/KThrNT1MjSFnwiZQ7_nlQr0ItXkzDuhIq_kXzam40mI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LT/LTXJhfDnAx8fXhGMgZ2e53Ek7uImLI32AUqTv3MIafw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LU/LUfEmeqDaa3HaK6f3vZMSQEUKJ4VONMmCwT8YN0QgqE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Lo/Lo5ezKyD81tLPXc-tjc8epiltXcknaWbyurke6mkQ1I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/M3/M3220HcICdTz9arsognbp2l_1RDG78Z56bTv_KlWPL4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ma/Madl7SA4t7JZLahxu6Ke9R30VOZBBD8vVoRSzIjOnJY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Oi/Oi2ZmEFBbtuD00cZCMuBTvEexWeTZkvHsPJmkcInYjE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ok/Oks6stFiBciNz80-Nk2OxzjcJhXFyZR9B3pDm1Lq8Us.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/P8/P84t1Do34k5QzzfUpukZqwnzEn-Vge8zRU8ebYqXUYI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/PM/PMCnZAAKIrllZ_Jgp_Ur6WoxIU9kyM_E1EjHp-ci9iI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qb/QbgPEai63zAhH5BGyBVFWenWEKvlKHXHy_aZu3VQQpk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qj/QjSVnMprIdvgTEGBVBnh-AKjeEsiGANemX5AY7Y8mCw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/RR/RRaseJ4GmYu1ezbdAWsQBtYS1BjZQvnLuQoav8QxW4A.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/RS/RS-ZXk-Y-ySoIbDQmoby7Bgj7N3evbVYh6NY9-qXamM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Rg/RgSAb6QWYSpBwgCAvMUi1HocmrZwUgG3-JQ2F1p5jwg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Rt/RtUdV-4geEzAWpHpkNyJKPdEB_NbyUudKWgJ6RFD_QM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SB/SBCC3yocqP5GfrbWOlGUKkdQbLCJoirLZFdFIvwCSog.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SU/SUTF9Cbkbi747jwRIsVQpfN3-OJb7f2GomctHX9uLXo.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SU/SUUXheDD95mUwPAvpXV7TZr0J7rrRSoGrawyr0ZvpHs.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/S_/S_Pcb0mGOL8qoG746qUkzjEgfDWafYwWmBKFg_oVILs.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Sf/SfDlB2o4tLK2rgB9-jEDtcfGNRPY_Nzde-2msr9_cv4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Sx/Sx5fQ5H_ttg0Jg8OMZkvVVPOXFoRK7rxRQZ-Xglb0Wg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Tv/TvM2B-OCKO7_mMMJ5e9vWXzQvSJnk-CSc8Y6v80I_A4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vg/VgksnxhDAqGJx05xz9F070c5O377BL58YZ22sDHt-eM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vk/Vk8iyUuxBx5oHqTJEBws7ePqD0IvCQW7V0hcde1ocso.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wo/WoLIUbAjm95qIXELkwfMhb-6f6Bxe-VVQfj8Gbxmf9k.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wo/wO-HGAbFrXwx_FjrEAzCpBqQLHnbpTqtDZsc_ku4V-Y.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wx/WxX55vFARl0L-n4U2bhoT95AiCKlc1rnpXws-1MJ61M.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/X2/X2YYhxXfSMeWK-PEIsEKVn7WHuTZZoVr3-TJw8PZ2qI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/XZ/XZbqz8CgU6sBTJ3C6FzSB2WZbvPjftngO7rSqFy5Oe0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YP/YP9lbyR4I4Y2H56XD8xB_lG5JZ3cEhpla6Z1KWITau0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Yv/YvhG84OATIN1hzcxIm1dUdAFzDHrXQv0tq2XWOgZ9Bg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ZX/ZXX9zCAbm4kDXzvtHkDG04KXhtHv5eLFQGJ8C0ZnwTE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_3/_365sloRfW0to4KL2d0zrfRsUChA29CQ9xTbiXfY8y4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_5/_52n2WLJfIOWeCBtjZ2Murh6pKib-IpuR0EktBYqKpg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ac/Acp3i9aB6aj3TgUf8XbdfNdl1LHrnCbqjZJKY04jv-M.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ac/acwwbKOCVUQx43GRtU33pvyIqUhvbIsJEqtjUYJ4Y7I.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ac/acxzeNJnCGIvMIiRx5uHanox2nphcqymTTHXDUDQyjM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/am/amQnyYc9WanAOKWZ6-lGMYKgK9SaStZ0GidmAquDeNQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bO/bO32hG_YBKRnvEUnc6WVkRoKXgRX_P6I6HvQBrfrcqg.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/b_/b_Itlk9QZZd7Rvf8kcA4yLP1R5Acu7jB-m1xQiSU0qE.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dQ/dQRyP5ear4CnYAvUi3utlj-ArD8Mpm1tu_YrKo3sYqM.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/eI/eIdCi9pdESg8mBSixNWcP0ggpHkdGhBz4gCmXu-1T-Q.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ek/ektXM_dhs-Yt3Rcr9qqcunWR9Qeiy49omvRIsePDrgY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/et/etvkegz3h_RG3JuPFHQ5vlcF-ZBc2AQCS8K1uTz4MsE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fy/fyosVngyRNzyNGWgLC3fqIYBF1trPoEj5-YGUucZqv8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gT/gTcO28g7KBHGNWEbIrvu4lKACr-oi8jrtfPpJK-alGw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ga/gauwzOQ2YQbofsKqaMHHIRc36QjCKVsJU-PBd0_sxdo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gv/gvenMj3wS4MU8luvX4B9yoWLDsu4aEjPHu6HqmqRmVM.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hE/hEo_QU7FPYjtX-4RWTE3CDhpbTnrssn_eidJPTT9jus.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hU/hUnVNKA_obB93f9QaBacYahJlxmSsqMPb0caf7TgYHA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iI/iI5ECMKY_c5Jh5EUcyEm268wH1-WXkPACA4Eokv5oG4.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/kK/kKX2bv1FYx1ivrRttxcoKhFrJbTPmfOqhNhA_PHvL20.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lQ/lQx4QOVnycSCCGdKdkf68q--9oxPGtL-SkzKrsXP0OE.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lk/lkDKpnutXrq58TmSi1a_3CpPW0bua3P2qM1pfkdeiNM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/mX/mX1nlsL_SWOB4y22W5FheRX0YEONKyOY7xUeIvRiHco.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/mj/mj7IPPrG3Iu6yNF_Rt8X7uLmXnX9Xus9-w8pzw33qKI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/mk/mK3anqtvwJApYR3xceuQcefcjhVib0s2Oq7FN1p2ZLI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/mk/mkAYMbgT7m9l0b-cZitIKvywgCGfXZ3pzQnyC1zF5pk.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oD/oDib09gdE8WkzxXJjQsQ0mOCVGkbIIkaQ-JZlozEvoo.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oR/oRbeNQfk--2vMaiBNK-IPZuWtL8-Zjpj4wdKYwpWT-Y.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oS/oSwxAumjvW64xQ1Lc0jZ5ZUupKl39p9NW1fRMHGN2D8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oz/ozK4IPJj2CBcsem3fLJx3wqcOl6mI6B91PkN0wVfkyk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/p7/p75ImfMSO7wEgU1utN18Pq01BL5fr5j3xQj6eRYFE4o.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pp/pp9vUiXJLyGHZCkMCl70DkL_xiv4XWz9ztTiMarEfNY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pt/ptHawc95ZK08GgV9kHAAAa89jpZVYPhqqpPPVWi71Do.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/q0/q074YUa9rnMSU4RVfvIYMAnW_TmVXrT1hlJO41-OBbU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qA/qAXCQxgc8uN7nSfqrtsa8DD_UWBUox9OcwfdrJtzb6A.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qP/qPmv5snMrDw830S6hSICDcnIy7kVEWoFKXhGKT38lG4.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qZ/qZqBOuyk1j0lKHz7Onk5w-W6zpsJwXCI_oAV6Jft7fM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ql/qleugiSP8m-MGCnPwKRGi97ngKjTxzFCgiFaCo42B1k.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/s8/s8SZLe11poSYC83ACEC77enudBY-sGq2cIvp_url9wQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sn/sn4QRxxVjF0Ci_0wXT2_r3juzRsTYpdr3oIZOPuMDRY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tR/tR-01mKfGTeWGUVCkmD0FSf0n1ls5mjSBbZmDBQRxdE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tR/tROEyESrcH-klIdGYfWPZ70uL93VzoncYdd6EBP_fck.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tf/tfaDK6L3U-9ZYIbuxubkyB691dNwMLwNxr54XI0_H7Q.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uh/uhHJ7XB-kBAusYJqgB2h0IJ9trO3-jD8Lq9aDNSxZGc.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vH/vH0I-a20tX_6BHX9WyF-EGLn4QfpGfa2BvRUNEdzP0I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vL/vL3g9boowrqsF7Dol4tVdRb-2KVAvMx02XlYyU7NYOU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vj/vjJiNWLGxIRFCyH6-2SDfyWDBm0zK1czKmpH2BzMDlQ.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wb/wbt51tMiDSdeDVRHR8wCjuvZ2y_hzC2yretlmGGMgYU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wg/wgIeHcawFV0WGNd4pKlXfAV7TEDj1UNwO4b7oYaBpW0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wy/wyVoJ3SJ2UwQEUAMb0JVmXmqR6OvjkGK7N06SWNtAcw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xs/xsj35WA8E1f9NhikKGOGSP1bdaGqxlLSs2D06MWhhDk.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/y_/y_3kGB4SKGsTCgcO9GE43TC33LT1A75f2qkzXF4066I.cache +1 -0
- data/spec/factories/users.rb +26 -0
- data/spec/features/authentication_spec.rb +47 -0
- data/spec/lib/genkan/config_spec.rb +60 -0
- data/spec/lib/genkan_spec.rb +23 -0
- data/spec/models/user_spec.rb +186 -0
- data/spec/rails_helper.rb +49 -0
- data/spec/spec_helper.rb +15 -0
- metadata +504 -0
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oR/oRbeNQfk--2vMaiBNK-IPZuWtL8-Zjpj4wdKYwpWT-Y.cache
ADDED
Binary file
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oS/oSwxAumjvW64xQ1Lc0jZ5ZUupKl39p9NW1fRMHGN2D8.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oz/ozK4IPJj2CBcsem3fLJx3wqcOl6mI6B91PkN0wVfkyk.cache
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
[o:Set:
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"[processors:type=application/javascript&file_type=application/javascript&pipeline=debug;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"�file-digest:///Users/yhirano/src/github.com/yhirano55/genkan/vendor/bundle/gems/actioncable-5.1.2/lib/assets/compiled/action_cable.js;TTI"2file-digest://app/assets/javascripts/cable.js;TTI"$file-digest://app/assets/config;TTI"1file-digest://app/assets/config/action_cable;TTI"$file-digest://app/assets/images;TTI"1file-digest://app/assets/images/action_cable;TTI")file-digest://app/assets/javascripts;TTI"6file-digest://app/assets/javascripts/action_cable;TTI")file-digest://app/assets/stylesheets;TTI"6file-digest://app/assets/stylesheets/action_cable;TTI"zfile-digest:///Users/yhirano/src/github.com/yhirano55/genkan/vendor/bundle/gems/actioncable-5.1.2/lib/assets/compiled;TTI"�file-digest:///Users/yhirano/src/github.com/yhirano55/genkan/vendor/bundle/gems/actioncable-5.1.2/lib/assets/compiled/action_cable;TTI"2file-digest://app/assets/javascripts/channels;TTI"4file-digest://app/assets/javascripts/welcome.js;TTF
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pp/pp9vUiXJLyGHZCkMCl70DkL_xiv4XWz9ztTiMarEfNY.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=86840ee5abc0321d7e31c85671a219043fb463ee1f26ee056bd8776c4ed8b7d2:ET
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pt/ptHawc95ZK08GgV9kHAAAa89jpZVYPhqqpPPVWi71Do.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%B�$WWd�`��W/��B�Ew)�j��~+�P�4
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/q0/q074YUa9rnMSU4RVfvIYMAnW_TmVXrT1hlJO41-OBbU.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%��h��(�8��
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qA/qAXCQxgc8uN7nSfqrtsa8DD_UWBUox9OcwfdrJtzb6A.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=315062351afb7bbf2d71b9cf29f32e95097ed986c29dbd6ffe1d8fc4bb9172ba:ET
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qZ/qZqBOuyk1j0lKHz7Onk5w-W6zpsJwXCI_oAV6Jft7fM.cache
ADDED
Binary file
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ql/qleugiSP8m-MGCnPwKRGi97ngKjTxzFCgiFaCo42B1k.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=debug&id=7bf16d328ee85d9e3c320dbd702dfdee376737ee60b02a19d53d7f87aca18cb5:ET
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/s8/s8SZLe11poSYC83ACEC77enudBY-sGq2cIvp_url9wQ.cache
ADDED
Binary file
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sn/sn4QRxxVjF0Ci_0wXT2_r3juzRsTYpdr3oIZOPuMDRY.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=2d9ee2da8b89f3b82f93974715540dcd0c05d8f6ced4d224ccba8397523ad3ca:ET
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tR/tR-01mKfGTeWGUVCkmD0FSf0n1ls5mjSBbZmDBQRxdE.cache
ADDED
Binary file
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tR/tROEyESrcH-klIdGYfWPZ70uL93VzoncYdd6EBP_fck.cache
ADDED
Binary file
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uh/uhHJ7XB-kBAusYJqgB2h0IJ9trO3-jD8Lq9aDNSxZGc.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%B�$WWd�`��W/��B�Ew)�j��~+�P�4
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vH/vH0I-a20tX_6BHX9WyF-EGLn4QfpGfa2BvRUNEdzP0I.cache
ADDED
Binary file
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vL/vL3g9boowrqsF7Dol4tVdRb-2KVAvMx02XlYyU7NYOU.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%B�$WWd�`��W/��B�Ew)�j��~+�P�4
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vj/vjJiNWLGxIRFCyH6-2SDfyWDBm0zK1czKmpH2BzMDlQ.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%�<������X���̀#+�����,�(o���
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wb/wbt51tMiDSdeDVRHR8wCjuvZ2y_hzC2yretlmGGMgYU.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/yhirano/src/github.com/yhirano55/genkan/vendor/bundle/gems/actioncable-5.1.2/lib/assets/compiled/action_cable.js?type=application/javascript&pipeline=self&id=950485c1de15202d75ee3ae3f120c1a98a7185cca1327b3a03a892aea4c20cad:ET
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wg/wgIeHcawFV0WGNd4pKlXfAV7TEDj1UNwO4b7oYaBpW0.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%�<������X���̀#+�����,�(o���
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wy/wyVoJ3SJ2UwQEUAMb0JVmXmqR6OvjkGK7N06SWNtAcw.cache
ADDED
Binary file
|
data/spec/dummy/tmp/cache/assets/sprockets/v3.0/y_/y_3kGB4SKGsTCgcO9GE43TC33LT1A75f2qkzXF4066I.cache
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"%��h��(�8��
|
@@ -0,0 +1,26 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :user do
|
3
|
+
email { Faker::Internet.unique.email }
|
4
|
+
|
5
|
+
trait(:accepted) do
|
6
|
+
accepted_at { Time.current }
|
7
|
+
end
|
8
|
+
|
9
|
+
trait(:not_accepted) do
|
10
|
+
accepted_at nil
|
11
|
+
end
|
12
|
+
|
13
|
+
trait(:banned) do
|
14
|
+
banned_at { Time.current }
|
15
|
+
end
|
16
|
+
|
17
|
+
trait(:not_banned) do
|
18
|
+
banned_at nil
|
19
|
+
end
|
20
|
+
|
21
|
+
trait(:active) do
|
22
|
+
accepted_at { Time.current }
|
23
|
+
banned_at nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
RSpec.feature "authentication" do
|
4
|
+
before do
|
5
|
+
allow_any_instance_of(Genkan::Config).to receive(:auto_acceptance).and_return(true)
|
6
|
+
stub_omniauth(email: email)
|
7
|
+
visit "/login"
|
8
|
+
click_link "login"
|
9
|
+
end
|
10
|
+
|
11
|
+
feature "Sign up" do
|
12
|
+
let(:email) { Faker::Internet.email }
|
13
|
+
|
14
|
+
scenario "User can sign up" do
|
15
|
+
expect(page).to have_content I18n.t("genkan.sessions.logged_in")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
feature "Login" do
|
20
|
+
context "When user is accepted" do
|
21
|
+
let(:user) { create :user, :accepted }
|
22
|
+
let(:email) { user.email }
|
23
|
+
|
24
|
+
scenario "User can login" do
|
25
|
+
expect(page).to have_content I18n.t("genkan.sessions.logged_in")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "When user is banned" do
|
30
|
+
let(:user) { create :user, :banned }
|
31
|
+
let(:email) { user.email }
|
32
|
+
|
33
|
+
scenario "User cannot login" do
|
34
|
+
expect(page).to have_content I18n.t("errors.messages.banned")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
feature "Logout" do
|
40
|
+
let(:email) { Faker::Internet.email }
|
41
|
+
|
42
|
+
scenario "User can logout" do
|
43
|
+
click_link "logout"
|
44
|
+
expect(page).to have_content I18n.t("genkan.sessions.logged_out")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Genkan::Config do
|
4
|
+
let(:config) { described_class.new }
|
5
|
+
|
6
|
+
describe 'initialize' do
|
7
|
+
it { expect(config.user_class_name).to eq "User" }
|
8
|
+
it { expect(config.auto_acceptance).to eq false }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#user_class' do
|
12
|
+
before { config.user_class_name = user_class_name }
|
13
|
+
subject { config.user_class }
|
14
|
+
|
15
|
+
context 'user_class_name exist' do
|
16
|
+
let(:user_class_name) { "User" }
|
17
|
+
it('returns constant') { is_expected.to be User }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'user_class_name unexist' do
|
21
|
+
let(:user_class_name) { "Anonymous" }
|
22
|
+
it { is_expected.to be_nil }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#current_user_method_name' do
|
27
|
+
before { config.user_class_name = user_class_name }
|
28
|
+
subject { config.current_user_method_name }
|
29
|
+
|
30
|
+
context 'without namespace' do
|
31
|
+
let(:user_class_name) { "AdminUser" }
|
32
|
+
it('returns correctly method name') { is_expected.to eq "current_admin_user" }
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'with namespace' do
|
36
|
+
let(:user_class_name) { "Admin::User" }
|
37
|
+
it('returns correctly method name') { is_expected.to eq "current_admin_user" }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#auto_acceptance?' do
|
42
|
+
before { config.auto_acceptance = auto_acceptance }
|
43
|
+
subject { config.auto_acceptance? }
|
44
|
+
|
45
|
+
context 'auto_acceptance is true' do
|
46
|
+
let(:auto_acceptance) { true }
|
47
|
+
it { is_expected.to eq true }
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'auto_acceptance is false' do
|
51
|
+
let(:auto_acceptance) { false }
|
52
|
+
it { is_expected.to eq false }
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'auto_acceptance is nil' do
|
56
|
+
let(:auto_acceptance) { nil }
|
57
|
+
it { is_expected.to eq false }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Genkan do
|
4
|
+
describe '.configure' do
|
5
|
+
example do
|
6
|
+
expect {
|
7
|
+
described_class.configure do |config|
|
8
|
+
config.user_class_name = "User"
|
9
|
+
end
|
10
|
+
}.not_to raise_error
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.config' do
|
15
|
+
subject { described_class.config }
|
16
|
+
it { is_expected.to be_an_instance_of Genkan::Config }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'version' do
|
20
|
+
subject { described_class::VERSION }
|
21
|
+
it { is_expected.to be_a String }
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe User do
|
4
|
+
it 'has a valid factory' do
|
5
|
+
expect(build(:user)).to be_valid
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'scope' do
|
9
|
+
let!(:accepted) { create :user, :accepted }
|
10
|
+
let!(:not_accepted) { create :user, :not_accepted }
|
11
|
+
let!(:banned) { create :user, :banned }
|
12
|
+
let!(:not_banned) { create :user, :not_banned }
|
13
|
+
let!(:active) { create :user, :active }
|
14
|
+
|
15
|
+
describe '.accepted' do
|
16
|
+
subject { described_class.accepted }
|
17
|
+
|
18
|
+
it('includes accepted') { is_expected.to include accepted }
|
19
|
+
it('includes active') { is_expected.to include active }
|
20
|
+
it('does not include not_accepted') { is_expected.not_to include not_accepted }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.not_banned' do
|
24
|
+
subject { described_class.not_banned }
|
25
|
+
|
26
|
+
it('includes not_banned') { is_expected.to include not_banned }
|
27
|
+
it('includes active') { is_expected.to include active }
|
28
|
+
it('does not include banned') { is_expected.not_to include banned }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '.active' do
|
32
|
+
subject { described_class.active }
|
33
|
+
|
34
|
+
it('includes active') { is_expected.to include active }
|
35
|
+
it('does not include not_accepted') { is_expected.not_to include not_accepted }
|
36
|
+
it('does not include not_banned') { is_expected.not_to include not_banned }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'validation' do
|
41
|
+
describe 'email' do
|
42
|
+
before { create :user }
|
43
|
+
|
44
|
+
it { is_expected.to validate_presence_of(:email) }
|
45
|
+
it { is_expected.to validate_uniqueness_of(:email) }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#ensure_record_has_accepted' do
|
49
|
+
before { model.valid?(:login) }
|
50
|
+
|
51
|
+
subject { model.errors.full_messages }
|
52
|
+
|
53
|
+
context 'with accepted' do
|
54
|
+
let(:model) { build :user, :accepted }
|
55
|
+
it { is_expected.not_to include I18n.t('errors.messages.not_accepted') }
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with not_accepted' do
|
59
|
+
let(:model) { build :user, :not_accepted }
|
60
|
+
it { is_expected.to include I18n.t('errors.messages.not_accepted') }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '#ensure_record_has_not_banned' do
|
65
|
+
before { model.valid?(:login) }
|
66
|
+
|
67
|
+
subject { model.errors.full_messages }
|
68
|
+
|
69
|
+
context 'with not_banned' do
|
70
|
+
let(:model) { build :user, :not_banned }
|
71
|
+
it { is_expected.not_to include I18n.t('errors.messages.banned') }
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with banned' do
|
75
|
+
let(:model) { build :user, :banned }
|
76
|
+
it { is_expected.to include I18n.t('errors.messages.banned') }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'callback' do
|
82
|
+
let(:user) { build(:user) }
|
83
|
+
|
84
|
+
it 'set remember_token before create' do
|
85
|
+
expect(user.remember_token).to be_blank
|
86
|
+
user.save!
|
87
|
+
expect(user.remember_token).to be_present
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#login!' do
|
92
|
+
let(:logged_in_count) { rand(1..20) }
|
93
|
+
let(:user) { build :user, logged_in_count: logged_in_count }
|
94
|
+
|
95
|
+
subject(:execute) do
|
96
|
+
config = double(:config)
|
97
|
+
allow(config).to receive(:auto_acceptance?).and_return(auto_acceptance)
|
98
|
+
allow(Genkan).to receive(:config).and_return(config)
|
99
|
+
user.login!
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'when auto_acceptance is true' do
|
103
|
+
let(:auto_acceptance) { true }
|
104
|
+
|
105
|
+
before { execute }
|
106
|
+
|
107
|
+
it 'stores last_logged_in_at' do
|
108
|
+
expect(user.last_logged_in_at).to be_present
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'increments loggin_in_count' do
|
112
|
+
expect(user.logged_in_count).to eq (logged_in_count + 1)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context 'when auto_acceptance is false' do
|
117
|
+
let(:auto_acceptance) { false }
|
118
|
+
|
119
|
+
it 'raise error ActiveRecord::RecordInvalid' do
|
120
|
+
expect { execute }.to raise_error(ActiveRecord::RecordInvalid)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe '#accepted?' do
|
126
|
+
subject { user.accepted? }
|
127
|
+
|
128
|
+
context 'with accepted' do
|
129
|
+
let(:user) { build :user, :accepted }
|
130
|
+
it { is_expected.to eq true }
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'with not_accepted' do
|
134
|
+
let(:user) { build :user, :not_accepted }
|
135
|
+
it { is_expected.to eq false }
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#accept' do
|
140
|
+
let(:user) { build :user }
|
141
|
+
|
142
|
+
subject { user.tap(&:accept) }
|
143
|
+
|
144
|
+
it { is_expected.to be_accepted }
|
145
|
+
end
|
146
|
+
|
147
|
+
describe '#accept!' do
|
148
|
+
let(:user) { build :user }
|
149
|
+
|
150
|
+
subject { user.tap(&:accept!) }
|
151
|
+
|
152
|
+
it { is_expected.to be_accepted }
|
153
|
+
it { is_expected.to be_persisted }
|
154
|
+
end
|
155
|
+
|
156
|
+
describe '#banned?' do
|
157
|
+
subject { user.banned? }
|
158
|
+
|
159
|
+
context 'with banned' do
|
160
|
+
let(:user) { build :user, :banned }
|
161
|
+
it { is_expected.to eq true }
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'with not_banned' do
|
165
|
+
let(:user) { build :user, :not_banned }
|
166
|
+
it { is_expected.to eq false }
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe '#ban' do
|
171
|
+
let(:user) { build :user }
|
172
|
+
|
173
|
+
subject { user.tap(&:ban) }
|
174
|
+
|
175
|
+
it { is_expected.to be_banned }
|
176
|
+
end
|
177
|
+
|
178
|
+
describe '#ban!' do
|
179
|
+
let(:user) { build :user }
|
180
|
+
|
181
|
+
subject { user.tap(&:ban!) }
|
182
|
+
|
183
|
+
it { is_expected.to be_banned }
|
184
|
+
it { is_expected.to be_persisted }
|
185
|
+
end
|
186
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require File.expand_path('../dummy/config/environment', __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'capybara/rails'
|
6
|
+
require 'capybara/rspec'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.include FactoryGirl::Syntax::Methods
|
10
|
+
config.include ::Rails::Controller::Testing::TestProcess, type: :controller
|
11
|
+
config.include ::Rails::Controller::Testing::TemplateAssertions, type: :controller
|
12
|
+
config.include ::Rails::Controller::Testing::Integration, type: :controller
|
13
|
+
|
14
|
+
config.use_transactional_fixtures = false
|
15
|
+
config.infer_spec_type_from_file_location!
|
16
|
+
config.filter_rails_from_backtrace!
|
17
|
+
|
18
|
+
config.before(:suite) do
|
19
|
+
FactoryGirl.reload
|
20
|
+
DatabaseCleaner.strategy = :truncation
|
21
|
+
DatabaseCleaner.clean_with(:truncation)
|
22
|
+
end
|
23
|
+
|
24
|
+
config.before(:each) do
|
25
|
+
DatabaseCleaner.strategy = :truncation
|
26
|
+
DatabaseCleaner.start
|
27
|
+
end
|
28
|
+
|
29
|
+
config.after(:each) do
|
30
|
+
DatabaseCleaner.clean
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Shoulda::Matchers.configure do |config|
|
35
|
+
config.integrate do |with|
|
36
|
+
with.test_framework :rspec
|
37
|
+
with.library :rails
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
FactoryGirl.definition_file_paths << "#{File.dirname(__FILE__)}/factories"
|
42
|
+
|
43
|
+
OmniAuth.config.test_mode = true
|
44
|
+
|
45
|
+
def stub_omniauth(email: Faker::Internet.email)
|
46
|
+
OmniAuth.config.mock_auth[:google] = OmniAuth::AuthHash.new(
|
47
|
+
"provider" => "google", "info" => { "email" => email }
|
48
|
+
)
|
49
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.expect_with :rspec do |expectations|
|
3
|
+
expectations.syntax = [:should, :expect]
|
4
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
5
|
+
end
|
6
|
+
|
7
|
+
config.mock_with :rspec do |mocks|
|
8
|
+
mocks.syntax = [:should, :expect]
|
9
|
+
mocks.verify_partial_doubles = true
|
10
|
+
end
|
11
|
+
|
12
|
+
config.order = :random
|
13
|
+
|
14
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
15
|
+
end
|