Skip to content

Commit

Permalink
[tests] update test suite for rails 5.1
Browse files Browse the repository at this point in the history
notable changes:
- added rails version to migrations
- updated test requests to new format
- updated several test runner dependencies
- various rubocop linting fixes within test suite
  • Loading branch information
lynndylanhurley committed Oct 14, 2017
1 parent a8213a8 commit 1b1d32a
Show file tree
Hide file tree
Showing 40 changed files with 1,190 additions and 1,168 deletions.
37 changes: 19 additions & 18 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"
source 'https://rubygems.org'

# Declare your gem's dependencies in devise_token_auth.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
Expand All @@ -14,34 +14,35 @@ gemspec
# gem 'debugger'

group :development, :test do
gem 'thor'
gem "figaro", :git => 'https://github.com/laserlemon/figaro'
gem 'omniauth-github', :git => 'https://github.com/intridea/omniauth-github'
gem 'omniauth-facebook', :git => 'https://github.com/mkdynamic/omniauth-facebook'
gem 'omniauth-google-oauth2', :git => 'https://github.com/zquestz/omniauth-google-oauth2'
gem 'rack-cors', :require => 'rack/cors'
gem 'attr_encrypted'
gem 'figaro', git: 'https://github.com/laserlemon/figaro'
gem 'omniauth-facebook', git: 'https://github.com/mkdynamic/omniauth-facebook'
gem 'omniauth-github', git: 'https://github.com/intridea/omniauth-github'
gem 'omniauth-google-oauth2', git: 'https://github.com/zquestz/omniauth-google-oauth2'
gem 'rack-cors', require: 'rack/cors'
gem 'thor'

# testing
#gem 'spring'
gem "pry"
gem "pry-remote"
# gem 'spring'
gem 'faker'
gem 'fuzz_ball'
gem 'guard'
gem 'guard-minitest'
gem 'minitest'
gem 'minitest-rails'
gem 'minitest-focus'
gem 'minitest-rails'
gem 'minitest-reporters'
gem 'guard'
gem 'guard-minitest'
gem 'faker'
gem 'fuzz_ball'
gem 'mocha'
gem 'pry'
gem 'pry-remote'
end

# code coverage, metrics
group :test do
gem "codeclimate-test-reporter", require: nil
gem 'codeclimate-test-reporter', require: nil
gem 'rails-controller-testing'
end

