diff --git a/Gemfile b/Gemfile index ab10196..16db30c 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,9 @@ gem 'jbuilder' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' +# Try out haml coverage +gem 'haml-rails' + # Use Active Storage variant # gem 'image_processing', '~> 1.2' diff --git a/Gemfile.lock b/Gemfile.lock index a0a1793..b4fb576 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,6 +90,15 @@ GEM ffi (1.15.5) globalid (1.1.0) activesupport (>= 5.0) + haml (6.1.1) + temple (>= 0.8.2) + thor + tilt + haml-rails (2.1.0) + actionpack (>= 5.1) + activesupport (>= 5.1) + haml (>= 4.0.6) + railties (>= 5.1) i18n (1.14.1) concurrent-ruby (~> 1.0) jbuilder (2.11.5) @@ -195,7 +204,9 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.6.3) mini_portile2 (~> 2.8.0) + temple (0.10.2) thor (1.2.2) + tilt (2.2.0) timeout (0.4.0) turbolinks (5.2.1) turbolinks-source (~> 5.2) @@ -226,6 +237,7 @@ DEPENDENCIES bootsnap byebug capybara (>= 2.15) + haml-rails jbuilder listen mocha diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 62fb35b..a6aa874 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,8 +1,16 @@ class ApplicationController < ActionController::Base private + def check_cookie + if params[:x] != ENV.fetch("CODE", "beta") + redirect_to(bounce_home_index_url) and return + end + + cookies[:beta_sign_in] = { value: 1, expires: 1.year } + end + def check_beta_cookie - redirect_to(bounce_home_index_url) and return if params[:x] != ENV.fetch("BETA_CODE", "beta") + redirect_to(bounce_home_index_url) and return if params[:x] != ENV.fetch("CODE", "beta") cookies[:beta_sign_in] = { value: 1, expires: 1.year } end diff --git a/app/views/home/index.haml b/app/views/home/index.haml new file mode 100644 index 0000000..36b6772 --- /dev/null +++ b/app/views/home/index.haml @@ -0,0 +1,8 @@ +%p + Hi! ✅ + From: + =controller.class.name +- if controller.class.name == 'WelcomeController' + %p Unreachable element +- else + %p Unreachable element \ No newline at end of file diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb deleted file mode 100644 index 4bfe424..0000000 --- a/app/views/home/index.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -Hi! ✅ -From: <%= controller.class.name %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c8034e2..135f9c8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,6 +10,9 @@
+ <% if controller.class.name == "FancyController" %> +