minitest-utils 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4133da410c70092ff9e63a0d169364a74776ea40
4
- data.tar.gz: 3217e7fb9c40e60b281f16045652caeeeaf6cfc9
3
+ metadata.gz: 468b60a2bf50be679f0fc0e314de6f397a5ce092
4
+ data.tar.gz: a409611a3281fa5716e37f2eb2f1c4a52d6b2424
5
5
  SHA512:
6
- metadata.gz: a949dc3addeeac7e97b6c13b16d7323230bb5e9660e388ffeaa9cba2916f4ee5b322f731cf00631ea1b33c6f1a4911a62de53f311163724dd5fd5754ba80d461
7
- data.tar.gz: e9d78f5d7c79e7d815cb42cb8692a0622f8db836326d92162017b95fc325b154e5f111c2b6ac267f52716da815a4507909aa50d053bb1224b4af6d554de9a720
6
+ metadata.gz: 27d0fd6c547c43a2573c31c3a7104af730e5528e7723d54ea9c657d910e750a0472412972c5db3d878cfe11eae8378ee170c828687fc24f610db72bbedfa77c0
7
+ data.tar.gz: 56c7310b1d63bdd965ceaa876d46c2e43a0a462926fb3b810161841e883fdcde99abd723f8b0995952b8bdba0a7b8cc53fbe3086089f65a86c8d69115f3c819e
data/README.md CHANGED
@@ -64,6 +64,28 @@ end
64
64
  ![](https://raw.githubusercontent.com/fnando/minitest-utils/master/screenshots/dark-failing.png)
65
65
  ![](https://raw.githubusercontent.com/fnando/minitest-utils/master/screenshots/dark-success.png)
66
66
 
67
+ ## Rails extensions
68
+
69
+ minitest-utils sets up some things for your Rails application. Just load `minitest/utils/rails` to set up:
70
+
71
+ - [Capybara](https://github.com/jnicklas/capybara): includes `Capybara::DSL`, sets default driver before every test, resets session and creates a helper method for setting JavaScript driver.
72
+ - [FactoryGirl](https://github.com/thoughtbot/factory_girl): adds methods to `ActiveSupport::TestCase`.
73
+ - [WebMock](https://github.com/bblimke/webmock): disables external requests (except for codeclimate) and tracks all requests on `WebMock.requests`.
74
+ - locale routes: sets `Rails.application.routes.default_url_options[:locale]` with your current locale.
75
+ - [DatabaseCleaner](https://github.com/DatabaseCleaner/database_cleaner): runs `DatabaseCleaner.start` and `DatabaseCleaner.clean` before and after every test respectively.
76
+ - Other: `t` and `l` alias to I18n.
77
+
78
+ ```ruby
79
+ class SignupTest < ActionDispatch::IntegrationTtest
80
+ use_javascript! #=> enables JavaScript driver
81
+ end
82
+ ```
83
+
84
+ Also, if you're using routes like `:locale` scope, you can load this file to automatically set your route's `:locale` param.
85
+
86
+ ```ruby
87
+ require 'minitest/utils/rails/locale'
88
+ ```
67
89
 
68
90
  ## Development
69
91
 
@@ -73,7 +95,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
73
95
 
74
96
  ## Contributing
75
97
 
76
- 1. Fork it ( https://github.com/[my-github-username]/minitest-utils/fork )
98
+ 1. Fork it ( https://github.com/fnando/minitest-utils/fork )
77
99
  2. Create your feature branch (`git checkout -b my-new-feature`)
78
100
  3. Commit your changes (`git commit -am 'Add some feature'`)
79
101
  4. Push to the branch (`git push origin my-new-feature`)
@@ -4,6 +4,7 @@ class ActiveSupport::TestCase
4
4
  require 'minitest/utils/rails/webmock' if defined?(WebMock)
5
5
  require 'minitest/utils/rails/capybara' if defined?(Capybara)
6
6
  require 'minitest/utils/rails/factory_girl' if defined?(FactoryGirl)
7
+ require 'minitest/utils/rails/database_cleaner' if defined?(DatabaseCleaner)
7
8
 
8
9
  def t(*args)
9
10
  I18n.t(*args)
@@ -0,0 +1,9 @@
1
+ class ActiveSupport::TestCase
2
+ setup do
3
+ DatabaseCleaner.start
4
+ end
5
+
6
+ teardown do
7
+ DatabaseCleaner.clean
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ class ActionDispatch::IntegrationTest
2
+ setup do
3
+ Rails.application.routes.default_url_options[:locale] = I18n.locale
4
+ Rails.configuration.action_mailer.default_url_options = Rails.application.routes.default_url_options if defined?(ActionMailer)
5
+ end
6
+ end
@@ -20,13 +20,17 @@ module Minitest
20
20
  @color_enabled = io.respond_to?(:tty?) && io.tty?
21
21
  end
22
22
 
23
- def statistics
23
+ def record(result)
24
24
  super
25
+ print_result_code(result.result_code)
25
26
  end
26
27
 
27
- def record(result)
28
+ def start
28
29
  super
29
- print_result_code(result.result_code)
30
+ io.puts "Run options: #{options[:args]}"
31
+ io.puts
32
+ io.puts "# Running:"
33
+ io.puts
30
34
  end
31
35
 
32
36
  def report
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Utils
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-25 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -84,7 +84,9 @@ files:
84
84
  - lib/minitest/utils/extension.rb
85
85
  - lib/minitest/utils/rails.rb
86
86
  - lib/minitest/utils/rails/capybara.rb
87
+ - lib/minitest/utils/rails/database_cleaner.rb
87
88
  - lib/minitest/utils/rails/factory_girl.rb
89
+ - lib/minitest/utils/rails/locale.rb
88
90
  - lib/minitest/utils/rails/webmock.rb
89
91
  - lib/minitest/utils/reporter.rb
90
92
  - lib/minitest/utils/test_notifier_reporter.rb
@@ -114,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
116
  version: '0'
115
117
  requirements: []
116
118
  rubyforge_project:
117
- rubygems_version: 2.4.6
119
+ rubygems_version: 2.4.5.1
118
120
  signing_key:
119
121
  specification_version: 4
120
122
  summary: Some utilities for your Minitest day-to-day usage.