clearance 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of clearance might be problematic. Click here for more details.

Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.travis.yml +6 -8
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +20 -19
  6. data/NEWS.md +3 -0
  7. data/Rakefile +13 -14
  8. data/app/mailers/clearance_mailer.rb +9 -4
  9. data/app/views/clearance_mailer/change_password.html.erb +3 -3
  10. data/app/views/layouts/application.html.erb +1 -1
  11. data/app/views/passwords/edit.html.erb +2 -2
  12. data/app/views/passwords/new.html.erb +2 -2
  13. data/app/views/sessions/_form.html.erb +2 -2
  14. data/app/views/sessions/new.html.erb +1 -1
  15. data/app/views/users/_form.html.erb +1 -1
  16. data/app/views/users/new.html.erb +1 -1
  17. data/bin/setup +1 -2
  18. data/config/locales/clearance.en.yml +4 -4
  19. data/features/step_definitions/configuration_steps.rb +2 -2
  20. data/features/support/env.rb +15 -23
  21. data/gemfiles/rails3.2.gemfile +20 -0
  22. data/gemfiles/rails4.0.gemfile +20 -0
  23. data/gemfiles/rails4.1.gemfile +20 -0
  24. data/gemfiles/rails4.2.gemfile +20 -0
  25. data/lib/clearance/configuration.rb +1 -1
  26. data/lib/clearance/session.rb +5 -1
  27. data/lib/clearance/testing/deny_access_matcher.rb +1 -3
  28. data/lib/clearance/version.rb +1 -1
  29. data/lib/generators/clearance/install/install_generator.rb +5 -15
  30. data/spec/clearance/session_spec.rb +1 -1
  31. data/{lib/clearance/testing → spec/dummy}/app/controllers/application_controller.rb +0 -0
  32. data/spec/dummy/application.rb +47 -0
  33. data/{lib/clearance/testing → spec/dummy}/config/database.yml +0 -0
  34. data/{lib/clearance/testing → spec/dummy}/config/routes.rb +0 -0
  35. data/spec/generators/clearance/install/install_generator_spec.rb +118 -0
  36. data/spec/generators/clearance/routes/routes_generator_spec.rb +17 -0
  37. data/spec/generators/clearance/specs/specs_generator_spec.rb +26 -0
  38. data/spec/generators/clearance/views/views_generator_spec.rb +35 -0
  39. data/spec/mailers/clearance_mailer_spec.rb +48 -19
  40. data/spec/models/bcrypt_migration_from_sha1_spec.rb +81 -51
  41. data/spec/models/password_strategies_spec.rb +2 -0
  42. data/spec/spec_helper.rb +12 -18
  43. data/spec/support/app_templates/app/controllers/application_controller.rb +2 -0
  44. data/spec/support/app_templates/app/models/user.rb +5 -0
  45. data/spec/support/app_templates/config/routes.rb +3 -0
  46. data/spec/support/cookies.rb +1 -1
  47. data/spec/support/generator_spec_helpers.rb +40 -0
  48. metadata +31 -13
  49. data/.rspec +0 -2
  50. data/features/add_migrations_to_project.feature +0 -36
  51. data/features/copy_routes_to_host_application.feature +0 -9
  52. data/lib/clearance/testing/application.rb +0 -49
  53. data/lib/clearance/testing/assertion_error.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbf88ab9f935fc17b80bd9901390e94c0f7ab684
4
- data.tar.gz: a522250322d628529f2056ec9de17ef2eaceb608
3
+ metadata.gz: 7d1008b7898db9ab0ed2eb372b1c9ec92c54c98a
4
+ data.tar.gz: 86b11a51fa7ba23911a500547d8ad065c7d9590a
5
5
  SHA512:
6
- metadata.gz: 71ff65519b2a7ed783aa0341f7a3f8adb657029810748fafd8ddecfc4e14a5517b8bbab31773bd23f13f64d1439bc94bc401f756fc8774d0d98c6d952e376cbe
7
- data.tar.gz: 3c25517857b86f5bfe43241d1c6e03abf814849418bc5d25da6ff47e36c3640d911dfcbed9a96be736eb15fe47d5523a56ac58322978d92696d806ca586a6d32
6
+ metadata.gz: c62112e27660a5258ad4a2078c5fe993bbf3171e048437ef56572706443b7f24c5ac14ca39cfa80855fd80ea204b8a973630d2fda1ef4b923160223f60f4ef51
7
+ data.tar.gz: c5a9870f0523c669d49e350cc980a6e29b0a9b9b9a3e2cd08f4439f7607478743068f875b55d348e32ebd8dca478ebce3003b4d4cc502c16d5705cb39147c5cf
data/.gitignore CHANGED
@@ -5,7 +5,7 @@
5
5
  *~
