effective_test_bot 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/effective_test_bot/version.rb +1 -1
- data/lib/generators/effective_test_bot/install_generator.rb +29 -19
- data/lib/generators/templates/minitest/test_helper.rb +17 -0
- data/lib/generators/templates/rspec/rails_helper.rb +7 -0
- data/lib/tasks/effective_test_bot_tasks.rake +33 -0
- data/spec/features/crud/crud_spec.rb +50 -0
- metadata +27 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8868fdb109012f1d2a8b7929ff8dcfd0b86cd055
|
4
|
+
data.tar.gz: 7cfccb9e85c959fa4160a64edc7b5abaae12ade5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e616bd41891f130bc030dd053e1d653e366c2923cf7fc2f10de24bba056f8fe4eed3bdcaf7deb83ee005e311ea4bd793cc0699dc51307e217d469ec22ef0dd9
|
7
|
+
data.tar.gz: 3c490a8184bb9110ac8125d89125aa61f84848399509443bc108cf32b6752d5e76bf247a0be5c743f05d1427384194722f20975ce55cc086b428ac4b84459a55
|
@@ -7,34 +7,40 @@ module EffectiveTestBot
|
|
7
7
|
|
8
8
|
source_root File.expand_path("../../templates", __FILE__)
|
9
9
|
|
10
|
-
def
|
11
|
-
return if File.exists?('
|
12
|
-
puts '[effective_test_bot] installing
|
13
|
-
run 'bundle exec rails generate
|
10
|
+
def install_minitest
|
11
|
+
return if File.exists?('test/test_helper.rb')
|
12
|
+
puts '[effective_test_bot] installing minitest'
|
13
|
+
run 'bundle exec rails generate minitest:install'
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
# def install_rspec
|
17
|
+
# return if File.exists?('spec/spec_helper.rb')
|
18
|
+
# puts '[effective_test_bot] installing rspec'
|
19
|
+
# run 'bundle exec rails generate rspec:install'
|
20
|
+
# end
|
21
|
+
|
22
|
+
# def install_guard
|
23
|
+
# return if File.exists?('Guardfile')
|
24
|
+
# puts '[effective_test_bot] installing guard'
|
25
|
+
# run 'bundle exec guard init'
|
26
|
+
# puts ""
|
27
|
+
# end
|
22
28
|
|
23
29
|
def explain_overwrite
|
24
|
-
puts '[effective_test_bot] Successfully installed/detected:
|
30
|
+
puts '[effective_test_bot] Successfully installed/detected: minitest'
|
25
31
|
puts ""
|
26
32
|
puts 'Starting effective_test_bot specific installation tasks:'
|
27
33
|
puts ""
|
28
|
-
puts "You will be prompted to overwrite the default
|
34
|
+
puts "You will be prompted to overwrite the default minitest configuration"
|
29
35
|
puts "files with those packaged inside the effective_test_bot gem."
|
30
36
|
puts ""
|
31
|
-
puts "If you have very specific existing
|
37
|
+
puts "If you have very specific existing minitest configuration,"
|
32
38
|
puts "you may want to skip (press 'n') to the following overwrites"
|
33
39
|
puts "and refer to the GitHub documentation for this gem:"
|
34
40
|
puts "https://github.com/code-and-effect/effective_test_bot"
|
35
41
|
puts ""
|
36
42
|
puts "Otherwise, press 'Y' to all the following prompts to automatically configure"
|
37
|
-
puts "
|
43
|
+
puts "minitest-rails and capybara-webkit based effective_test_bot test coverage"
|
38
44
|
puts ""
|
39
45
|
end
|
40
46
|
|
@@ -42,15 +48,19 @@ module EffectiveTestBot
|
|
42
48
|
template "effective_test_bot.rb", "config/initializers/effective_test_bot.rb"
|
43
49
|
end
|
44
50
|
|
45
|
-
def
|
46
|
-
template '
|
47
|
-
template 'rspec/rails_helper.rb', 'spec/rails_helper.rb'
|
48
|
-
template 'rspec/spec_helper.rb', 'spec/spec_helper.rb'
|
51
|
+
def overwrite_minitest
|
52
|
+
template 'minitest/test_helper.rb', 'test/test_helper.rb'
|
49
53
|
end
|
50
54
|
|
55
|
+
# def overwrite_rspec
|
56
|
+
# template 'rspec/.rspec', '.rspec'
|
57
|
+
# template 'rspec/rails_helper.rb', 'spec/rails_helper.rb'
|
58
|
+
# template 'rspec/spec_helper.rb', 'spec/spec_helper.rb'
|
59
|
+
# end
|
60
|
+
|
51
61
|
def thank_you
|
52
62
|
puts "Thanks for using EffectiveTestBot"
|
53
|
-
puts "Run tests by typing '
|
63
|
+
puts "Run tests by typing 'rake test:bot'"
|
54
64
|
end
|
55
65
|
end
|
56
66
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path("../../config/environment", __FILE__)
|
3
|
+
require "rails/test_help"
|
4
|
+
require "minitest/rails"
|
5
|
+
|
6
|
+
# To add Capybara feature tests add `gem "minitest-rails-capybara"`
|
7
|
+
# to the test group in the Gemfile and uncomment the following:
|
8
|
+
require "minitest/rails/capybara"
|
9
|
+
|
10
|
+
# Uncomment for awesome colorful output
|
11
|
+
require "minitest/pride"
|
12
|
+
|
13
|
+
class ActiveSupport::TestCase
|
14
|
+
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
15
|
+
fixtures :all
|
16
|
+
# Add more helper methods to be used by all tests here...
|
17
|
+
end
|
@@ -4,7 +4,14 @@ require 'spec_helper'
|
|
4
4
|
require File.expand_path('../../config/environment', __FILE__)
|
5
5
|
require 'rspec/rails'
|
6
6
|
|
7
|
+
require 'capybara/rspec'
|
8
|
+
require 'capybara/webkit'
|
9
|
+
require 'capybara-screenshot/rspec'
|
10
|
+
|
11
|
+
Capybara.default_driver = :webkit
|
7
12
|
Capybara.javascript_driver = :webkit
|
13
|
+
Capybara::Screenshot.prune_strategy = :keep_last_run
|
14
|
+
Capybara::Screenshot.webkit_options = { width: 1024, height: 768 }
|
8
15
|
|
9
16
|
# Add additional requires below this line. Rails is not loaded until this point!
|
10
17
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
require 'rails/test_unit/sub_test_task'
|
3
|
+
|
4
|
+
# namespace :test do
|
5
|
+
# task :bot => :environment do
|
6
|
+
# #Rails::TestTask.test_creator(Rake.application.top_level_tasks).invoke_rake_task
|
7
|
+
|
8
|
+
# #eval File.read("#{config.root}/lib/generators/templates/effective_test_bot.rb")
|
9
|
+
# Rails::TestTask.new('effective_test_bot' => 'test:prepare') do |t|
|
10
|
+
# t.libs << 'test'
|
11
|
+
# t.pattern = 'test/integration/**/*_test.rb'
|
12
|
+
# #t.test_files = FileList["../effective_test_bot/test/**/*_test.rb"].exclude('test/controllers/**/*_test.rb')
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
|
17
|
+
namespace :test do
|
18
|
+
desc 'Runs Effective Test Bot'
|
19
|
+
task :bot do
|
20
|
+
Rake::Task["test:effective_test_bot"].invoke
|
21
|
+
end
|
22
|
+
|
23
|
+
#Rake::Task["db:seed"].invoke
|
24
|
+
# Or in rails 3 add to test/test_helper.rb
|
25
|
+
# Rails.application.load_seed
|
26
|
+
|
27
|
+
Rails::TestTask.new('effective_test_bot' => 'test:prepare') do |t|
|
28
|
+
puts "Read effective_test_bot rake task!"
|
29
|
+
|
30
|
+
t.libs << 'test'
|
31
|
+
t.test_files = FileList["#{File.dirname(__FILE__)}/../../test/**/*_test.rb"]
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'CRUD Compliance Tests' do
|
4
|
+
['Clinic'].each do |resource|
|
5
|
+
feature "#{resource} CRUD Compliance" do
|
6
|
+
let(:obj) { resource.constantize.new() }
|
7
|
+
|
8
|
+
scenario 'Has an empty index screen', :js => true do
|
9
|
+
visit polymorphic_path(obj)
|
10
|
+
page.save_screenshot('something.png')
|
11
|
+
|
12
|
+
expect(page.status_code).to eq 200
|
13
|
+
expect(page).to have_content 'There are no'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
# feature 'CRUD Compliance Test' do
|
22
|
+
# [:clinic].each do |resource|
|
23
|
+
# feature ''
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
|
27
|
+
|
28
|
+
# RSpec.describe 'FactoryGirl' do
|
29
|
+
# FactoryGirl.factories.map(&:name).each do |factory_name|
|
30
|
+
# describe "#{ factory_name } factory" do
|
31
|
+
# it 'should be valid' do
|
32
|
+
# factory = FactoryGirl.build(factory_name)
|
33
|
+
# if factory.respond_to?(:valid?)
|
34
|
+
# expect(factory).to be_valid, -> { factory.errors.full_messages.join("\n") }
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
|
38
|
+
# FactoryGirl.factories[factory_name].definition.defined_traits.map(&:name).each do |trait_name|
|
39
|
+
# context "with trait #{ trait_name }" do
|
40
|
+
# it 'should be valid' do
|
41
|
+
# factory = FactoryGirl.build(factory_name, trait_name)
|
42
|
+
# if factory.respond_to?(:valid?)
|
43
|
+
# expect(factory).to be_valid, -> { factory.errors.full_messages.join("\n") }
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
# end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_test_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: capybara
|
56
|
+
name: minitest-capybara
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: minitest-rails-capybara
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: capybara
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: capybara-webkit
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -95,7 +109,7 @@ dependencies:
|
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: capybara-screenshot
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -109,7 +123,7 @@ dependencies:
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: shoulda
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ">="
|
@@ -138,8 +152,11 @@ files:
|
|
138
152
|
- lib/effective_test_bot/version.rb
|
139
153
|
- lib/generators/effective_test_bot/install_generator.rb
|
140
154
|
- lib/generators/templates/effective_test_bot.rb
|
155
|
+
- lib/generators/templates/minitest/test_helper.rb
|
141
156
|
- lib/generators/templates/rspec/rails_helper.rb
|
142
157
|
- lib/generators/templates/rspec/spec_helper.rb
|
158
|
+
- lib/tasks/effective_test_bot_tasks.rake
|
159
|
+
- spec/features/crud/crud_spec.rb
|
143
160
|
- spec/features/devise/sign_in_spec.rb
|
144
161
|
- spec/features/devise/sign_up_spec.rb
|
145
162
|
- spec/features/home_page_spec.rb
|
@@ -170,6 +187,7 @@ specification_version: 4
|
|
170
187
|
summary: A shared library of rails model & capybara-based feature tests that should
|
171
188
|
pass in every Rails application.
|
172
189
|
test_files:
|
190
|
+
- spec/features/crud/crud_spec.rb
|
173
191
|
- spec/features/devise/sign_in_spec.rb
|
174
192
|
- spec/features/devise/sign_up_spec.rb
|
175
193
|
- spec/features/home_page_spec.rb
|