Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4f351b
commit 11b7034
Showing
41 changed files
with
224 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard 'rspec' do | ||
watch(%r{^spec/.+_spec\.rb$}) | ||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { "spec" } | ||
|
||
# Rails example | ||
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | ||
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } | ||
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } | ||
watch(%r{^spec/support/(.+)\.rb$}) { "spec" } | ||
watch('config/routes.rb') { "spec/routing" } | ||
watch('app/controllers/application_controller.rb') { "spec/controllers" } | ||
|
||
# Capybara features specs | ||
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" } | ||
|
||
# Turnip features and steps | ||
watch(%r{^spec/acceptance/(.+)\.feature$}) | ||
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
<%= form_tag(:controller => "gate", :action => "check", :method => "post") do %> | ||
<%= label_tag :birthday, "Please insert you date of birth" %> | ||
<%= date_select( | ||
"user", "birthday", | ||
<%= form_for @gate do |f| %> | ||
<%= f.label :birthday, "Please insert your date of birth" %> | ||
<%= f.date_select( | ||
:birthday, | ||
:order => [:day, :month, :year], | ||
:start_year => Time.now.year - 100, | ||
:end_year => Time.now.year - 10, | ||
:start_year => Time.now.year - 4, | ||
:end_year => Time.now.year - 100, | ||
:prompt => { :day => 'day', :month => 'month', :year => 'year' }) | ||
%> | ||
<%= submit_tag("Check") %> | ||
<%= hidden_field_tag :referrer, request.referer %> | ||
<%= f.submit "Check" %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
<h1>Gate#denied</h1> | ||
<p>Find me in app/views/agegate/gate/denied.html.erb</p> | ||
<h1>Access denied</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
<h1>Age gate</h1> | ||
<div class="gate"> | ||
<%= form_for @gate do |f| %> | ||
<%= f.label :birthday, "Please insert your date of birth" %> | ||
<%= f.date_select( | ||
:birthday, | ||
:order => [:day, :month, :year], | ||
:start_year => Time.now.year - 100, | ||
:end_year => Time.now.year - 10, | ||
:prompt => { :day => 'day', :month => 'month', :year => 'year' }) | ||
%> | ||
<%= hidden_field_tag :referrer, request.referer %> | ||
<%= f.submit "Check" %> | ||
<% end %> | ||
|
||
<%= render 'form' %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Agegate | ||
VERSION = "0.0.2" | ||
VERSION = "0.0.3" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<%= form_for @gate do |f| %> | ||
<%= f.label :birthday, "Please insert your date of birth" %> | ||
<%= f.date_select( | ||
:birthday, | ||
:order => [:day, :month, :year], | ||
:start_year => Time.now.year - 4, | ||
:end_year => Time.now.year - 100, | ||
:prompt => { :day => 'day', :month => 'month', :year => 'year' }) | ||
%> | ||
<%= hidden_field_tag :referrer, request.referer %> | ||
<%= f.submit "Check" %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1>Access denied</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
<h1>Age gate</h1> | ||
<div class="gate"> | ||
<%= form_for @gate do |f| %> | ||
<%= f.label :birthday, "Please insert your date of birth" %> | ||
<%= f.date_select( | ||
:birthday, | ||
:order => [:day, :month, :year], | ||
:start_year => Time.now.year - 100, | ||
:end_year => Time.now.year - 10, | ||
:prompt => { :day => 'day', :month => 'month', :year => 'year' }) | ||
%> | ||
<%= hidden_field_tag :referrer, request.referer %> | ||
<%= f.submit "Check" %> | ||
<% end %> | ||
|
||
<%= render 'form' %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# require 'spec_helper' | ||
|
||
# module Agegate | ||
# describe GatesController do | ||
|
||
# describe "GET 'show'" do | ||
# it "returns http success" do | ||
# get('show', use_route: 'agegate') | ||
# response.should be_success | ||
# end | ||
# end | ||
# end | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# spec/acceptance/visitors_can_pass_agegate_spec.rb | ||
require 'spec_helper' | ||
|
||
describe 'agegate' do | ||
it 'block < 18 visitors' do | ||
visit '/' | ||
|
||
select_birthday 1, 'April', (Time.now.year - 10) | ||
click_button 'Check' | ||
|
||
page.should have_content('Access denied') | ||
end | ||
|
||
it 'allow > 18 visitors' do | ||
visit '/' | ||
|
||
select_birthday 1, 'April', (Time.now.year - 30) | ||
click_button 'Check' | ||
|
||
page.should have_content('Access granted') | ||
end | ||
|
||
end |
Oops, something went wrong.