-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
66 changed files
with
381 additions
and
28 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
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 |
---|---|---|
|
@@ -12,4 +12,5 @@ | |
// | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require bootstrap | ||
//= require_tree . |
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,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ |
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,3 @@ | ||
// Place all the styles related to the Sessions controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
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,4 @@ | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery | ||
include SessionsHelper | ||
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,19 @@ | ||
class SessionsController < ApplicationController | ||
def create | ||
user = User.find_by_email(params[:session][:email]) | ||
if user && user.authenticate(params[:session][:password]) | ||
sign_in user | ||
redirect_to user | ||
else | ||
flash.now[:error] = 'Invalid email/password combination' # Not quite right! | ||
render 'new' | ||
end | ||
end | ||
def new | ||
|
||
end | ||
def destroy | ||
sign_out | ||
redirect_to root_path | ||
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
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 @@ | ||
module SessionsHelper | ||
def sign_in(user) | ||
cookies.permanent[:remember_token] = user.remember_token | ||
self.current_user = user | ||
end | ||
|
||
def signed_in? | ||
!current_user.nil? | ||
end | ||
|
||
def current_user=(user) | ||
@current_user = user | ||
end | ||
|
||
def current_user | ||
@current_user ||= User.find_by_remember_token(cookies[:remember_token]) | ||
end | ||
|
||
def sign_out | ||
self.current_user = nil | ||
cookies.delete(:remember_token) | ||
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
module UsersHelper | ||
def gravatar_for(user) | ||
gravatar_id = Digest::MD5::hexdigest(user.email.downcase) | ||
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}" | ||
image_tag(gravatar_url, alt: user.name, class: "gravatar") | ||
end | ||
def gravatar_for(user, options = { size: 50 }) | ||
gravatar_id = Digest::MD5::hexdigest(user.email.downcase) | ||
size = options[:size] | ||
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}" | ||
image_tag(gravatar_url, alt: user.name, class: "gravatar") | ||
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
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,19 @@ | ||
<% provide(:title, "Sign in") %> | ||
<h1>Sign in</h1> | ||
|
||
<div class="row"> | ||
<div class="span6 offset3"> | ||
<%= form_for(:session, url: sessions_path) do |f| %> | ||
|
||
<%= f.label :email %> | ||
<%= f.text_field :email %> | ||
|
||
<%= f.label :password %> | ||
<%= f.password_field :password %> | ||
|
||
<%= f.submit "Sign in", class: "btn btn-large btn-primary" %> | ||
<% end %> | ||
|
||
<p>New user? <%= link_to "Sign up now!", signup_path %></p> | ||
</div> | ||
</div> |
Empty file.
Empty file.
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,16 @@ | ||
#!/usr/bin/env ruby | ||
# | ||
# This file was generated by Bundler. | ||
# | ||
# The application 'cucumber' is installed as part of a gem, and | ||
# this file is here to facilitate running it. | ||
# | ||
|
||
require 'pathname' | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", | ||
Pathname.new(__FILE__).realpath) | ||
|
||
require 'rubygems' | ||
require 'bundler/setup' | ||
|
||
load Gem.bin_path('cucumber', 'cucumber') |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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,8 @@ | ||
<% | ||
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" | ||
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" | ||
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" | ||
%> | ||
default: <%= std_opts %> features | ||
wip: --tags @wip:3 --wip features | ||
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip |
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,5 +1,5 @@ | ||
# Sample localization file for English. Add more files in this directory for other locales. | ||
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. | ||
|
||
en: | ||
hello: "Hello world" | ||
activerecord: | ||
attributes: | ||
user: | ||
password_digest: "Password" |
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,6 @@ | ||
class AddRememberTokenToUsers < ActiveRecord::Migration | ||
def change | ||
add_column :users, :remember_token, :string | ||
add_index :users, :remember_token | ||
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
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,56 @@ | ||
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. | ||
# It is recommended to regenerate this file in the future when you upgrade to a | ||
# newer version of cucumber-rails. Consider adding your own code to a new file | ||
# instead of editing this one. Cucumber will automatically load all features/**/*.rb | ||
# files. | ||
|
||
require 'cucumber/rails' | ||
|
||
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In | ||
# order to ease the transition to Capybara we set the default here. If you'd | ||
# prefer to use XPath just remove this line and adjust any selectors in your | ||
# steps to use the XPath syntax. | ||
Capybara.default_selector = :css | ||
|
||
# By default, any exception happening in your Rails application will bubble up | ||
# to Cucumber so that your scenario will fail. This is a different from how | ||
# your application behaves in the production environment, where an error page will | ||
# be rendered instead. | ||
# | ||
# Sometimes we want to override this default behaviour and allow Rails to rescue | ||
# exceptions and display an error page (just like when the app is running in production). | ||
# Typical scenarios where you want to do this is when you test your error pages. | ||
# There are two ways to allow Rails to rescue exceptions: | ||
# | ||
# 1) Tag your scenario (or feature) with @allow-rescue | ||
# | ||
# 2) Set the value below to true. Beware that doing this globally is not | ||
# recommended as it will mask a lot of errors for you! | ||
# | ||
ActionController::Base.allow_rescue = false | ||
|
||
# Remove/comment out the lines below if your app doesn't have a database. | ||
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. | ||
begin | ||
DatabaseCleaner.strategy = :transaction | ||
rescue NameError | ||
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." | ||
end | ||
|
||
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. | ||
# See the DatabaseCleaner documentation for details. Example: | ||
# | ||
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do | ||
# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]} | ||
# end | ||
# | ||
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do | ||
# DatabaseCleaner.strategy = :transaction | ||
# end | ||
# | ||
|
||
# Possible values are :truncation and :transaction | ||
# The :transaction strategy is faster, but might give you threading problems. | ||
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature | ||
Cucumber::Rails::Database.javascript_strategy = :truncation | ||
|
Oops, something went wrong.