group :development do
gem "github_changelog_generator"
end
gem 'github_changelog_generator'
end
149 changes: 81 additions & 68 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,44 +40,47 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.8)
actionpack (= 4.2.8)
actionview (= 4.2.8)
activejob (= 4.2.8)
actioncable (5.1.4)
actionpack (= 5.1.4)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.8)
actionview (= 4.2.8)
activesupport (= 4.2.8)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-dom-testing (~> 2.0)
actionpack (5.1.4)
actionview (= 5.1.4)
activesupport (= 5.1.4)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.8)
activesupport (= 4.2.8)
actionview (5.1.4)
activesupport (= 5.1.4)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (4.2.8)
activesupport (= 4.2.8)
globalid (>= 0.3.0)
activemodel (4.2.8)
activesupport (= 4.2.8)
builder (~> 3.1)
activerecord (4.2.8)
activemodel (= 4.2.8)
activesupport (= 4.2.8)
arel (~> 6.0)
activesupport (4.2.8)
activejob (5.1.4)
activesupport (= 5.1.4)
globalid (>= 0.3.6)
activemodel (5.1.4)
activesupport (= 5.1.4)
activerecord (5.1.4)
activemodel (= 5.1.4)
activesupport (= 5.1.4)
arel (~> 8.0)
activesupport (5.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
ansi (1.5.0)
arel (6.0.4)
arel (8.0.0)
attr_encrypted (3.0.3)
encryptor (~> 3.0.0)
bcrypt (3.1.11)
Expand All @@ -86,6 +89,7 @@ GEM
simplecov (<= 0.13)
coderay (1.1.1)
concurrent-ruby (1.0.5)
crass (1.0.2)
devise (4.3.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand All @@ -94,7 +98,7 @@ GEM
warden (~> 1.2.3)
docile (1.1.5)
encryptor (3.0.0)
erubis (2.7.0)
erubi (1.7.0)
faker (1.7.3)
i18n (~> 0.5)
faraday (0.11.0)
Expand Down Expand Up @@ -128,31 +132,32 @@ GEM
guard-compat (~> 1.2)
minitest (>= 3.0)
hashie (3.5.5)
i18n (0.8.1)
i18n (0.8.6)
json (2.1.0)
jwt (1.5.6)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.0.3)
loofah (2.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.12)
mail (2.6.5)
mail (2.6.6)
mime-types (>= 1.16, < 4)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.2)
mini_portile2 (2.3.0)
minitest (5.10.3)
minitest-focus (1.1.2)
minitest (>= 4, < 6)
minitest-rails (2.2.1)
minitest (~> 5.7)
railties (~> 4.1)
minitest-reporters (1.1.14)
minitest-rails (3.0.0)
minitest (~> 5.8)
railties (~> 5.0)
minitest-reporters (1.1.18)
ansi
builder
minitest (>= 5.0)
Expand All @@ -164,8 +169,9 @@ GEM
multipart-post (2.0.0)
mysql2 (0.4.6)
nenv (0.3.0)
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
nio4r (2.1.0)
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
Expand Down Expand Up @@ -193,45 +199,48 @@ GEM
pry (~> 0.9)
slop (~> 3.0)
public_suffix (2.0.5)
rack (1.6.8)
rack (2.0.3)
rack-cors (0.4.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.8)
actionmailer (= 4.2.8)
actionpack (= 4.2.8)
actionview (= 4.2.8)
activejob (= 4.2.8)
activemodel (= 4.2.8)
activerecord (= 4.2.8)
activesupport (= 4.2.8)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.8)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.8)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rack-test (0.7.0)
rack (>= 1.0, < 3)
rails (5.1.4)
actioncable (= 5.1.4)
actionmailer (= 5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
activemodel (= 5.1.4)
activerecord (= 5.1.4)
activesupport (= 5.1.4)
bundler (>= 1.3.0)
railties (= 5.1.4)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
actionview (~> 5.x, >= 5.0.1)
activesupport (~> 5.x)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.8)
actionpack (= 4.2.8)
activesupport (= 4.2.8)
railties (5.1.4)
actionpack (= 5.1.4)
activesupport (= 5.1.4)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.2)
rake
rake (12.0.0)
rake (12.1.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
retriable (2.1.0)
ruby-progressbar (1.8.1)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
Expand All @@ -246,17 +255,20 @@ GEM
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
thor (0.19.4)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
warden (1.2.7)
rack (>= 1.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)

PLATFORMS
ruby
Expand Down Expand Up @@ -284,8 +296,9 @@ DEPENDENCIES
pry
pry-remote
rack-cors
rails-controller-testing
sqlite3 (~> 1.3)
thor

BUNDLED WITH
1.14.6
1.15.4
1 change: 1 addition & 0 deletions app/controllers/devise_token_auth/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def edit
@resource.allow_password_change = true;

@resource.save!

yield @resource if block_given?

redirect_to(@resource.build_auth_url(params[:redirect_url], {
Expand Down
15 changes: 5 additions & 10 deletions test/controllers/custom/custom_confirmations_controller_test.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
require 'test_helper'

class Custom::ConfirmationsControllerTest < ActionController::TestCase

describe Custom::ConfirmationsController do

before do
@redirect_url = Faker::Internet.url
@new_user = users(:unconfirmed_email_user)
@new_user.send_confirmation_instructions({
redirect_url: @redirect_url
})
@new_user.send_confirmation_instructions(redirect_url: @redirect_url)
@mail = ActionMailer::Base.deliveries.last
@token = @mail.body.match(/confirmation_token=([^&]*)&/)[1]
@client_config = @mail.body.match(/config=([^&]*)&/)[1]

get :show, {confirmation_token: @token, redirect_url: @redirect_url}
get :show,
params: { confirmation_token: @token, redirect_url: @redirect_url }
end

test "yield resource to block on show success" do
assert @controller.show_block_called?, "show failed to yield resource to provided block"
test 'yield resource to block on show success' do
assert @controller.show_block_called?, 'show failed to yield resource to provided block'
end

end

end
Loading

0 comments on commit 1b1d32a

Please sign in to comment.