diff --git a/.gitignore b/.gitignore index b4e5a85..54c797f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ db/schema.rb .DS_Store log/* tmp/* + +.bundle +.sass-cache/ \ No newline at end of file diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..53607ea --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--colour diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..f2269bc --- /dev/null +++ b/Gemfile @@ -0,0 +1,35 @@ +source "http://rubygems.org" + +gem "rails", "3.1.0" + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem "sass-rails", "~> 3.1.0" + gem "coffee-rails", "~> 3.1.0" + gem "uglifier" +end + +gem 'jquery-rails' + +gem "bson_ext", "~> 1.4" +gem "mongo", "~> 1.4" +gem "mongo_mapper", "~> 0.9.1" +gem "haml-rails", "~> 0.3.4" +gem "devise", "~> 1.4.7" +gem "devise-mongo_mapper", :git => "git://github.com/proxygear/devise-mongo_mapper.git" +gem "will_paginate", "~> 3.0.1" +gem "dynamic_form" + +group :development, :test do + gem "rspec-rails", "~> 2.6.1" +end + +group :test do + gem "capybara" + gem "timecop" + gem "randexp", "~> 0.1.5" + gem "factory_girl", "~> 2.1.2" + gem "email_spec", "~> 1.2.1" + gem "mocha", "~> 0.10.0" +end \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..3b6d2b5 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,212 @@ +GIT + remote: git://github.com/proxygear/devise-mongo_mapper.git + revision: bbafac6612be9c68ca5938c24dfbd3f9327e65a6 + specs: + devise-mongo_mapper (0.0.2) + devise + +GEM + remote: http://rubygems.org/ + specs: + ParseTree (3.0.7) + RubyInline (>= 3.7.0) + sexp_processor (>= 3.0.0) + RubyInline (3.10.1) + ZenTest (~> 4.3) + ZenTest (4.6.2) + actionmailer (3.1.0) + actionpack (= 3.1.0) + mail (~> 2.3.0) + actionpack (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + builder (~> 3.0.0) + erubis (~> 2.7.0) + i18n (~> 0.6) + rack (~> 1.3.2) + rack-cache (~> 1.0.3) + rack-mount (~> 0.8.2) + rack-test (~> 0.6.1) + sprockets (~> 2.0.0) + activemodel (3.1.0) + activesupport (= 3.1.0) + bcrypt-ruby (~> 3.0.0) + builder (~> 3.0.0) + i18n (~> 0.6) + activerecord (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + arel (~> 2.2.1) + tzinfo (~> 0.3.29) + activeresource (3.1.0) + activemodel (= 3.1.0) + activesupport (= 3.1.0) + activesupport (3.1.0) + multi_json (~> 1.0) + arel (2.2.1) + bcrypt-ruby (3.0.1) + bson (1.4.0) + bson_ext (1.4.0) + builder (3.0.0) + capybara (1.1.1) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + selenium-webdriver (~> 2.0) + xpath (~> 0.1.4) + childprocess (0.2.2) + ffi (~> 1.0.6) + coffee-rails (3.1.1) + coffee-script (>= 2.2.0) + railties (~> 3.1.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.1.2) + devise (1.4.7) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.0.3) + warden (~> 1.0.3) + diff-lcs (1.1.3) + dynamic_form (1.1.4) + email_spec (1.2.1) + mail (~> 2.2) + rspec (~> 2.0) + erubis (2.7.0) + execjs (1.2.9) + multi_json (~> 1.0) + factory_girl (2.1.2) + activesupport + ffi (1.0.9) + haml (3.1.3) + haml-rails (0.3.4) + actionpack (~> 3.0) + activesupport (~> 3.0) + haml (~> 3.0) + railties (~> 3.0) + hike (1.2.1) + i18n (0.6.0) + jquery-rails (1.0.14) + railties (~> 3.0) + thor (~> 0.14) + json_pure (1.6.1) + mail (2.3.0) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + metaclass (0.0.1) + mime-types (1.16) + mocha (0.10.0) + metaclass (~> 0.0.1) + mongo (1.4.0) + bson (= 1.4.0) + mongo_mapper (0.9.2) + activemodel (~> 3.0) + activesupport (~> 3.0) + plucky (~> 0.3.8) + multi_json (1.0.3) + nokogiri (1.5.0) + orm_adapter (0.0.5) + plucky (0.3.8) + mongo (~> 1.3) + polyglot (0.3.2) + rack (1.3.3) + rack-cache (1.0.3) + rack (>= 0.4) + rack-mount (0.8.3) + rack (>= 1.0.0) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.1.0) + actionmailer (= 3.1.0) + actionpack (= 3.1.0) + activerecord (= 3.1.0) + activeresource (= 3.1.0) + activesupport (= 3.1.0) + bundler (~> 1.0) + railties (= 3.1.0) + railties (3.1.0) + actionpack (= 3.1.0) + activesupport (= 3.1.0) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2) + randexp (0.1.5) + ParseTree + rdoc (3.9.4) + rspec (2.6.0) + rspec-core (~> 2.6.0) + rspec-expectations (~> 2.6.0) + rspec-mocks (~> 2.6.0) + rspec-core (2.6.4) + rspec-expectations (2.6.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.6.0) + rspec-rails (2.6.1) + actionpack (~> 3.0) + activesupport (~> 3.0) + railties (~> 3.0) + rspec (~> 2.6.0) + rubyzip (0.9.4) + sass (3.1.7) + sass-rails (3.1.2) + actionpack (~> 3.1.0) + railties (~> 3.1.0) + sass (>= 3.1.4) + sprockets (~> 2.0.0) + tilt (~> 1.3.2) + selenium-webdriver (2.6.0) + childprocess (>= 0.2.1) + ffi (>= 1.0.7) + json_pure + rubyzip + sexp_processor (3.0.7) + sprockets (2.0.0) + hike (~> 1.2) + rack (~> 1.0) + tilt (!= 1.3.0, ~> 1.1) + thor (0.14.6) + tilt (1.3.3) + timecop (0.3.5) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.29) + uglifier (1.0.3) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + warden (1.0.5) + rack (>= 1.0) + will_paginate (3.0.1) + xpath (0.1.4) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + bson_ext (~> 1.4) + capybara + coffee-rails (~> 3.1.0) + devise (~> 1.4.7) + devise-mongo_mapper! + dynamic_form + email_spec (~> 1.2.1) + factory_girl (~> 2.1.2) + haml-rails (~> 0.3.4) + jquery-rails + mocha (~> 0.10.0) + mongo (~> 1.4) + mongo_mapper (~> 0.9.1) + rails (= 3.1.0) + randexp (~> 0.1.5) + rspec-rails (~> 2.6.1) + sass-rails (~> 3.1.0) + timecop + uglifier + will_paginate (~> 3.0.1) diff --git a/README.md b/README.md index 53f62e6..862e74b 100644 --- a/README.md +++ b/README.md @@ -37,22 +37,22 @@ ErrorNot : You will need - Ruby of 1.8.6 or greater - - Rails 2.3.5 - - MongoMapper 0.7.1 + - Rails 3.1.0 + - MongoMapper 0.9.2 - A MongoDB 1.0.1 or greater ## Installing - fetch source from our github account ( git clone git://github.com/errornot/ErrorNot.git ) - - install rails gem ( gem install rails -v2.3.5 ) - - install all gems required by ErrorNot ( rake gems:install ) + - install bundler gem ( `gem install bundler` ) + - install all gems required by ErrorNot ( `bundle` ) - configure your database - copy config/database.yml.sample to config/database.yml - update config/database.yml with your database connection and the table name - configure your email settings - copy config/email.yaml.sample to config/email.yml - update it with email configuration (sendmail or smtp information) - - Start the server in production mode : ruby script/server -e production + - Start the server in production mode : `rails s -e production` - If you want that your user can be received their notification by digest, you need add the rake task `RAILS_ENV=production rake notify:digest` in your crontab - You can now register your self /user/new @@ -62,7 +62,7 @@ You will need If you upgrade your errornot, you need launch the task to migration your database if needed - rake db:mongo_migrate + `rake db:mongo_migrate` ## Using @@ -79,30 +79,30 @@ If you want to hack ErrorNot, you need launch all Test. This test is made with r You can install all gems needed with command : - - RAILS_ENV=test rake gems:install + - `bundle` Now you can launch spec : - - rake spec + - `rake spec` If you want to fill your Database with a lot of fake data, you can launch the task : - - rake db:populate:default + - `rake db:populate:default` This task depends of : - - rake db:populate:users - - rake db:populate:projects - - rake db:populate:errors - - rake db:populate:comments - - rake db:populate:same_errors + - `rake db:populate:users` + - `rake db:populate:projects` + - `rake db:populate:errors` + - `rake db:populate:comments` + - `rake db:populate:same_errors` When you have generated some data, you can fetch a user account by console and use the default password 'tintinpouet' -$ script/console -> Project.first.members.first.email -=> "pinguidity@yachtdom.com" + $ rails c + > Project.first.members.first.email + => "pinguidity@yachtdom.com" Every project has one related email. You can use this email to log in. @@ -119,5 +119,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Affero General Public License -along with this program. If not, see [http://www.fsf.org/licensing/licenses/agpl-3.0.html](http://www.fsf.org/licensing/licenses/agpl-3.0.html) - +along with this program. If not, see [http://www.fsf.org/licensing/licenses/agpl-3.0.html](http://www.fsf.org/licensing/licenses/agpl-3.0.html) \ No newline at end of file diff --git a/Rakefile b/Rakefile index 3bb0e85..abc3ac0 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,7 @@ +#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require(File.join(File.dirname(__FILE__), 'config', 'boot')) +require File.expand_path('../config/application', __FILE__) -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -require 'tasks/rails' +ErrorNot::Application.load_tasks diff --git a/app/assets/images/accept-icon.png b/app/assets/images/accept-icon.png new file mode 100644 index 0000000..0ad2b90 Binary files /dev/null and b/app/assets/images/accept-icon.png differ diff --git a/app/assets/images/delete-icon.png b/app/assets/images/delete-icon.png new file mode 100644 index 0000000..aa1a746 Binary files /dev/null and b/app/assets/images/delete-icon.png differ diff --git a/app/assets/images/errornot.png b/app/assets/images/errornot.png new file mode 100644 index 0000000..6cac2e2 Binary files /dev/null and b/app/assets/images/errornot.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..a707e05 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,3 @@ +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..fc25b57 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,7 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + *= require_self + *= require_tree . +*/ \ No newline at end of file diff --git a/public/stylesheets/base.css b/app/assets/stylesheets/base.css.erb similarity index 98% rename from public/stylesheets/base.css rename to app/assets/stylesheets/base.css.erb index 0860330..203ee9e 100644 --- a/public/stylesheets/base.css +++ b/app/assets/stylesheets/base.css.erb @@ -16,7 +16,7 @@ body { font: 13px/22px Arial; background: #FFF; } /* Header */ header { position: relative; width: 940px; height: 95px; margin: 0 auto; } -header p a { display: block; width: 317px; height: 52px; margin: 15px 0 0 0; background: url('/images/errornot.png') 0 0 no-repeat; } +header p a { display: block; width: 317px; height: 52px; margin: 15px 0 0 0; background: url(<%= asset_path "/images/errornot.png" %>) 0 0 no-repeat; } header ul { position: absolute; top: 0; right: 10px; } header ul li { float: left; list-style-type: none; } header ul li a { display: block; padding: 3px 10px; background: rgb(35, 31, 32); font: normal 12px Arial; text-decoration: none; color: rgb(141, 198, 63); } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6d761aa..7c2132a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,11 +9,11 @@ class ApplicationController < ActionController::Base # Scrub sensitive parameters from your log # filter_parameter_logging :password - rescue_from Mongo::InvalidObjectID do + rescue_from BSON::InvalidObjectId do render_404 end - rescue_from MongoMapper::DocumentNotFound do + rescue_from MongoMapper::DocumentNotFound do render_404 end diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index ee8c9e2..54fee58 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -17,7 +17,7 @@ def create if @error.update_attributes(params[:error]) render :status => 200, :text => 'error create' else - render :status => 422, :text => @error.errors.full_messages + render :status => 422, :text => @error.errors.full_messages.first end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index da6c7dd..20a6c6c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -51,7 +51,7 @@ def remove_member email = params[:user_email] if !email.blank? && @project.remove_member!(:email => email) flash[:notice] = t('flash.projects.remove_member.success') - UserMailer.deliver_project_removal(email, current_user.email, @project) + UserMailer.project_removal(email, current_user.email, @project).deliver else flash[:notice] = t('flash.projects.remove_member.failure') end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a49f998..96481bd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,8 +2,8 @@ module ApplicationHelper def flash_to_html(flash) flash.map {|key, val| - "
#{val}
" - }.join('') + "
#{h(val)}
" + }.join('').html_safe end def title_header diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/error.rb b/app/models/error.rb index 89bda53..8f83d9b 100644 --- a/app/models/error.rb +++ b/app/models/error.rb @@ -1,8 +1,8 @@ class Error include MongoMapper::Document - include Callbacks::ErrorCallback + include ::Callbacks::ErrorCallback - key :resolved, Boolean, :index => true + key :resolved, Boolean, :index => true, :default => false key :session, Hash key :raised_at, Time, :required => true key :backtrace, Array @@ -22,11 +22,11 @@ class Error key :project_id, ObjectId, :required => true, :index => true belongs_to :project - has_many :comments - include_errors_from :comments + many :comments + validates_associated :comments - has_many :same_errors, :class_name => 'ErrorEmbedded' - include_errors_from :same_errors + many :same_errors, :class_name => 'ErrorEmbedded' + validates_associated :same_errors # To keep track of some metrics: key :nb_comments, Integer, :required => true, :default => 0 @@ -59,7 +59,6 @@ def resolved! save! end - ## # code to update keywords # Not call in direct @@ -86,7 +85,7 @@ def update_count def send_notify_task Project.find(project_id).members.each do |member| if member.notify_by_email? - UserMailer.deliver_error_notify(member.email, self) + UserMailer.error_notify(member.email, self).deliver end end end @@ -95,6 +94,7 @@ def resolved=(resolution) old_resolution = read_attribute(:resolved) # check if string and replace it by a bool. Controller send String, not bool resolution = resolution == 'true' if resolution.kind_of?(String) + if old_resolution && !resolution self.unresolved_at = Time.now end @@ -103,6 +103,7 @@ def resolved=(resolution) self.resolved_at = Time.now self.resolveds_at << self.resolved_at.utc end + write_attribute(:resolved, resolution) end diff --git a/app/models/error_embedded.rb b/app/models/error_embedded.rb index 0f1b69c..bd26c07 100644 --- a/app/models/error_embedded.rb +++ b/app/models/error_embedded.rb @@ -1,5 +1,5 @@ class ErrorEmbedded - include MongoMapper::Document + include MongoMapper::EmbeddedDocument key :session, Hash key :raised_at, Time, :required => true @@ -8,7 +8,7 @@ class ErrorEmbedded key :data, Hash key :error_id, ObjectId - belongs_to :root_error, :class_name => 'Error', :foreign_key => 'error_id' + alias_method :root_error, :_parent_document delegate :last_raised_at, :to => :root_error delegate :same_errors, :to => :root_error @@ -19,10 +19,8 @@ class ErrorEmbedded delegate :backtrace, :to => :root_error delegate :count, :to => :root_error - after_create :reactive_error - + after_save :reactive_error after_save :update_last_raised_at - after_save :update_error_count def url request['url'] @@ -37,7 +35,7 @@ def params def reactive_error if root_error.resolved root_error.resolved = false - root_error.send_notify + root_error.send_notify unless new? root_error.save! end end @@ -51,9 +49,4 @@ def update_last_raised_at end end - def update_error_count - root_error.update_count - root_error.save - end - -end +end \ No newline at end of file diff --git a/app/models/member.rb b/app/models/member.rb index 54cfb33..7d02b82 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -46,7 +46,7 @@ def notify_by_digest=(notify) def send_digest return unless notify_by_digest errors = self._root_document.error_reports.not_send_by_digest_since(self.digest_send_at) - UserMailer.deliver_error_digest_notify(self.email, errors) unless errors.empty? + UserMailer.error_digest_notify(self.email, errors).deliver unless errors.empty? self.digest_send_at = Time.now.utc self.save true diff --git a/app/models/project.rb b/app/models/project.rb index edc07da..e826590 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -16,15 +16,15 @@ def not_send_by_digest_since(date) end end - has_many :members + many :members validate :need_members validate :need_admin_members - include_errors_from :members + validates_associated :members ## CALLBACK - before_validation_on_create :gen_api_key + before_validation :gen_api_key, :on => :create before_save :update_members_data def add_admin_member(user) @@ -84,7 +84,7 @@ def add_member_by_email(emails) else members.build(:email => email.strip, :admin => false) - UserMailer.deliver_project_invitation(email.strip, self) + UserMailer.project_invitation(email.strip, self).deliver end end save! @@ -159,7 +159,7 @@ def gen_api_key! end def gen_api_key - self.api_key = ActiveSupport::SecureRandom.hex(12) + self.api_key = SecureRandom.hex(12) end private diff --git a/app/models/user.rb b/app/models/user.rb index e8db7ed..bb7916e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,8 +4,8 @@ class User ## Include default devise modules. ## Others available are :lockable, :timeoutable and :activatable. - devise :authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable - + plugin MongoMapper::Devise + devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable after_save :check_member_project validate :not_change_email diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb index 19371d4..b910fc3 100644 --- a/app/models/user_mailer.rb +++ b/app/models/user_mailer.rb @@ -1,28 +1,37 @@ class UserMailer < ActionMailer::Base def project_invitation(email, project) - recipients email - subject "[#{APP_NAME}] invitation on project #{project.name}" - body :email => email, :project => project + @email = email + @project = project + mail( + :to => email, + :subject => "[#{APP_NAME}] invitation on project #{project.name}", + ) end def project_removal(removed_email, remover_email, project) - recipients removed_email - subject "[#{project.name}] Good bye" - body :project => project, :remover_email => remover_email + @project = project + @remover_email = remover_email + mail( + :to => removed_email, + :subject => "[#{project.name}] Good bye", + ) end def error_notify(email, error) - recipients email - subject "[#{error.project.name}] #{error.message}" - body :error => error + @error = error + mail( + :to => email, + :subject => "[#{error.project.name}] #{error.message}", + ) end def error_digest_notify(email, errors) - recipients email - subject "[DIGEST] [#{errors.first.project.name}] error report #{I18n.l(Time.now)}" - body :errors => errors + @errors = errors + mail( + :to => email, + :subject => "[DIGEST] [#{errors.first.project.name}] error report #{I18n.l(Time.now)}", + ) end - end diff --git a/app/views/confirmations/new.html.erb b/app/views/confirmations/new.html.erb deleted file mode 100644 index 80670d8..0000000 --- a/app/views/confirmations/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -

Resend confirmation instructions

- -<% form_for resource_name, resource, :url => confirmation_path(resource_name) do |f| %> - <%= f.error_messages %> - -

<%= f.label :email %>

-

<%= f.text_field :email %>

- -

<%= f.submit "Resend confirmation instructions" %>

-<% end %> - -<%= render :partial => "shared/devise_links" %> \ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..77f8871 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @resource.email %>!

+ +

You can confirm your ErrorNot account through the link below:

+ +

<%= link_to 'Confirm my account', user_confirmation_url(:confirmation_token => @resource.confirmation_token) %>

diff --git a/app/views/devise_mailer/confirmation_instructions.html.erb b/app/views/devise_mailer/confirmation_instructions.html.erb deleted file mode 100644 index 861cc47..0000000 --- a/app/views/devise_mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Welcome <%= @resource.email %>!

- -

You can confirm your ErrorNot account through the link below:

- -

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

diff --git a/app/views/devise_mailer/reset_password_instructions.html.erb b/app/views/devise_mailer/reset_password_instructions.html.erb deleted file mode 100644 index ae9e888..0000000 --- a/app/views/devise_mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Someone has requested a link to change your password, and you can do this through the link below.

- -

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

- -

If you didn't request this, please ignore this email.

-

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise_mailer/unlock_instructions.html.erb b/app/views/devise_mailer/unlock_instructions.html.erb deleted file mode 100644 index 2263c21..0000000 --- a/app/views/devise_mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

- -

Click the link below to unlock your account:

- -

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

diff --git a/app/views/errors/_header_error.html.haml b/app/views/errors/_header_error.html.haml index 0e81aee..e0bccb7 100644 --- a/app/views/errors/_header_error.html.haml +++ b/app/views/errors/_header_error.html.haml @@ -1,5 +1,5 @@ #resolved - - form_for @root_error, :html => {:class => 'edit_error'} do |f| + = form_for @root_error, :html => {:class => 'edit_error'} do |f| = hidden_field_tag 'error[resolved]', !@error.resolved = f.submit @error.resolved ? 'Unresolved' : 'Resolved' diff --git a/app/views/errors/data.html.haml b/app/views/errors/data.html.haml index cd0781e..cb806ab 100644 --- a/app/views/errors/data.html.haml +++ b/app/views/errors/data.html.haml @@ -9,10 +9,10 @@ %ul - @error.data.each do |key, val| - if val.is_a(Hash) - %li - = "#{key}:" - %ul - - val.each do |k,v| - %li="#{k}: #{h v}" + %li + = "#{key}:" + %ul + - val.each do |k,v| + %li="#{k}: #{h v}" - else %li="#{key}: #{val}" diff --git a/app/views/errors/index.html.haml b/app/views/errors/index.html.haml index abe1f7d..106eb46 100644 --- a/app/views/errors/index.html.haml +++ b/app/views/errors/index.html.haml @@ -7,7 +7,7 @@ | %span=link_to 'Delete this project', project_url(@project), :method => :delete, :confirm => "Do you really want to delete the project #{@project.name}? There is no way back!" -- form_tag project_errors_url(@project.id), :method => :get do += form_tag project_errors_url(@project.id), :method => :get do %p %label Limit to: diff --git a/app/views/errors/request_info.html.haml b/app/views/errors/request_info.html.haml index 04244f1..ec7a0e0 100644 --- a/app/views/errors/request_info.html.haml +++ b/app/views/errors/request_info.html.haml @@ -14,6 +14,6 @@ = "#{key}:" %ul - val.each do |k,v| - %li="#{k}: #{h v}" + %li!="#{k}: #{h v}" - else %li="#{key}: #{val}" diff --git a/app/views/errors/show.html.haml b/app/views/errors/show.html.haml index edc2f0e..6befd3f 100644 --- a/app/views/errors/show.html.haml +++ b/app/views/errors/show.html.haml @@ -42,7 +42,7 @@ %div = simple_format(comment.text) - - form_tag comment_project_error_url(@root_error.project, @root_error) do + = form_tag comment_project_error_url(@root_error.project, @root_error) do %p = text_area_tag :text %p diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 53c15cd..94eac9a 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -2,7 +2,9 @@ %html{ :lang => "en" } %head %meta{ :content => "text/html; charset=utf-8", "http-equiv" => "Content-Type" } - %link{ :href => "/stylesheets/base.css", :title => "Base CSS", :rel => "stylesheet", :type => "text/css", :media => "screen" } + = stylesheet_link_tag :application + = javascript_include_tag :application + = csrf_meta_tags %title= title_header %body %header @@ -13,7 +15,7 @@ - if user_signed_in? %ul %li= link_to t('layout.user_nav.profile'), edit_user_url - %li= link_to t('layout.user_nav.logout'), destroy_user_session_url + %li= link_to t('layout.user_nav.logout'), destroy_user_session_url, :method => :delete %nav - if user_signed_in? @@ -32,5 +34,5 @@ %a{ :href => "http://github.com/errornot/ErrorNot/" } %span Errornot - ="-" - = Errornot::VERSION + \- + = ::Errornot::VERSION diff --git a/app/views/loggers/new.html.haml b/app/views/loggers/new.html.haml index 6f102d8..e313865 100644 --- a/app/views/loggers/new.html.haml +++ b/app/views/loggers/new.html.haml @@ -1,6 +1,6 @@ = error_messages_for :mlogger -- form_for(@mlogger, :url => loggers_url) do |f| += form_for(@mlogger, :url => loggers_url) do |f| %ul %li = f.label :application diff --git a/app/views/passwords/edit.html.erb b/app/views/passwords/edit.html.erb deleted file mode 100644 index 968701f..0000000 --- a/app/views/passwords/edit.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Change your password

- -<% form_for resource_name, resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %> - <%= f.error_messages %> - <%= f.hidden_field :reset_password_token %> - -

<%= f.label :password %>

-

<%= f.password_field :password %>

- -

<%= f.label :password_confirmation %>

-

<%= f.password_field :password_confirmation %>

- -

<%= f.submit "Change my password" %>

-<% end %> - -<%= render :partial => "shared/devise_links" %> \ No newline at end of file diff --git a/app/views/passwords/new.html.erb b/app/views/passwords/new.html.erb deleted file mode 100644 index 055e7ce..0000000 --- a/app/views/passwords/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -

Forgot your password?

- -<% form_for resource_name, resource, :url => password_path(resource_name) do |f| %> - <%= f.error_messages %> - -

<%= f.label :email %>

-

<%= f.text_field :email %>

- -

<%= f.submit "Send me reset password instructions" %>

-<% end %> - -<%= render :partial => "shared/devise_links" %> \ No newline at end of file diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 6824167..3d345a6 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -6,18 +6,18 @@ = "API key: #{@project.api_key}" = link_to 'Reset', reset_apikey_project_url(@project), :method => :put -- field_set_tag 'Project' do += field_set_tag 'Project' do = error_messages_for :project - - form_for @project do |f| + = form_for @project do |f| %p %label='Name :' = f.text_field :name %p = f.submit 'update' -- field_set_tag 'Members' do - - form_tag add_member_project_url(@project), :method => :put do += field_set_tag 'Members' do + = form_tag add_member_project_url(@project), :method => :put do %p = label_tag 'Email' %br/ diff --git a/app/views/projects/leave.html.haml b/app/views/projects/leave.html.haml index 2aafd8f..36b3a9f 100644 --- a/app/views/projects/leave.html.haml +++ b/app/views/projects/leave.html.haml @@ -6,6 +6,6 @@ %p you want really leave this project ? - - form_tag leave_project_url(@project), :method => :delete do + = form_tag leave_project_url(@project), :method => :delete do = submit_tag 'Leave' diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 039c7ac..5cd5b3e 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -4,7 +4,7 @@ = error_messages_for :project -- form_for @project do |f| += form_for @project do |f| %p %label='Name :' = f.text_field :name diff --git a/app/views/registrations/edit.html.erb b/app/views/registrations/edit.html.erb deleted file mode 100644 index 1fd0b45..0000000 --- a/app/views/registrations/edit.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -

Edit <%= resource_name.to_s.humanize %>

- -<% form_for resource_name, resource, :url => registration_path(resource_name), :html => { :method => :put } do |f| -%> - <%= f.error_messages %> - -

<%= f.label :email %>

-

<%= f.text_field :email %>

- -

<%= f.label :password %> (leave blank if you don't want to change it)

-

<%= f.password_field :password %>

- -

<%= f.label :password_confirmation %>

-

<%= f.password_field :password_confirmation %>

- -

<%= f.label :current_password %> (we need your current password to confirm your changes)

-

<%= f.password_field :current_password %>

- -

<%= f.submit "Update" %>

-<% end -%> - -

Cancel my account

- -

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.

- -<%= render :partial => "shared/devise_links" %> diff --git a/app/views/registrations/new.html.erb b/app/views/registrations/new.html.erb deleted file mode 100644 index 423edd3..0000000 --- a/app/views/registrations/new.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -

Sign up

- -<% form_for resource_name, resource, :url => registration_path(resource_name) do |f| -%> - <%= f.error_messages %> -

<%= f.label :email %>

-

<%= f.text_field :email %>

- -

<%= f.label :password %>

-

<%= f.password_field :password %>

- -

<%= f.label :password_confirmation %>

-

<%= f.password_field :password_confirmation %>

- -

<%= f.submit "Sign up" %>

-<% end -%> - -<%= render :partial => "shared/devise_links" %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb deleted file mode 100644 index 717de99..0000000 --- a/app/views/sessions/new.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<% @title = t('views.sessions.new.title') %> - -

Sign in

- -<% form_for resource_name, resource, :url => session_path(resource_name) do |f| -%> -

<%= f.label :email %>

-

<%= f.text_field :email %>

- -

<%= f.label :password %>

-

<%= f.password_field :password %>

- - <% if devise_mapping.rememberable? -%> -

<%= f.check_box :remember_me %> <%= f.label :remember_me %>

- <% end -%> - -

- <%= f.submit "Sign in" %> - | - <%= link_to t('views.sessions.new.register'), new_user_url %> -

-<% end -%> - -<%= render :partial => "shared/devise_links" %> diff --git a/app/views/shared/_devise_links.erb b/app/views/shared/_devise_links.erb deleted file mode 100644 index 7a57119..0000000 --- a/app/views/shared/_devise_links.erb +++ /dev/null @@ -1,20 +0,0 @@ -<%- if controller_name != 'sessions' %> - <%= link_to t('devise.sessions.link'), new_session_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to t('devise.registrations.link'), new_registration_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to t('devise.passwords.link'), new_password_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to t('devise.confirmations.link'), new_confirmation_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.lockable? && controller_name != 'unlocks' %> - <%= link_to t('devise.unlocks.link'), new_unlock_path(resource_name) %>
-<% end -%> - diff --git a/app/views/unlocks/new.html.erb b/app/views/unlocks/new.html.erb deleted file mode 100644 index 60314e7..0000000 --- a/app/views/unlocks/new.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -

Resend unlock instructions

- -<% form_for resource_name, resource, :url => unlock_path(resource_name) do |f| %> - <%= f.error_messages %> - -

<%= f.label :email %>

-

<%= f.text_field :email %>

- -

<%= f.submit "Resend unlock instructions" %>

-<% end %> - -<%= render :partial => "shared/devise_links" %> \ No newline at end of file diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 6ba1f91..41b708d 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -5,8 +5,8 @@ %dt Email: %dd= current_user.email -- form_for @user, :url => user_url do |f| - - field_set_tag 'Update my password' do += form_for @user, :url => user_url do |f| + = field_set_tag 'Update my password' do %p = f.label :current_password, 'Current password' = f.password_field :current_password @@ -23,8 +23,8 @@ %p{:class => 'submit'} = f.submit 'Update my password' -- form_for @user, :url => update_notify_user_url do |f| - - field_set_tag 'Notify me' do += form_for @user, :url => update_notify_user_url do |f| + = field_set_tag 'Notify me' do %table.small %thead %tr diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb deleted file mode 100644 index a02e0b5..0000000 --- a/app/views/users/new.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<% @title = t('views.users.new.title') %> - -<% form_for @user, :url => user_path do |f| -%> - <%= f.error_messages %> -

<%= f.label :email %>

-

<%= f.text_field :email %>

-

<%= f.label :password %>

-

<%= f.password_field :password %>

-

<%= f.label :password_confirmation %>

-

<%= f.password_field :password_confirmation %>

- -

<%= f.submit "Sign Up" %>

-<% end -%> diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml new file mode 100644 index 0000000..bc6b453 --- /dev/null +++ b/app/views/users/new.html.haml @@ -0,0 +1,12 @@ +- @title = t('views.users.new.title') + += form_for @user, :url => user_path do |f| + = f.error_messages + %p= f.label :email + %p= f.text_field :email + %p= f.label :password + %p= f.password_field :password + %p= f.label :password_confirmation + %p= f.password_field :password_confirmation + + %p.submit= f.submit "Sign Up" diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..cccabb2 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run ErrorNot::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..31d8a3f --- /dev/null +++ b/config/application.rb @@ -0,0 +1,54 @@ +require File.expand_path('../boot', __FILE__) + +require "action_controller/railtie" +require "action_mailer/railtie" +require "sprockets/railtie" + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require *Rails.groups(:assets => %w(development test)) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +module ErrorNot + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + config.autoload_paths += %W(#{config.root}/lib) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + config.time_zone = 'UTC' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + config.i18n.default_locale = :en + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end + +end + +## TODO: CHANGE it and made it in configatron please :'( +APP_NAME = 'af_error' diff --git a/config/boot.rb b/config/boot.rb index dd5e3b6..4489e58 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,110 +1,6 @@ -# Don't change this file! -# Configure your app in config/environment.rb and config/environments/*.rb +require 'rubygems' -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -module Rails - class << self - def boot! - unless booted? - preinitialize - pick_boot.run - end - end - - def booted? - defined? Rails::Initializer - end - - def pick_boot - (vendor_rails? ? VendorBoot : GemBoot).new - end - - def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") - end - - def preinitialize - load(preinitializer_path) if File.exist?(preinitializer_path) - end - - def preinitializer_path - "#{RAILS_ROOT}/config/preinitializer.rb" - end - end - - class Boot - def run - load_initializer - Rails::Initializer.run(:set_load_path) - end - end - - class VendorBoot < Boot - def load_initializer - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - Rails::Initializer.run(:install_gem_spec_stubs) - Rails::GemDependency.add_frozen_gem_path - end - end - - class GemBoot < Boot - def load_initializer - self.class.load_rubygems - load_rails_gem - require 'initializer' - end - - def load_rails_gem - if version = self.class.gem_version - gem 'rails', version - else - gem 'rails' - end - rescue Gem::LoadError => load_error - $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) - exit 1 - end - - class << self - def rubygems_version - Gem::RubyGemsVersion rescue nil - end - - def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] - else - parse_gem_version(read_environment_rb) - end - end - - def load_rubygems - min_version = '1.3.2' - require 'rubygems' - unless rubygems_version >= min_version - $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) - exit 1 - end - - rescue LoadError - $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) - exit 1 - end - - def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ - end - - private - def read_environment_rb - File.read("#{RAILS_ROOT}/config/environment.rb") - end - end - end -end - -# All that for this: -Rails.boot! +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/database.yml.sample b/config/database.yml.sample index 230fdae..e717a46 100644 --- a/config/database.yml.sample +++ b/config/database.yml.sample @@ -1,18 +1,20 @@ -# SQLite version 3.x -# gem install sqlite3-ruby (not necessary on OS X Leopard) development: + host: 127.0.0.1 + port: 27017 adapter: mongodb - database: error_logger_dev + database: error_not_development -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. test: + host: 127.0.0.1 + port: 27017 adapter: mongodb - database: error_logger_test + database: error_not_test +# set these environment variables on your prod server production: + host: 127.0.0.1 + port: 27017 adapter: mongodb - database: error_logger - username: XXXX - password: XXX + database: error_not + username: <%= ENV['MONGO_USERNAME'] %> + password: <%= ENV['MONGO_PASSWORD'] %> diff --git a/config/environment.rb b/config/environment.rb index 4619eb9..03baffb 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,61 +1,5 @@ -# Be sure to restart your server when you modify this file +# Load the rails application +require File.expand_path('../application', __FILE__) -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION - -# Bootstrap the Rails environment, frameworks, and default configuration -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - - # Specify gems that this application depends on and have them installed with rake gems:install - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Skip frameworks you're not going to use. To use Rails without a database, - # you must remove the Active Record framework. - config.frameworks -= [ :active_record, :active_resource] - - config.gem "mongo", :lib => 'mongo', :version => '0.19.1' - config.gem "mongo_ext", :lib => 'mongo', :version => '0.19.1' - config.gem "mongo_mapper", :version => '0.7.1' - config.gem "haml", :version => '2.2.21' - config.gem "warden", :version => '0.9.7' - config.gem "devise", :version => '1.0.4' - - # change this version with Rails 3.0 :( - config.gem 'agnostic-will_paginate', :version => '3.0.0', :lib => 'will_paginate' - - # Activate observers that should always be running - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. - config.time_zone = 'UTC' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] - # Available locales: en, fr - config.i18n.default_locale = :en - - # Deliveries are disabled by default. Do NOT modify this section. - # Define your email configuration in email.yml instead. - # It will automatically turn deliveries on - config.action_mailer.perform_deliveries = false - -end - -## TODO: CHANGE it and made it in configatron please :'( -APP_NAME = 'af_error' +# Initialize the rails application +ErrorNot::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index d67452f..48adec8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,17 +1,32 @@ -# Settings specified here will take precedence over those in config/environment.rb +ErrorNot::Application.configure do + # Settings specified here will take precedence over those in config/application.rb -# In the development environment your application's code is reloaded on -# every request. This slows down response time but is perfect for development -# since you don't have to restart the webserver when you make code changes. -config.cache_classes = false + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_view.debug_rjs = true -config.action_controller.perform_caching = false + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false -# Don't care if the mailer can't send -config.action_mailer.raise_delivery_errors = false + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true + + config.action_mailer.default_url_options = { :host => 'localhost:3000' } +end \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index 5e549a9..21efb69 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,28 +1,60 @@ -# Settings specified here will take precedence over those in config/environment.rb +ErrorNot::Application.configure do + # Settings specified here will take precedence over those in config/application.rb -# The production environment is meant for finished, "live" apps. -# Code is not reloaded between requests -config.cache_classes = true + # Code is not reloaded between requests + config.cache_classes = true -# Full error reports are disabled and caching is turned on -config.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true -config.action_view.cache_template_loading = true + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true -# See everything in the log (default is :info) -# config.log_level = :debug + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false -# Use a different logger for distributed setups -# config.logger = SyslogLogger.new + # Compress JavaScripts and CSS + config.assets.compress = true -# Use a different cache store in production -# config.cache_store = :mem_cache_store + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false -# Enable serving of images, stylesheets, and javascripts from an asset server -# config.action_controller.asset_host = "http://assets.example.com" + # Generate digests for assets URLs + config.assets.digest = true -# Disable delivery errors, bad email addresses will be ignored -# config.action_mailer.raise_delivery_errors = false + # Defaults to Rails.root.join("public/assets") + # config.assets.manifest = YOUR_PATH -# Enable threaded mode -# config.threadsafe! + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify +end diff --git a/config/environments/test.rb b/config/environments/test.rb index 80258eb..750911b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,35 +1,44 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! -config.cache_classes = true - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = false -config.action_view.cache_template_loading = true - -# Disable request forgery protection in test environment -config.action_controller.allow_forgery_protection = false - -# Tell Action Mailer not to deliver emails to the real world. -# The :test delivery method accumulates sent emails in the -# ActionMailer::Base.deliveries array. -config.action_mailer.delivery_method = :test - -# Use SQL instead of Active Record's schema dumper when creating the test database. -# This is necessary if your schema can't be completely dumped by the schema dumper, -# like if you have constraints or database-specific column types -# config.active_record.schema_format = :sql - -config.gem "rspec", :lib => false, :version => ">= 1.2.0" -config.gem "rspec-rails", :lib => false, :version => ">= 1.2.0" -config.gem "randexp" -config.gem "factory_girl" -config.gem 'email_spec', :lib => 'email_spec', :version => '0.4.0' -config.gem "mocha", :version => '0.9.8' +ErrorNot::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr + + # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets + config.assets.allow_debugging = true + + config.action_mailer.default_url_options = { :host => 'localhost:3000' } +end \ No newline at end of file diff --git a/config/initializers/mongodb.rb b/config/initializers/00_mongodb.rb similarity index 73% rename from config/initializers/mongodb.rb rename to config/initializers/00_mongodb.rb index eb5966d..a16045b 100644 --- a/config/initializers/mongodb.rb +++ b/config/initializers/00_mongodb.rb @@ -1,4 +1,4 @@ -db_config = YAML::load(File.read(RAILS_ROOT + "/config/database.yml")) +db_config = YAML::load(File.read("#{Rails.root}/config/database.yml")) if db_config[Rails.env] && db_config[Rails.env]['adapter'] == 'mongodb' mongo = db_config[Rails.env] diff --git a/config/initializers/array_extensions.rb b/config/initializers/array_extensions.rb new file mode 100644 index 0000000..cae85e0 --- /dev/null +++ b/config/initializers/array_extensions.rb @@ -0,0 +1,5 @@ +class Array + def random_element + self[Kernel.rand(length)] + end +end \ No newline at end of file diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index c2169ed..59385cd 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -3,5 +3,5 @@ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } -# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code. -# Rails.backtrace_cleaner.remove_silencers! \ No newline at end of file +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 56694dc..8fc4354 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,96 +1,211 @@ # Use this hook to configure devise mailer, warden hooks and so forth. The first # four configuration values can also be set straight in your models. Devise.setup do |config| - # Configure the e-mail address which will be shown in DeviseMailer. - config.mailer_sender = "please-change-me@config-initializers-devise.com" - - # ==> Configuration for :authenticatable - # Invoke `rake secret` and use the printed value to setup a pepper to generate - # the encrypted password. By default no pepper is used. - # config.pepper = "rake secret output" - - # Configure how many times you want the password is reencrypted. Default is 10. - # config.stretches = 10 - - # Define which will be the encryption algorithm. Supported algorithms are :sha1 - # (default), :sha512 and :bcrypt. Devise also supports encryptors from others - # authentication tools as :clearance_sha1, :authlogic_sha512 (then you should set - # stretches above to 20 for default behavior) and :restful_authentication_sha1 - # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper) - # config.encryptor = :sha1 - - # Configure which keys are used when authenticating an user. By default is + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class with default "from" parameter. + config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com" + + # Configure the class responsible to send e-mails. + # config.mailer = "Devise::Mailer" + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/mongo_mapper' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for - # authenticating an user, both parameters are required. Remember that those + # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. config.authentication_keys = [ :email ] + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [ :email ] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [ :email ] + + # Tell if authentication through request.params is enabled. True by default. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. False by default. + # config.http_authenticatable = false + + # If http headers should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. "Application" by default. + # config.http_authentication_realm = "Application" + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. + config.stretches = Rails.env.test? ? 1 : 10 + + # Setup a pepper to generate the encrypted password. + # config.pepper = "730a93d6cf5abc2b958d837e0a1b873dacc7181c93ce756f76fa197b88f44426ff221bec94195c87d2fdd37b041e62c0d1126e54fd55b3b07de6b8e8446009c2" + # ==> Configuration for :confirmable - # The time you want give to your user to confirm his account. During this time - # he will be able to access your application without confirming. Default is nil. + # The time you want to give your user to confirm his account. During this time + # he will be able to access your application without confirming. Default is 0.days + # When confirm_within is zero, the user won't be able to sign in without confirming. + # You can use this to let your user access some features of your application + # without confirming the account, but blocking it after a certain period + # (ie 2 days). # config.confirm_within = 2.days + # Defines which key will be used when confirming an account + # config.confirmation_keys = [ :email ] + # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks + # If true, a valid remember token can be re-used between multiple browsers. + # config.remember_across_browsers = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # If true, uses the password salt as remember token. This should be turned + # to false if you are not using database authenticatable. + config.use_salt_as_remember_token = true + + # Options to be passed to the created cookie. For instance, you can set + # :secure => true in order to force SSL only cookies. + # config.cookie_options = {} + + # ==> Configuration for :validatable + # Range for password length. Default is 6..128. + # config.password_length = 6..128 + + # Email regex used to validate email formats. It simply asserts that + # an one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + # config.email_regexp = /\A[^@]+@[^@]+\z/ + # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this - # time the user will be asked for credentials again. - # config.timeout_in = 10.minutes + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes # ==> Configuration for :lockable - # Number of authentication tries before locking an account. - # config.maximum_attempts = 20 + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [ :email ] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email - # :time = Reanables login after a certain ammount of time (see :unlock_in below) - # :both = enables both strategies + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour - # ==> General configuration - # Load and configure the ORM. Supports :active_record (default), :mongo_mapper - # (requires mongo_ext installed) and :data_mapper (experimental). - # require 'devise/orm/mongo_mapper' - config.orm = :mongo_mapper - + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [ :email ] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 2.hours + + # ==> Configuration for :encryptable + # Allow you to use another encryption algorithm besides bcrypt (default). You can use + # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, + # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) + # and :restful_authentication_sha1 (then you should set stretches to 10, and copy + # REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :sha512 + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # If true, authentication through token does not store user in session and needs + # to be supplied on each request. Useful if you are using the token as API token. + # config.stateless_token = false + + # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for - # "sessions/users/new". It's turned off by default because it's slower if you + # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. - # config.scoped_views = true - - # By default, devise detects the role accessed based on the url. So whenever - # accessing "/users/sign_in", it knows you are accessing an User. This makes - # routes as "/sign_in" not possible, unless you tell Devise to use the default - # scope, setting true below. - # config.use_default_scope = true + # config.scoped_views = false - # Configure the default scope used by Devise. By default it's the first devise - # role declared in your routes. + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). config.default_scope = :user - # If you want to use other strategies, that are not (yet) supported by Devise, - # you can configure them inside the config.warden block. The example below - # allows you to setup OAuth, using http://github.com/roman/warden_oauth + # Configure sign_out behavior. + # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope). + # The default is true, which means any logout action will sign out all active scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. # - # config.warden do |manager| - # manager.oauth(:twitter) do |twitter| - # twitter.consumer_secret = - # twitter.consumer_key = - # twitter.options :site => 'http://twitter.com' - # end - # manager.default_strategies.unshift :twitter_oauth - # end + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The :"*/*" and "*/*" formats below is required to match Internet + # Explorer requests. + # config.navigational_formats = [:"*/*", "*/*", :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = Rails.env.test? ? :get : :delete - # Configure default_url_options if you are using dynamic segments in :path_prefix - # for devise_for. + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. # - # config.default_url_options do - # { :locale => I18n.locale } + # config.warden do |manager| + # manager.failure_app = AnotherApp + # manager.intercept_401 = false + # manager.default_strategies(:scope => :user).unshift :some_external_strategy # end -end +end \ No newline at end of file diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index d531b8b..9e8b013 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -# Add new inflection rules using the following format +# Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb deleted file mode 100644 index c94db0a..0000000 --- a/config/initializers/new_rails_defaults.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# These settings change the behavior of Rails 2 apps and will be defaults -# for Rails 3. You can remove this initializer when Rails 3 is released. - -if defined?(ActiveRecord) - # Include Active Record class name as root for JSON serialized output. - ActiveRecord::Base.include_root_in_json = true - - # Store the full class name (including module namespace) in STI type column. - ActiveRecord::Base.store_full_sti_class = true -end - -ActionController::Routing.generate_best_match = false - -# Use ISO 8601 format for JSON serialized times and dates. -ActiveSupport.use_standard_json_time_format = true - -# Don't escape HTML entities in JSON, leave that for the #json_escape helper. -# if you're including raw json in an HTML page. -ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..da986b4 --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +ErrorNot::Application.config.secret_token = '73dcb7ecfaa8d1dfe47c663478299b192bb10a49174016841398d852ac42275b6bb701298a828de766b3b98e537774cc38b800f9e4c83c6628681665219f4e0d' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 56acaea..cfbd8d4 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,15 +1,8 @@ # Be sure to restart your server when you modify this file. -# Your secret key for verifying cookie session data integrity. -# If you change this key, all old sessions will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -ActionController::Base.session = { - :key => '_error-logger_session', - :secret => 'e41bebb3a6595d92070c9f5f6f977045724b721bda9ef03406aa358ec6a1755ca2fcc9b6ab0bbf078534509aab8c6b6873701f52b4a158b64ce5dfa950cc732e' -} +ErrorNot::Application.config.session_store :cookie_store, key: '_ErrorNot_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information -# (create the session table with "rake db:sessions:create") -# ActionController::Base.session_store = :active_record_store +# (create the session table with "rails generate session_migration") +# ErrorNot::Application.config.session_store :active_record_store diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..999df20 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 1b47ff0..b182635 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -1,28 +1,58 @@ +# Additional translations at http://github.com/plataformatec/devise/wiki/I18n + en: + errors: + messages: + expired: "has expired, please request a new one" + not_found: "not found" + already_confirmed: "was already confirmed, please try signing in" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" + devise: - sessions: - link: 'Sign in' - signed_in: 'Signed in successfully.' - signed_out: 'Signed out successfully.' + failure: + already_authenticated: 'You are already signed in.' unauthenticated: 'You need to sign in or sign up before continuing.' unconfirmed: 'You have to confirm your account before continuing.' locked: 'Your account is locked.' invalid: 'Invalid email or password.' + invalid_token: 'Invalid authentication token.' timeout: 'Your session expired, please sign in again to continue.' inactive: 'Your account was not activated yet.' + sessions: + signed_in: 'Signed in successfully.' + signed_out: 'Signed out successfully.' passwords: - link: 'Forgot password?' send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' updated: 'Your password was changed successfully. You are now signed in.' + updated_not_active: 'Your password was changed successfully.' + send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail" confirmations: - link: "Didn't receive confirmation instructions?" send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' + send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.' confirmed: 'Your account was successfully confirmed. You are now signed in.' + registrations: + signed_up: 'Welcome! You have signed up successfully.' + inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.' + updated: 'You updated your account successfully.' + destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' + reasons: + inactive: 'inactive' + unconfirmed: 'unconfirmed' + locked: 'locked' unlocks: - link: "Didn't receive unlock instructions?" send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' unlocked: 'Your account was successfully unlocked. You are now signed in.' + send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.' + omniauth_callbacks: + success: 'Successfully authorized from %{kind} account.' + failure: 'Could not authorize you from %{kind} because "%{reason}".' mailer: - confirmation_instructions: 'Confirmation instructions' - reset_password_instructions: 'Reset password instructions' - unlock_instructions: 'Unlock Instructions' + confirmation_instructions: + subject: 'Confirmation instructions' + reset_password_instructions: + subject: 'Reset password instructions' + unlock_instructions: + subject: 'Unlock Instructions' diff --git a/config/locales/fr_rails.yml b/config/locales/fr_rails.yml index f2736f7..a61ed46 100644 --- a/config/locales/fr_rails.yml +++ b/config/locales/fr_rails.yml @@ -1,6 +1,9 @@ -# French translations for Ruby on Rails +# French translations for Ruby on Rails # by Christian Lescuyer (christian@flyingcoders.com) -# contributor: Sebastien Grosjean - ZenCocoon.com +# contributors: +# - Sebastien Grosjean - ZenCocoon.com +# - Bruno Michel - http://github.com/nono +# - Tsutomu Kuroda - http://github.com/kuroda (t-kuroda@oiax.jp) fr: date: @@ -8,23 +11,60 @@ fr: default: "%d/%m/%Y" short: "%e %b" long: "%e %B %Y" - long_ordinal: "%e %B %Y" - only_day: "%e" + day_names: + - dimanche + - lundi + - mardi + - mercredi + - jeudi + - vendredi + - samedi + abbr_day_names: + - dim + - lun + - mar + - mer + - jeu + - ven + - sam + month_names: + - ~ + - janvier + - février + - mars + - avril + - mai + - juin + - juillet + - août + - septembre + - octobre + - novembre + - décembre + abbr_month_names: + - ~ + - jan. + - fév. + - mar. + - avr. + - mai + - juin + - juil. + - août + - sept. + - oct. + - nov. + - déc. + order: + - :day + - :month + - :year - day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi] - abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam] - month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre] - abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.] - order: [ :day, :month, :year ] - time: formats: - default: "%d %B %Y %H:%M" - time: "%H:%M" + default: "%d %B %Y %H:%M:%S" short: "%d %b %H:%M" - long: "%A %d %B %Y %H:%M:%S %Z" - long_ordinal: "%A %d %B %Y %H:%M:%S %Z" - only_second: "%S" + long: "%A %d %B %Y %H:%M" am: 'am' pm: 'pm' @@ -33,36 +73,39 @@ fr: half_a_minute: "une demi-minute" less_than_x_seconds: zero: "moins d'une seconde" - one: "moins de 1 seconde" - other: "moins de {{count}} secondes" + one: "moins d'une seconde" + other: "moins de %{count} secondes" x_seconds: - one: "1 seconde" - other: "{{count}} secondes" + one: "1 seconde" + other: "%{count} secondes" less_than_x_minutes: zero: "moins d'une minute" - one: "moins de 1 minute" - other: "moins de {{count}} minutes" + one: "moins d'une minute" + other: "moins de %{count} minutes" x_minutes: - one: "1 minute" - other: "{{count}} minutes" + one: "1 minute" + other: "%{count} minutes" about_x_hours: one: "environ une heure" - other: "environ {{count}} heures" + other: "environ %{count} heures" x_days: - one: "1 jour" - other: "{{count}} jours" + one: "1 jour" + other: "%{count} jours" about_x_months: one: "environ un mois" - other: "environ {{count}} mois" + other: "environ %{count} mois" x_months: - one: "1 mois" - other: "{{count}} mois" + one: "1 mois" + other: "%{count} mois" about_x_years: one: "environ un an" - other: "environ {{count}} ans" + other: "environ %{count} ans" over_x_years: one: "plus d'un an" - other: "plus de {{count}} ans" + other: "plus de %{count} ans" + almost_x_years: + one: "presqu'un an" + other: "presque %{count} ans" prompts: year: "Année" month: "Mois" @@ -70,54 +113,110 @@ fr: hour: "Heure" minute: "Minute" second: "Seconde" - + number: format: + separator: "," + delimiter: " " precision: 3 - separator: ',' - delimiter: ' ' + significant: false + strip_insignificant_zeros: false currency: format: - unit: '€' + format: "%n %u" + unit: "€" + separator: "," + delimiter: " " precision: 2 - format: '%n %u' + significant: false + strip_insignificant_zeros: false + percentage: + format: + delimiter: "" + precision: + format: + delimiter: "" human: format: + delimiter: "" precision: 2 - storage_units: [ Octet, ko, Mo, Go, To ] - + significant: true + strip_insignificant_zeros: true + storage_units: + format: "%n %u" + units: + byte: + one: "octet" + other: "octets" + kb: "ko" + mb: "Mo" + gb: "Go" + tb: "To" + decimal_units: + format: "%n %u" + units: + unit: "" + thousand: "millier" + million: "million" + billion: "milliard" + trillion: "billion" + quadrillion: "million de milliards" + support: array: - sentence_connector: 'et' - skip_last_comma: true words_connector: ", " two_words_connector: " et " last_word_connector: " et " - + select: + prompt: "Veuillez sélectionner" + + helpers: + select: + prompt: "Veuillez sélectionner" + submit: + create: "Créer un(e) %{model}" + update: "Modifier ce(tte) %{model}" + submit: "Enregistrer ce(tte) %{model}" + + attributes: + created_at: "Créé le" + updated_at: "Modifié le" + + errors: + format: "Le %{attribute} %{message}" + messages: &errors_messages + inclusion: "n'est pas inclus(e) dans la liste" + exclusion: "n'est pas disponible" + invalid: "n'est pas valide" + confirmation: "ne concorde pas avec la confirmation" + accepted: "doit être accepté(e)" + empty: "doit être rempli(e)" + blank: "doit être rempli(e)" + too_long: "est trop long (pas plus de %{count} caractères)" + too_short: "est trop court (au moins %{count} caractères)" + wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)" + not_a_number: "n'est pas un nombre" + not_an_integer: "doit être un nombre entier" + greater_than: "doit être supérieur à %{count}" + greater_than_or_equal_to: "doit être supérieur ou égal à %{count}" + equal_to: "doit être égal à %{count}" + less_than: "doit être inférieur à %{count}" + less_than_or_equal_to: "doit être inférieur ou égal à %{count}" + odd: "doit être impair" + even: "doit être pair" + template: &errors_template + header: + one: "Impossible d'enregistrer ce(tte) %{model} : 1 erreur" + other: "Impossible d'enregistrer ce(tte) %{model} : %{count} erreurs" + body: "Veuillez vérifier les champs suivants : " + activerecord: errors: - template: - header: - one: "Impossible d'enregistrer {{model}}: 1 erreur" - other: "Impossible d'enregistrer {{model}}: {{count}} erreurs." - body: "Veuillez vérifier les champs suivants :" messages: - inclusion: "n'est pas inclus(e) dans la liste" - exclusion: "n'est pas disponible" - invalid: "n'est pas valide" - confirmation: "ne concorde pas avec la confirmation" - accepted: "doit être accepté(e)" - empty: "doit être rempli(e)" - blank: "doit être rempli(e)" - too_long: "est trop long (pas plus de {{count}} caractères)" - too_short: "est trop court (au moins {{count}} caractères)" - wrong_length: "ne fait pas la bonne longueur (doit comporter {{count}} caractères)" taken: "n'est pas disponible" - not_a_number: "n'est pas un nombre" - greater_than: "doit être supérieur à {{count}}" - greater_than_or_equal_to: "doit être supérieur ou égal à {{count}}" - equal_to: "doit être égal à {{count}}" - less_than: "doit être inférieur à {{count}}" - less_than_or_equal_to: "doit être inférieur ou égal à {{count}}" - odd: "doit être impair" - even: "doit être pair" + record_invalid: "La validation a échoué : %{errors}" + <<: *errors_messages + template: + <<: *errors_template + full_messages: + format: "%{attribute} %{message}" \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 6a20b89..bd81451 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,68 +1,50 @@ -ActionController::Routing::Routes.draw do |map| - # The priority is based upon order of creation: first created -> highest priority. - - map.resources :projects, :member => {:add_member => :put, - :remove_member => :delete, - :leave => [:delete, :get], - :admins => [:put, :delete], - :reset_apikey => [:put]} do |project| - project.resources :errors, :except => [:new, :create, :update], - :member => {:comment => :post, - :backtrace => :get, - :session_info => :get, - :data => :get, - :similar_error => :get, - :request_info => :get} do |error| - error.resources :same_errors, :only => [:show], :member => { - :backtrace => :get, - :session_info => :get, - :data => :get, - :similar_error => :get, - :request_info => :get} - end - end - - map.resources :errors, :only => [:create, :update] - - map.devise_for :users - map.resource :user, :collection => {:update_notify => :put} - map.root :controller => :projects, :action => :index - - # Sample of regular route: - # map.connect 'products/:id', :controller => 'catalog', :action => 'view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # map.resources :products - - # Sample resource route with options: - # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } - - # Sample resource route with sub-resources: - # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller - - # Sample resource route with more complex sub-resources - # map.resources :products do |products| - # products.resources :comments - # products.resources :sales, :collection => { :recent => :get } - # end - - # Sample resource route within a namespace: - # map.namespace :admin do |admin| - # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) - # admin.resources :products - # end - - # You can have the root of your site routed with map.root -- just remember to delete public/index.html. - # map.root :controller => "welcome" - - # See how all your routes lay out with "rake routes" - - # Install the default routes as the lowest priority. - # Note: These default routes make all actions in every controller accessible via GET requests. You should - # consider removing or commenting them out if you're using named routes and resources. -end +ErrorNot::Application.routes.draw do + resources :projects do + + member do + put :add_member + delete :remove_member + get :leave + delete :leave + put :admins + delete :admin + put :reset_apikey + end # member + + resources :errors, :except => [:new, :create, :update] do + + member do + post :comment + get :backtrace + get :session_info + get :data + get :similar_error + get :request_info + end # member + + resources :same_errors, :only => [:show] do + + member do + get :backtrace + get :session_info + get :data + get :similar_error + get :request_info + end # member + + end # resources :same_errors + + end # resources :errors + + end # resources :projects + + resources :errors, :only => [:create, :update] + + devise_for :users + + resource :user do + put :update_notify, :on => :collection + end # resource :user + + root :to => "projects#index" +end # ErrorNot::Application.routes.draw \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb index 3174d0c..4edb1e8 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -2,6 +2,6 @@ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: -# -# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) -# Major.create(:name => 'Daley', :city => cities.first) +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/populate.rake b/lib/tasks/populate.rake index 6092974..1927595 100644 --- a/lib/tasks/populate.rake +++ b/lib/tasks/populate.rake @@ -50,7 +50,7 @@ namespace :db do require_factories puts 'create some projects' generate(10) do - make_project_with_admin(User.all.rand) + make_project_with_admin(User.all.random_element) end end @@ -59,7 +59,7 @@ namespace :db do require_factories puts 'create some errors' generate(1000) do - Factory(:error, :project => Project.all.rand) + Factory(:error, :project => Project.all.random_element) end end @@ -69,8 +69,8 @@ namespace :db do puts 'create some comments' error_ids = Error.all.map(&:id) generate(2_000) do - error = Error.find(error_ids.rand) - user = error.project.members.rand.user + error = Error.find(error_ids.random_element) + user = error.project.members.random_element.user error.comments.build(:user => user, :text => /[:paragraph:]/.gen) error.save! @@ -83,7 +83,7 @@ namespace :db do puts 'create some same errors' errors_ids = Error.all.map(&:id) generate(3000) do - error = Error.find(errors_ids.rand) + error = Error.find(errors_ids.random_element) error_attribute = Factory.build(:error, :project => error.project, :message => error.message, :backtrace => error.backtrace, diff --git a/lib/tasks/rspec.rake b/lib/tasks/rspec.rake deleted file mode 100644 index dba3ffc..0000000 --- a/lib/tasks/rspec.rake +++ /dev/null @@ -1,144 +0,0 @@ -gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 -rspec_gem_dir = nil -Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir| - rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb") -end -rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec') - -if rspec_gem_dir && (test ?d, rspec_plugin_dir) - raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n" -end - -if rspec_gem_dir - $LOAD_PATH.unshift("#{rspec_gem_dir}/lib") -elsif File.exist?(rspec_plugin_dir) - $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib") -end - -# Don't load rspec if running "rake gems:*" -unless ARGV.any? {|a| a =~ /^gems/} - -begin - require 'spec/rake/spectask' -rescue MissingSourceFile - module Spec - module Rake - class SpecTask - def initialize(name) - task name do - # if rspec-rails is a configured gem, this will output helpful material and exit ... - require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment")) - - # ... otherwise, do this: - raise <<-MSG - -#{"*" * 80} -* You are trying to run an rspec rake task defined in -* #{__FILE__}, -* but rspec can not be found in vendor/gems, vendor/plugins or system gems. -#{"*" * 80} -MSG - end - end - end - end - end -end - -Rake.application.instance_variable_get('@tasks').delete('default') - -spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop -task :noop do -end - -task :default => :spec -task :stats => "spec:statsetup" - -desc "Run all specs in spec directory (excluding plugin specs)" -Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['spec/**/*_spec.rb'] -end - -namespace :spec do - desc "Run all specs in spec directory with RCov (excluding plugin specs)" - Spec::Rake::SpecTask.new(:rcov) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['spec/**/*_spec.rb'] - t.rcov = true - t.rcov_opts = lambda do - IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten - end - end - - desc "Print Specdoc for all specs (excluding plugin specs)" - Spec::Rake::SpecTask.new(:doc) do |t| - t.spec_opts = ["--format", "specdoc", "--dry-run"] - t.spec_files = FileList['spec/**/*_spec.rb'] - end - - desc "Print Specdoc for all plugin examples" - Spec::Rake::SpecTask.new(:plugin_doc) do |t| - t.spec_opts = ["--format", "specdoc", "--dry-run"] - t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*') - end - - [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub| - desc "Run the code examples in spec/#{sub}" - Spec::Rake::SpecTask.new(sub => spec_prereq) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] - end - end - - desc "Run the code examples in vendor/plugins (except RSpec's own)" - Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*") - end - - namespace :plugins do - desc "Runs the examples for rspec_on_rails" - Spec::Rake::SpecTask.new(:rspec_on_rails) do |t| - t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] - t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb'] - end - end - - # Setup specs for stats - task :statsetup do - require 'code_statistics' - ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models') - ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views') - ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers') - ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers') - ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib') - ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing') - ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration') - ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models') - ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views') - ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers') - ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers') - ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib') - ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing') - ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration') - end - - namespace :db do - namespace :fixtures do - desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z." - task :load => :environment do - ActiveRecord::Base.establish_connection(Rails.env) - base_dir = File.join(Rails.root, 'spec', 'fixtures') - fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir - - require 'active_record/fixtures' - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file| - Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*')) - end - end - end - end -end - -end diff --git a/public/404.html b/public/404.html index eff660b..9a48320 100644 --- a/public/404.html +++ b/public/404.html @@ -1,23 +1,19 @@ - - - - + + - The page you were looking for doesn't exist (404) - + @@ -27,4 +23,4 @@

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

- \ No newline at end of file + diff --git a/public/422.html b/public/422.html index b54e4a3..83660ab 100644 --- a/public/422.html +++ b/public/422.html @@ -1,23 +1,19 @@ - - - - + + - The change you wanted was rejected (422) - + @@ -27,4 +23,4 @@

The change you wanted was rejected.

Maybe you tried to change something you didn't have access to.

- \ No newline at end of file + diff --git a/public/500.html b/public/500.html index ec3bbf0..b80307f 100644 --- a/public/500.html +++ b/public/500.html @@ -1,23 +1,19 @@ - - - - + + - We're sorry, but something went wrong (500) - + diff --git a/script/about b/script/about deleted file mode 100755 index 1eeb6eb..0000000 --- a/script/about +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" -require 'commands/about' diff --git a/script/autospec b/script/autospec deleted file mode 100755 index 837bbd7..0000000 --- a/script/autospec +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 -ENV['RSPEC'] = 'true' # allows autotest to discover rspec -ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux -system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) || - $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH") diff --git a/script/console b/script/console deleted file mode 100755 index 235a1f2..0000000 --- a/script/console +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/console' diff --git a/script/dbconsole b/script/dbconsole deleted file mode 100755 index 83c8436..0000000 --- a/script/dbconsole +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/dbconsole' diff --git a/script/destroy b/script/destroy deleted file mode 100755 index 88d295f..0000000 --- a/script/destroy +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/destroy' diff --git a/script/generate b/script/generate deleted file mode 100755 index 62a8a4c..0000000 --- a/script/generate +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/generate' diff --git a/script/performance/benchmarker b/script/performance/benchmarker deleted file mode 100755 index 3bff809..0000000 --- a/script/performance/benchmarker +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../../config/boot', __FILE__) -require 'commands/performance/benchmarker' diff --git a/script/performance/profiler b/script/performance/profiler deleted file mode 100755 index 0764057..0000000 --- a/script/performance/profiler +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../../config/boot', __FILE__) -require 'commands/performance/profiler' diff --git a/script/plugin b/script/plugin deleted file mode 100755 index b82201f..0000000 --- a/script/plugin +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/plugin' diff --git a/script/rails b/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/script/runner b/script/runner deleted file mode 100755 index be4c5d4..0000000 --- a/script/runner +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/runner' diff --git a/script/server b/script/server deleted file mode 100755 index b9fcb71..0000000 --- a/script/server +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.expand_path('../../config/boot', __FILE__) -require 'commands/server' diff --git a/script/spec b/script/spec deleted file mode 100755 index 46fdbe6..0000000 --- a/script/spec +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)} - require 'rubygems' unless ENV['NO_RUBYGEMS'] -else - gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 - ENV["RAILS_ENV"] ||= 'test' - require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT) -end -require 'spec/autorun' -exit ::Spec::Runner::CommandLine.run diff --git a/spec/blueprints.rb b/spec/blueprints.rb index 8d160cb..f9c0a33 100644 --- a/spec/blueprints.rb +++ b/spec/blueprints.rb @@ -17,7 +17,7 @@ def make_user(user_hash={}) e.project { Factory(:project) } e.message { /[:paragraph:]/.gen } e.resolved false - e.raised_at { (1..500).to_a.rand.day.ago } + e.raised_at { (1..500).to_a.random_element.day.ago } e.backtrace ['[PROJECT_ROOT]/vendor/gems/mongo-0.18/lib/../lib/mongo/types/objectid.rb:73:in `from_string', '[PROJECT_ROOT]/vendor/gems/mongo_mapper-0.6.4/lib/mongo_mapper/finder_options.rb:64:in `to_mongo_criteria'] e.request { @@ -53,11 +53,11 @@ def make_error_with_data(datas) nb_comments = datas.delete(:nb_comments) || 0 error = Factory(:error, datas) nb_comments.times { - error.comments.build(:user => error.project.members.rand.user, + error.comments.build(:user => error.project.members.random_element.user, :text => /[:paragraph:]/.gen) } error.save! - count.times { error.same_errors.create(:raised_at => error.raised_at) } + count.times { error.same_errors.build(:raised_at => error.raised_at).save } error end diff --git a/spec/controllers/errors_controller_spec.rb b/spec/controllers/errors_controller_spec.rb index f613719..857e824 100644 --- a/spec/controllers/errors_controller_spec.rb +++ b/spec/controllers/errors_controller_spec.rb @@ -2,7 +2,7 @@ describe ErrorsController do - integrate_views + render_views def error_request(api_key, hash={}) {'api_key' => api_key, @@ -34,7 +34,7 @@ def error_request(api_key, hash={}) @un_resolveds = 2.of { Factory(:error, :project => @project, :resolved => false) } end - describe 'POST #create', :shared => true do + shared_examples_for 'POST #create' do it 'should success with a good request' do lambda do post :create, error_request(@project.api_key) @@ -75,7 +75,7 @@ def error_request(api_key, hash={}) it 'should render 422 if avoid raised_at' do post :create, error_request(@project.api_key, :raised_at => nil) response.code.should == "422" - response.body.should == "Raised at can't be empty" + response.body.should == "Raised at can't be blank" end end @@ -85,17 +85,17 @@ def error_request(api_key, hash={}) it 'should not access to see an error' do get :show, :project_id => @project.id, :id => @resolveds.first.id - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end it 'should not access to see all errors' do get :index, :project_id => @project.id - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end it 'should not update an error' do put :update, :id => @un_resolveds.first.id, :error => {:resolved => true} - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end end @@ -115,7 +115,7 @@ def error_request(api_key, hash={}) project = Factory(:project) error = Factory(:error, :project => project) get :show, :project_id => project.id, :id => error.id - response.status.should == "401 Unauthorized" + response.status.should == 401 end end @@ -141,17 +141,17 @@ def error_request(api_key, hash={}) it 'should limit to resolved errors if resolved=y params send' do get :index, :project_id => @project.id, :resolved => 'y' - assert_equal @resolveds.map(&:id).sort, assigns[:errors].map(&:id).sort + @resolveds.should =~ assigns[:errors] end it 'should limit to un_resolved errors if resolved=n params send' do get :index, :project_id => @project.id, :resolved => 'n' - assert_equal @un_resolveds.map(&:id).sort, assigns[:errors].map(&:id).sort + @un_resolveds.should =~ assigns[:errors] end it 'should not limit to resolved errors if resolved= with empty value params send' do get :index, :project_id => @project.id, :resolved => nil - assert_equal @project.error_reports.map(&:id).sort, assigns[:errors].map(&:id).sort + @project.error_reports.should =~ assigns[:errors] end it 'should limit to errors having one of the given search word in their keywords' do @@ -222,7 +222,7 @@ def error_request(api_key, hash={}) project = Factory(:project) error = Factory(:error, :project => project) put :update, :id => error.id, :error => {:resolved => true} - response.status.should == '401 Unauthorized' + response.status.should == 401 end end diff --git a/spec/controllers/project_controller_spec.rb b/spec/controllers/project_controller_spec.rb index 7732c71..0669b20 100644 --- a/spec/controllers/project_controller_spec.rb +++ b/spec/controllers/project_controller_spec.rb @@ -2,28 +2,28 @@ describe ProjectsController do - integrate_views + render_views describe 'with an anonymous user' do it 'should not see index' do get :index - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end it 'should not see show' do get :show, :id => Factory(:project).id - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end it 'should not can create project' do post :create, :project => { :name => 'My big project' } - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end it 'should not can edit a project' do get :edit, :id => Factory(:project).id.to_s - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end it 'should not be able to reset the key api of a project' do put :reset_apikey, :id => Factory(:project).id - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end end @@ -132,11 +132,12 @@ it 'should call project.remove_member! and redirect_to edit with flash[:notice] if user is admin on project' do project = make_project_with_admin(@user) Project.any_instance.expects(:remove_member!).with(:email => 'foo@bar.com').returns(true) - UserMailer.expects(:deliver_project_removal).with(:removed_email => 'foo@bar.com', - :remover_email => @user.email, - :project => nil){|removed, remover, project2| + UserMailer.expects(:project_removal).with(:removed_email => 'foo@bar.com', + :remover_email => @user.email, + :project => nil){|removed, remover, project2| project2.id.to_s == project.id.to_s - } + }.returns UserMailer + UserMailer.expects(:deliver) put :remove_member, :user_email => 'foo@bar.com', :id => project.id.to_s response.should redirect_to(edit_project_url(project)) flash[:notice].should_not be_nil @@ -155,7 +156,7 @@ project = make_project_with_admin(@user) get :leave, :id => project.id.to_s response.should be_success - response.should_not have_tag('form') + response.body.should_not have_css('form') end end describe 'user not admin on this project' do @@ -163,7 +164,7 @@ project = make_project_with_admin(make_user) get :leave, :id => project.id.to_s response.should be_success - response.should have_tag('form') + response.body.should have_css('form') end end end @@ -213,7 +214,7 @@ put :admins, :id => project.id.to_s, :user_id => @user.id project.reload project.member(@user).admin?.should == false - response.code.should eql '401' + response_is_401 end end end @@ -293,7 +294,7 @@ delete :destroy, :id => project.id end.should change(Project, :count).by(0) Project.find(project.id).should be - response.code.should eql '401' + response_is_401 end end end diff --git a/spec/controllers/same_errors_controller_spec.rb b/spec/controllers/same_errors_controller_spec.rb index fa8e8cd..b816854 100644 --- a/spec/controllers/same_errors_controller_spec.rb +++ b/spec/controllers/same_errors_controller_spec.rb @@ -2,7 +2,7 @@ describe SameErrorsController do - integrate_views + render_views before do @user = make_user @@ -20,7 +20,7 @@ get :show, :project_id => @project.id, :error_id => @project.error_reports.first.id, :id => @project.error_reports.first.same_errors.first.id - response.should redirect_to(new_user_session_path('unauthenticated' => true)) + response.should redirect_to(new_user_session_path) end end @@ -45,7 +45,7 @@ get :show, :project_id => project.id, :error_id => error.id, :id => error.same_errors.first.id - response.status.should == "401 Unauthorized" + response_is_401 end end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 8ebd51e..281bd7f 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -3,7 +3,7 @@ describe UsersController do - integrate_views + render_views describe 'with anonymous user' do describe 'GET #new' do @@ -13,7 +13,7 @@ end it 'should fill email if email send by argument' do get :new, :email => 'foo@example.com' - response.body.should have_tag('input[type=?][value=?]', 'text', 'foo@example.com') + response.body.should have_css("input[type=text][value='foo@example.com']") end end end diff --git a/spec/models/error_embedded_spec.rb b/spec/models/error_embedded_spec.rb index fa91368..cb60762 100644 --- a/spec/models/error_embedded_spec.rb +++ b/spec/models/error_embedded_spec.rb @@ -19,14 +19,13 @@ error_embedded = project.error_with_message_and_backtrace(error_2.message, error_2.backtrace) error_embedded.update_attributes(:raised_at => nil) - error_embedded._root_document.should_not be_valid + error_embedded.root_error.should_not be_valid end end it 'should reactivate resolved in error root if resolved mark like true' do project = make_project_with_admin - error = Factory(:error, :project => project, - :resolved => true) + error = Factory(:error, :project => project, :resolved => true) error_2 = Factory.build(:error, :project => project, :message => error.message, :backtrace => error.backtrace) @@ -46,9 +45,10 @@ :backtrace => error.backtrace) error_embedded = project.error_with_message_and_backtrace(error_2.message, error_2.backtrace) - UserMailer.expects(:deliver_error_notify).with{ |email, error| + UserMailer.expects(:error_notify).with{ |email, error| email == user.email && error.kind_of?(Error) - } + }.returns UserMailer + UserMailer.expects(:deliver) error_embedded.update_attributes(error_2.attributes) end diff --git a/spec/models/error_spec.rb b/spec/models/error_spec.rb index d00a8c4..ebad457 100644 --- a/spec/models/error_spec.rb +++ b/spec/models/error_spec.rb @@ -77,7 +77,7 @@ project = make_project_with_admin(user) error = Factory(:error, :resolved => true, :project => project) - UserMailer.expects(:deliver_error_notify).with{ |email, error| + UserMailer.expects(:error_notify).with{ |email, error| email == user.email && error.kind_of?(Error) }.never error.resolved! @@ -90,7 +90,7 @@ error = Factory(:error, :resolved => true, :project => project) error.resolved! - UserMailer.expects(:deliver_error_notify).with{ |email, error| + UserMailer.expects(:error_notify).with{ |email, error| email == user.email && error.kind_of?(Error) }.never error.resolved = false @@ -103,9 +103,10 @@ it 'should send email to all member with notify_by_email is true' do user = make_user project = make_project_with_admin(user) - UserMailer.expects(:deliver_error_notify).with{ |email, error| + UserMailer.expects(:deliver) + UserMailer.expects(:error_notify).with{ |email, error| email == user.email && error.kind_of?(Error) - } + }.returns UserMailer Factory(:error, :project => project) end @@ -114,9 +115,10 @@ project = make_project_with_admin(user) project.members.build(:user => make_user, :notify_by_email => false) project.save! - UserMailer.expects(:deliver_error_notify).with{ |email, error| + UserMailer.expects(:deliver) + UserMailer.expects(:error_notify).with{ |email, error| email == user.email && error.kind_of?(Error) - } + }.returns UserMailer Factory(:error, :project => project) end end @@ -129,10 +131,11 @@ end it 'should return last raised_at of error_embedded if error has error_embedded' do error = Factory(:error, :raised_at => 3.days.ago) - error.same_errors.create(:raised_at => 2.days.ago) - last_raised = error.same_errors.create(:raised_at => 1.day.ago).raised_at + error.same_errors.build(:raised_at => 2.days.ago).save + last_raised = error.same_errors.build(:raised_at => 1.day.ago) + last_raised.save error.reload - error.last_raised_at.should == last_raised + error.last_raised_at.should == last_raised.raised_at end end @@ -153,7 +156,7 @@ describe '#unresolved_at' do it 'should be define when create' do - Factory(:error, :unresolved_at => nil).unresolved_at.should be_close(Time.now, 1.second) + Factory(:error, :unresolved_at => nil).unresolved_at.should be_within(1.second).of(Time.now) end it 'should not change if new same error added' do @@ -184,9 +187,11 @@ unresolved_at = error.unresolved_at error.resolved = true error.save - error.resolved = false - error.save - error.reload.unresolved_at.should_not == unresolved_at + Timecop.travel(Time.now + 1) do + error.resolved = false + error.save + error.reload.unresolved_at.should_not == unresolved_at + end end it 'should works with resolved = "true" by string not bool' do @@ -194,9 +199,11 @@ unresolved_at = error.unresolved_at error.resolved = 'true' error.save - error.resolved = 'false' - error.save - error.reload.unresolved_at.should_not == unresolved_at + Timecop.travel(Time.now + 1) do + error.resolved = false + error.save + error.reload.unresolved_at.should_not == unresolved_at + end end end @@ -205,7 +212,7 @@ error = Factory(:error) error.resolved = true error.save - error.resolved_at.should be_close(Time.now, 1.second) + error.resolved_at.should be_within(1.second).of(Time.now) end it 'should not be define in first' do @@ -217,7 +224,7 @@ error = Factory(:error) error.resolved = true error.save - error.resolved_at.should be_close(Time.now, 1.second) + error.resolved_at.should be_within(1.second).of(Time.now) time = error.resolved_at error.resolved = true error.save diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 330c1bc..0563036 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -34,12 +34,12 @@ member = make_member(:notify_by_digest => false) member.notify_by_digest = true member.save - member.digest_send_at.should be_close(Time.now.utc, 1.seconds) + member.digest_send_at.should be_within(1.second).of(Time.now) end it 'should be nil if notify_by_define become false' do member = make_member(:notify_by_digest => true) - member.digest_send_at.should be_close(Time.now.utc, 1.seconds) + member.digest_send_at.should be_within(1.second).of(Time.now) member.notify_by_digest = false member.save member.digest_send_at.should be_nil @@ -92,10 +92,11 @@ 2.of { Factory(:error, :unresolved_at => 2.minutes.ago.utc, :project => member._root_document) } - UserMailer.expects(:deliver_error_digest_notify).with(member.email, - errors_not_digest_send.sort_by(&:last_raised_at)) + UserMailer.expects(:error_digest_notify).with(member.email, + errors_not_digest_send.sort_by(&:last_raised_at)).returns UserMailer + UserMailer.expects(:deliver) member.send_digest.should be_true - Project.find(member._root_document.id).member(member.user).digest_send_at.should be_close(Time.now.utc, 1.seconds) + Project.find(member._root_document.id).member(member.user).digest_send_at.should be_within(1.second).of(Time.now) end it 'should not send email if all error already send before' do @@ -104,9 +105,9 @@ 2.of { Factory(:error, :unresolved_at => 2.minutes.ago.utc, :project => member._root_document) } - UserMailer.expects(:deliver_error_digest_notify).never + UserMailer.expects(:error_digest_notify).never member.send_digest.should be_true - Project.find(member._root_document.id).member(member.user).digest_send_at.should be_close(Time.now.utc, 1.seconds) + Project.find(member._root_document.id).member(member.user).digest_send_at.should be_within(1.second).of(Time.now) end end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 34c5e30..f3857a2 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -207,7 +207,7 @@ end it 'should add member if only one emails send and email is on a user' do - UserMailer.expects(:deliver_project_invitation).never + UserMailer.expects(:project_invitation).never @project.add_member_by_email(' foo@example.com ') @project.reload @project.member_include?(@user_1).should be_true @@ -215,7 +215,7 @@ @project.member_include?(@user_3).should be_false end it 'should add member if all emails separate by comma send and email is on users' do - UserMailer.expects(:deliver_project_invitation).never + UserMailer.expects(:project_invitation).never @project.add_member_by_email(' foo@example.com , bar@example.com ') @project.reload @project.member_include?(@user_1).should be_true @@ -224,8 +224,8 @@ end it 'should send an email to email which no in register' do - UserMailer.expects(:deliver_project_invitation).with("yahoo@yahoo.org", - @project) + UserMailer.expects(:project_invitation).with("yahoo@yahoo.org", @project).returns UserMailer + UserMailer.expects(:deliver) @project.add_member_by_email(' foo@example.com, yahoo@yahoo.org ') @project.reload @project.member_include?(@user_1).should be_true @@ -234,7 +234,8 @@ end it "should create member object with only email data in member's project" do - UserMailer.expects(:deliver_project_invitation).with('yahoo@yahoo.org', @project) + UserMailer.expects(:project_invitation).with('yahoo@yahoo.org', @project).returns UserMailer + UserMailer.expects(:deliver) lambda do @project.add_member_by_email('yahoo@yahoo.org') end.should change(@project.members, :size) diff --git a/spec/models/user_mailer_spec.rb b/spec/models/user_mailer_spec.rb index 3b40236..840533a 100644 --- a/spec/models/user_mailer_spec.rb +++ b/spec/models/user_mailer_spec.rb @@ -3,12 +3,14 @@ describe UserMailer do include EmailSpec::Helpers include EmailSpec::Matchers - include ActionController::UrlWriter + include Rails.application.routes.url_helpers + + let(:host) { Rails.application.config.action_mailer.default_url_options[:host] } describe '#project_invitation' do before do @project = Factory(:project) - @email = UserMailer.create_project_invitation('yahoo@yahoo.org', @project) + @email = UserMailer.project_invitation('yahoo@yahoo.org', @project) end it 'should deliver to email send in params' do @@ -20,14 +22,14 @@ end it 'should have link to create account with email in params' do - @email.should have_text(/#{new_user_url(:host => 'localhost:3000', :email => 'yahoo@yahoo.org').gsub('?', '\?')}/) + @email.body.should =~ /#{new_user_url(:host => host, :email => 'yahoo@yahoo.org').gsub('?', '\?')}/ end end describe '#project_removal' do before do @project = Factory(:project) - @email = UserMailer.create_project_removal('removed@toto.com', 'remover@toto.com', @project) + @email = UserMailer.project_removal('removed@toto.com', 'remover@toto.com', @project) end it 'should deliver to removed guy' do @email.should deliver_to('removed@toto.com') @@ -36,7 +38,7 @@ @email.should have_subject(/[#{@project.name}]/) end it 'should contain the address of the remover' do - @email.should have_text(/remover@toto.com/) + @email.body.should =~ /remover@toto.com/ end end @@ -44,7 +46,7 @@ before do @project = make_project_with_admin(make_user) @error = Factory(:error, :project => @project) - @email = UserMailer.create_error_notify('yahoo@yahoo.org', @error) + @email = UserMailer.error_notify('yahoo@yahoo.org', @error) end it 'should deliver email send in params' do @@ -54,7 +56,7 @@ @email.should have_subject(/\[#{@project.name}\] #{@error.message}/) end it 'should have link to error in body' do - @email.should have_text(/#{project_error_url(@project, @error, :host => 'localhost:3000').gsub('?', '\?')}/) + @email.body.should =~ /#{project_error_url(@project, @error, :host => host).gsub('?', '\?')}/ end end @@ -62,7 +64,7 @@ before do @project = make_project_with_admin(make_user) @errors = 2.of{ Factory(:error, :project => @project) } - @email = UserMailer.create_error_digest_notify('yahoo@yahoo.org', @errors) + @email = UserMailer.error_digest_notify('yahoo@yahoo.org', @errors) end it 'should deliver email send in params' do @@ -72,7 +74,7 @@ @email.should have_subject(/\[DIGEST\] \[#{@project.name}\] error report/) end it 'should have link to error in body' do - @email.should have_text(/#{project_error_url(@project, @errors.first, :host => 'localhost:3000').gsub('?', '\?')}/) + @email.body.should =~ /#{project_error_url(@project, @errors.first, :host => host).gsub('?', '\?')}/ end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1a71235..a733787 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -17,7 +17,7 @@ project = make_project_with_admin(user) assert_equal [project], user.reload.member_projects project_2 = make_project_with_admin(user) - assert_equal [project, project_2].sort_by(&:id), user.reload.member_projects.sort_by(&:id) + [project, project_2] =~ user.reload.member_projects end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4a8530f..761047c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,81 +1,31 @@ -# This file is copied to ~/spec when you run 'ruby script/generate rspec' -# from the project root directory. +# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' -require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment')) -require 'spec/autorun' -require 'spec/rails' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' -# Uncomment the next line to use webrat's matchers -#require 'webrat/integrations/rspec-rails' +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} -# Requires supporting files with custom matchers and macros, etc, -# in ./support/ and its subdirectories. -Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f} - - - -Spec::Runner.configure do |config| - # If you're not using ActiveRecord you should remove these - # lines, delete config/database.yml and disable :active_record - # in your config/boot.rb +require "devise/test_helpers" +require 'capybara/rspec' +require 'capybara/rails' +require 'blueprints' - # == Fixtures - # - # You can declare fixtures for each example_group like this: - # describe "...." do - # fixtures :table_a, :table_b - # - # Alternatively, if you prefer to declare them only once, you can - # do so right here. Just uncomment the next line and replace the fixture - # names with your fixtures. - # - # config.global_fixtures = :table_a, :table_b - # - # If you declare global fixtures, be aware that they will be declared - # for all of your examples, even those that don't use them. - # - # You can also declare which fixtures to use (for example fixtures for test/fixtures): - # - # config.fixture_path = RAILS_ROOT + '/spec/fixtures/' - # - # == Mock Framework - # - # RSpec uses it's own mocking framework by default. If you prefer to - # use mocha, flexmock or RR, uncomment the appropriate line: - # +RSpec.configure do |config| config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - # - # == Notes - # - # For more information take a look at Spec::Runner::Configuration and Spec::Runner - config.before(:each) do MongoMapper.database.collections.each do |coll| coll.remove end end - -end - -require 'blueprints' - -require "devise/test_helpers" -class ActionController::TestCase - include Devise::TestHelpers -end - -class Mongo::ObjectID - def <=>(object) - self.to_s <=> object.to_s - end + config.include Devise::TestHelpers, :type => :controller end def response_is_401 - response.status.should == "401 Unauthorized" + response.status.should == 401 end def response_is_404 - response.code.should == "404" -end + response.status.should == 404 +end \ No newline at end of file diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 0000000..e69de29