6
6
  .bundle
7
7
  db/*.sqlite3
8
- gemfiles/
8
+ gemfiles/*.lock
9
9
  log/*.log
10
10
  pkg
11
11
  tmp/
data/.travis.yml CHANGED
@@ -1,18 +1,15 @@
1
+ cache: bundler
2
+
1
3
  language:
2
4
  - ruby
3
5
 
4
6
  rvm:
5
7
  - 1.9.3
6
8
  - 2.0.0
7
- - 2.1.3
9
+ - 2.1.5
8
10
 
9
11
  install:
10
- - "travis_retry bundle install"
11
- - "bundle exec appraisal generate"
12
- - "travis_retry bundle exec appraisal install"
13
-
14
- before_script:
15
- - "bundle exec rake db:migrate"
12
+ - "travis_retry bin/setup"
16
13
 
17
14
  script:
18
15
  - "bundle exec appraisal rake"
@@ -20,4 +17,5 @@ script:
20
17
  branches:
21
18
  only:
22
19
  - master
23
- - 2.0
20
+
21
+ sudo: false
data/Gemfile CHANGED
@@ -3,15 +3,15 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'appraisal', '~> 1.0'
6
+ gem 'ammeter'
6
7
  gem 'aruba', '~> 0.5'
7
8
  gem 'bundler', '~> 1.3'
8
9
  gem 'capybara', '~> 2.2.0'
9
10
  gem 'cucumber-rails', '~> 1.3', require: false
10
11
  gem 'database_cleaner', '~> 1.0'
11
12
  gem 'factory_girl_rails', '~> 4.2'
12
- gem 'rspec-rails'
13
+ gem 'rspec-rails', '~> 3.1'
13
14
  gem 'shoulda-matchers', '~> 2.4'
14
15
  gem 'sqlite3', '~> 1.3'
15
16
  gem 'timecop', '~> 0.6'
16
- gem 'rspec', '~> 2.14'
17
17
  gem 'pry', require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clearance (1.6.0)
4
+ clearance (1.6.1)
5
5
  bcrypt
6
6
  email_validator (~> 1.4)
7
7
  rails (>= 3.1)
@@ -44,6 +44,10 @@ GEM
44
44
  minitest (~> 5.1)
45
45
  thread_safe (~> 0.3, >= 0.3.4)
46
46
  tzinfo (~> 1.1)
47
+ ammeter (1.1.2)
48
+ activesupport (>= 3.0)
49
+ railties (>= 3.0)
50
+ rspec-rails (>= 2.2)
47
51
  appraisal (1.0.2)
48
52
  bundler
49
53
  rake
@@ -138,25 +142,22 @@ GEM
138
142
  rake (>= 0.8.7)
139
143
  thor (>= 0.18.1, < 2.0)
140
144
  rake (10.4.2)
141
- rspec (2.99.0)
142
- rspec-core (~> 2.99.0)
143
- rspec-expectations (~> 2.99.0)
144
- rspec-mocks (~> 2.99.0)
145
- rspec-collection_matchers (1.1.2)
146
- rspec-expectations (>= 2.99.0.beta1)
147
- rspec-core (2.99.2)
148
- rspec-expectations (2.99.2)
149
- diff-lcs (>= 1.1.3, < 2.0)
150
- rspec-mocks (2.99.2)
151
- rspec-rails (2.99.0)
145
+ rspec-core (3.1.7)
146
+ rspec-support (~> 3.1.0)
147
+ rspec-expectations (3.1.2)
148
+ diff-lcs (>= 1.2.0, < 2.0)
149
+ rspec-support (~> 3.1.0)
150
+ rspec-mocks (3.1.3)
151
+ rspec-support (~> 3.1.0)
152
+ rspec-rails (3.1.0)
152
153
  actionpack (>= 3.0)
153
- activemodel (>= 3.0)
154
154
  activesupport (>= 3.0)
155
155
  railties (>= 3.0)
156
- rspec-collection_matchers
157
- rspec-core (~> 2.99.0)
158
- rspec-expectations (~> 2.99.0)
159
- rspec-mocks (~> 2.99.0)
156
+ rspec-core (~> 3.1.0)
157
+ rspec-expectations (~> 3.1.0)
158
+ rspec-mocks (~> 3.1.0)
159
+ rspec-support (~> 3.1.0)
160
+ rspec-support (3.1.2)
160
161
  shoulda-matchers (2.7.0)
161
162
  activesupport (>= 3.0.0)
162
163
  slop (3.6.0)
@@ -183,6 +184,7 @@ PLATFORMS
183
184
  ruby
184
185
 
185
186
  DEPENDENCIES
187
+ ammeter
186
188
  appraisal (~> 1.0)
187
189
  aruba (~> 0.5)
188
190
  bundler (~> 1.3)
@@ -192,8 +194,7 @@ DEPENDENCIES
192
194
  database_cleaner (~> 1.0)
193
195
  factory_girl_rails (~> 4.2)
194
196
  pry
195
- rspec (~> 2.14)
196
- rspec-rails
197
+ rspec-rails (~> 3.1)
197
198
  shoulda-matchers (~> 2.4)
198
199
  sqlite3 (~> 1.3)
199
200
  timecop (~> 0.6)
data/NEWS.md CHANGED
@@ -1,5 +1,8 @@
1
1
  Thank you to all the [contributors](https://github.com/thoughtbot/clearance/graphs/contributors)!
2
2
 
3
+ New for 1.6.1 (January 6, 2015)
4
+ * Secure cookies are no longer overwritten when the user visits a non-HTTPS URL.
5
+
3
6
  New for 1.6.0 (December 20, 2014)
4
7
  * When using Rails 4.2, password reset emails are sent with the
5
8
  ActiveJob-compatible `#deliver_later` method.
data/Rakefile CHANGED
@@ -1,24 +1,23 @@
1
1
  # encoding: utf-8
2
- require 'rubygems'
3
- require 'bundler/setup'
4
- require 'bundler/gem_tasks'
2
+ require "rubygems"
3
+ require "bundler/setup"
4
+ require "bundler/gem_tasks"
5
5
 
6
- require 'rake'
7
- require 'cucumber/rake/task'
8
- require 'rspec/core/rake_task'
9
- require 'clearance/testing/application'
6
+ require "rake"
7
+ require "cucumber/rake/task"
8
+ require "rspec/core/rake_task"
10
9
 
11
- desc 'Default'
12
- task :default => [:all]
13
-
14
- desc 'Run the specs and cucumber featrues'
15
- task :all => [:spec, :cucumber]
10
+ namespace :dummy do
11
+ require_relative "spec/dummy/application"
12
+ Dummy::Application.load_tasks
13
+ end
16
14
 
17
- Clearance::Testing::Application.load_tasks
15
+ desc "Default"
16
+ task default: [:spec, :cucumber]
18
17
 
19
18
  Cucumber::Rake::Task.new(:cucumber) do |t|
20
19
  t.fork = false
21
- t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
20
+ t.cucumber_opts = ["--format", (ENV["CUCUMBER_FORMAT"] || "progress")]
22
21
  end
23
22
 
24
23
  RSpec::Core::RakeTask.new(:spec)
@@ -1,9 +1,14 @@
1
1
  class ClearanceMailer < ActionMailer::Base
2
2
  def change_password(user)
3
3
  @user = user
4
- mail from: Clearance.configuration.mailer_sender, to: @user.email,
5
- subject: I18n.t(:change_password,
6
- scope: [:clearance, :models, :clearance_mailer],
7
- default: 'Change your password')
4
+ mail(
5
+ from: Clearance.configuration.mailer_sender,
6
+ to: @user.email,
7
+ subject: I18n.t(
8
+ :change_password,
9
+ scope: [:clearance, :models, :clearance_mailer],
10
+ default: "Change your password"
11
+ )
12
+ )
8
13
  end
9
14
  end
@@ -1,5 +1,5 @@
1
- <%= t('.opening') %>
1
+ <%= t(".opening") %>
2
2
 
3
- <%= edit_user_password_url(@user, :token => @user.confirmation_token.html_safe) %>
3
+ <%= edit_user_password_url(@user, token: @user.confirmation_token.html_safe) %>
4
4
 
5
- <%= t('.closing') %>
5
+ <%= raw t(".closing") %>
@@ -7,7 +7,7 @@
7
7
  <body>
8
8
  <div id="header">
9
9
  <% if signed_in? -%>
10
- <%= button_to t('.sign_out'), sign_out_path, :method => :delete %>
10
+ <%= button_to t('.sign_out'), sign_out_path, method: :delete %>
11
11
  <% else -%>
12
12
  <%= link_to t('.sign_in'), sign_in_path %>
13
13
  <% end -%>
@@ -4,8 +4,8 @@
4
4
  <p><%= t '.description' %></p>
5
5
 
6
6
  <%= form_for :password_reset,
7
- :url => user_password_path(@user, :token => @user.confirmation_token),
8
- :html => { :method => :put } do |form| %>
7
+ url: user_password_path(@user, token: @user.confirmation_token),
8
+ html: { method: :put } do |form| %>
9
9
  <div class="password-field">
10
10
  <%= form.label :password %>
11
11
  <%= form.password_field :password %>
@@ -3,10 +3,10 @@
3
3
 
4
4
  <p><%= t '.description' %></p>
5
5
 
6
- <%= form_for :password, :url => passwords_path do |form| %>
6
+ <%= form_for :password, url: passwords_path do |form| %>
7
7
  <div class="text-field">
8
8
  <%= form.label :email %>
9
- <%= form.text_field :email, :type => 'email' %>
9
+ <%= form.text_field :email, type: 'email' %>
10
10
  </div>
11
11
 
12
12
  <div class="submit-field">
@@ -1,7 +1,7 @@
1
- <%= form_for :session, :url => session_path do |form| %>
1
+ <%= form_for :session, url: session_path do |form| %>
2
2
  <div class="text-field">
3
3
  <%= form.label :email %>
4
- <%= form.text_field :email, :type => 'email' %>
4
+ <%= form.text_field :email, type: 'email' %>
5
5
  </div>
6
6
 
7
7
  <div class="password-field">
@@ -1,6 +1,6 @@
1
1
  <div id="clearance" class="sign-in">
2
2
  <h2><%= t '.title' %></h2>
3
3
 
4
- <%= render :partial => '/sessions/form' %>
4
+ <%= render partial: '/sessions/form' %>
5
5
 
6
6
  </div>
@@ -1,6 +1,6 @@
1
1
  <div class="text-field">
2
2
  <%= form.label :email %>
3
- <%= form.text_field :email, :type => 'email' %>
3
+ <%= form.text_field :email, type: 'email' %>
4
4
  </div>
5
5
 
6
6
  <div class="password-field">
@@ -2,7 +2,7 @@
2
2
  <h2><%= t('.title') %></h2>
3
3
 
4
4
  <%= form_for @user do |form| %>
5
- <%= render :partial => '/users/form', :object => form %>
5
+ <%= render partial: '/users/form', object: form %>
6
6
 
7
7
  <div class="submit-field">
8
8
  <%= form.submit %>
data/bin/setup CHANGED
@@ -5,8 +5,7 @@ set -e
5
5
  # Install required gems, including Appraisal, which helps us test against
6
6
  # multiple Rails versions
7
7
  bundle install
8
- bundle exec appraisal clean
9
8
  bundle exec appraisal install
10
9
 
11
10
  # Set up database for the application that Clearance tests against
12
- RAILS_ENV=test bundle exec rake db:reset
11
+ RAILS_ENV=test bundle exec rake dummy:db:reset
@@ -2,10 +2,10 @@
2
2
  en:
3
3
  clearance_mailer:
4
4
  change_password:
5
- closing: If you didn't request this, ignore this email. Your password
6
- has not been changed.
7
- opening: 'Someone, hopefully you, requested we send you a link to change
8
- your password:'
5
+ closing: If you didn't request this, ignore this email. Your password has
6
+ not been changed.
7
+ opening: "Someone, hopefully you, requested we send you a link to change
8
+ your password:"
9
9
  flashes:
10
10
  failure_after_create: Bad email or password.
11
11
  failure_after_update: Password can't be blank.
@@ -17,7 +17,7 @@ When "I have a project with clearance" do
17
17
 
18
18
  step 'I cd to "testapp"'
19
19
 
20
- unless Clearance::Testing.rails4?
20
+ unless Dummy.rails4?
21
21
  step 'I remove the file "public/index.html"'
22
22
  end
23
23
 
@@ -145,7 +145,7 @@ When /^I create a migration with clearance fields$/ do
145
145
  end
146
146
 
147
147
  def controller_test_dir
148
- if Clearance::Testing.rails4?
148
+ if Dummy.rails4?
149
149
  'controllers'
150
150
  else
151
151
  'functional'
@@ -1,32 +1,24 @@
1
- ENV['RAILS_ENV'] ||= 'test'
1
+ ENV["RAILS_ENV"] ||= "test"
2
2
 
3
- PROJECT_ROOT = File.expand_path('../../..', __FILE__)
4
- $LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
3
+ require "bundler"
4
+ require "rails/all"
5
5
 
6
- require 'rails/all'
7
- require 'rails/test_help'
8
-
9
- Bundler.require
10
-
11
- require 'aruba/cucumber'
12
- require 'clearance/testing/application'
13
- require 'cucumber/rails/action_controller'
14
- require 'cucumber/rails/application'
15
- require 'cucumber/rails/capybara'
16
- require 'cucumber/rails/database'
17
- require 'cucumber/rails/hooks'
18
- require 'cucumber/rails/world'
6
+ require "clearance"
7
+ require "aruba/cucumber"
8
+ require_relative "../../spec/dummy/application"
9
+ require "cucumber/rails/action_controller"
10
+ require "cucumber/rails/application"
11
+ require "cucumber/rails/capybara"
12
+ require "cucumber/rails/database"
13
+ require "cucumber/rails/hooks"
14
+ require "cucumber/rails/world"
19
15
 
20
16
  ActionController::Base.allow_rescue = false
21
17
  Capybara.default_selector = :css
22
- Capybara.save_and_open_page_path = 'tmp'
23
- Clearance::Testing::Application.initialize!
18
+ Capybara.save_and_open_page_path = "tmp"
19
+ Dummy::Application.initialize!
24
20
 
25
- begin
26
- DatabaseCleaner.strategy = :transaction
27
- rescue NameError
28
- raise 'You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it.'
29
- end
21
+ DatabaseCleaner.strategy = :transaction
30
22
 
31
23
  Around do |scenario, block|
32
24
  Bundler.with_clean_env do
@@ -0,0 +1,20 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 1.0"
6
+ gem "ammeter"
7
+ gem "aruba", "~> 0.5"
8
+ gem "bundler", "~> 1.3"
9
+ gem "capybara", "~> 2.2.0"
10
+ gem "cucumber-rails", "~> 1.3", :require => false
11
+ gem "database_cleaner", "~> 1.0"
12
+ gem "factory_girl_rails", "~> 4.2"
13
+ gem "rspec-rails", "~> 3.1"
14
+ gem "shoulda-matchers", "~> 2.4"
15
+ gem "sqlite3", "~> 1.3"
16
+ gem "timecop", "~> 0.6"
17
+ gem "pry", :require => false
18
+ gem "rails", "~> 3.2.21"
19
+
20
+ gemspec :path => "../"
@@ -0,0 +1,20 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 1.0"
6
+ gem "ammeter"
7
+ gem "aruba", "~> 0.5"
8
+ gem "bundler", "~> 1.3"
9
+ gem "capybara", "~> 2.2.0"
10
+ gem "cucumber-rails", "~> 1.3", :require => false
11
+ gem "database_cleaner", "~> 1.0"
12
+ gem "factory_girl_rails", "~> 4.2"
13
+ gem "rspec-rails", "~> 3.1"
14
+ gem "shoulda-matchers", "~> 2.4"
15
+ gem "sqlite3", "~> 1.3"
16
+ gem "timecop", "~> 0.6"
17
+ gem "pry", :require => false
18
+ gem "rails", "~> 4.0.12"
19
+
20
+ gemspec :path => "../"
@@ -0,0 +1,20 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 1.0"
6
+ gem "ammeter"
7
+ gem "aruba", "~> 0.5"
8
+ gem "bundler", "~> 1.3"
9
+ gem "capybara", "~> 2.2.0"
10
+ gem "cucumber-rails", "~> 1.3", :require => false
11
+ gem "database_cleaner", "~> 1.0"
12
+ gem "factory_girl_rails", "~> 4.2"
13
+ gem "rspec-rails", "~> 3.1"
14
+ gem "shoulda-matchers", "~> 2.4"
15
+ gem "sqlite3", "~> 1.3"
16
+ gem "timecop", "~> 0.6"
17
+ gem "pry", :require => false
18
+ gem "rails", "~> 4.1.8"
19
+
20
+ gemspec :path => "../"