shoulda 3.6.0 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +181 -2
- data/.ruby-version +1 -0
- data/.travis.yml +24 -9
- data/Appraisals +108 -10
- data/Gemfile +9 -5
- data/README.md +24 -17
- data/Rakefile +18 -13
- data/gemfiles/rails_4_2.gemfile +31 -0
- data/gemfiles/rails_4_2.gemfile.lock +240 -0
- data/gemfiles/rails_5_0.gemfile +29 -0
- data/gemfiles/rails_5_0.gemfile.lock +232 -0
- data/gemfiles/rails_5_1.gemfile +30 -0
- data/gemfiles/rails_5_1.gemfile.lock +249 -0
- data/gemfiles/rails_5_2.gemfile +32 -0
- data/gemfiles/rails_5_2.gemfile.lock +268 -0
- data/gemfiles/rails_6_0.gemfile +34 -0
- data/gemfiles/rails_6_0.gemfile.lock +285 -0
- data/lib/shoulda/version.rb +1 -1
- data/script/install_gems_in_all_appraisals +16 -0
- data/script/run_all_tests +16 -0
- data/script/supported_ruby_versions +7 -0
- data/script/update_gem_in_all_appraisals +17 -0
- data/script/update_gems_in_all_appraisals +16 -0
- data/shoulda.gemspec +3 -3
- data/test/acceptance/integrates_with_rails_test.rb +580 -0
- data/test/acceptance_test_helper.rb +32 -6
- data/test/support/acceptance/add_shoulda_to_project.rb +13 -18
- data/test/support/acceptance/matchers/have_output.rb +2 -0
- data/test/support/acceptance/matchers/indicate_that_tests_were_run.rb +109 -0
- data/test/support/acceptance/rails_application_with_shoulda.rb +47 -0
- data/test/support/{tests/current_bundle.rb → current_bundle.rb} +4 -4
- data/test/support/snowglobe.rb +5 -0
- data/test/test_helper.rb +9 -4
- metadata +37 -65
- data/.hound/ruby.yml +0 -1042
- data/gemfiles/4.2.gemfile +0 -17
- data/gemfiles/4.2.gemfile.lock +0 -174
- data/gemfiles/5.0.gemfile +0 -17
- data/gemfiles/5.0.gemfile.lock +0 -179
- data/test/acceptance/rails_integration_test.rb +0 -76
- data/test/report_warnings.rb +0 -7
- data/test/support/acceptance/helpers.rb +0 -19
- data/test/support/acceptance/helpers/active_model_helpers.rb +0 -11
- data/test/support/acceptance/helpers/base_helpers.rb +0 -14
- data/test/support/acceptance/helpers/command_helpers.rb +0 -54
- data/test/support/acceptance/helpers/file_helpers.rb +0 -19
- data/test/support/acceptance/helpers/gem_helpers.rb +0 -31
- data/test/support/acceptance/helpers/step_helpers.rb +0 -69
- data/test/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +0 -54
- data/test/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb +0 -75
- data/test/support/tests/bundle.rb +0 -94
- data/test/support/tests/command_runner.rb +0 -230
- data/test/support/tests/filesystem.rb +0 -100
- data/test/support/tests/version.rb +0 -45
- data/test/warnings_spy.rb +0 -62
- data/test/warnings_spy/filesystem.rb +0 -45
- data/test/warnings_spy/partitioner.rb +0 -36
- data/test/warnings_spy/reader.rb +0 -53
- data/test/warnings_spy/reporter.rb +0 -88
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
class WarningsSpy
|
4
|
-
class Partitioner
|
5
|
-
extend Forwardable
|
6
|
-
|
7
|
-
attr_reader :relevant_warning_groups, :irrelevant_warning_groups
|
8
|
-
|
9
|
-
def initialize(reader, filesystem)
|
10
|
-
@reader = reader
|
11
|
-
@search_text = filesystem.project_dir
|
12
|
-
end
|
13
|
-
|
14
|
-
def partition
|
15
|
-
@relevant_warning_groups, @irrelevant_warning_groups =
|
16
|
-
warning_groups.partition { |group| relevant_warnings?(group) }
|
17
|
-
end
|
18
|
-
|
19
|
-
protected
|
20
|
-
|
21
|
-
attr_reader :reader, :search_text
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def_delegators :reader, :warning_groups
|
26
|
-
|
27
|
-
def relevant_warnings?(group)
|
28
|
-
first_line = group[0]
|
29
|
-
first_line.start_with?("#{project_root}/lib")
|
30
|
-
end
|
31
|
-
|
32
|
-
def project_root
|
33
|
-
File.expand_path('../../..')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/test/warnings_spy/reader.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
class WarningsSpy
|
2
|
-
class Reader
|
3
|
-
attr_reader :warning_groups
|
4
|
-
|
5
|
-
def initialize(filesystem)
|
6
|
-
@warnings_file = filesystem.warnings_file
|
7
|
-
|
8
|
-
@current_group = []
|
9
|
-
@warning_groups = []
|
10
|
-
end
|
11
|
-
|
12
|
-
def read
|
13
|
-
warnings_file.rewind
|
14
|
-
|
15
|
-
warnings_file.each_line do |line|
|
16
|
-
process_line(line)
|
17
|
-
end
|
18
|
-
|
19
|
-
add_group(current_group)
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
attr_reader :warnings_file, :current_group
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def process_line(line)
|
29
|
-
if start_of_group?(line)
|
30
|
-
add_group(current_group)
|
31
|
-
@current_group = []
|
32
|
-
end
|
33
|
-
|
34
|
-
current_group << line
|
35
|
-
end
|
36
|
-
|
37
|
-
def start_of_group?(line)
|
38
|
-
line =~ /^\S/
|
39
|
-
end
|
40
|
-
|
41
|
-
def add_group(group)
|
42
|
-
unless group.empty? || group_already_added?(group)
|
43
|
-
warning_groups << group
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def group_already_added?(group_to_be_added)
|
48
|
-
warning_groups.any? do |group|
|
49
|
-
group == group_to_be_added
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
class WarningsSpy
|
4
|
-
class Reporter
|
5
|
-
extend Forwardable
|
6
|
-
|
7
|
-
def initialize(partitioner, filesystem, project_name)
|
8
|
-
@partitioner = partitioner
|
9
|
-
@warnings_file = filesystem.warnings_file
|
10
|
-
@relevant_warnings_file = filesystem.relevant_warnings_file
|
11
|
-
@irrelevant_warnings_file = filesystem.irrelevant_warnings_file
|
12
|
-
@project_name = project_name
|
13
|
-
end
|
14
|
-
|
15
|
-
def report
|
16
|
-
reporting_all_groups do
|
17
|
-
report_relevant_warning_groups
|
18
|
-
report_irrelevant_warning_groups
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
attr_reader :partitioner, :warnings_file, :relevant_warnings_file,
|
25
|
-
:irrelevant_warnings_file, :project_name
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def_delegators :partitioner, :relevant_warning_groups,
|
30
|
-
:irrelevant_warning_groups
|
31
|
-
|
32
|
-
def report_relevant_warning_groups
|
33
|
-
if relevant_warning_groups.any?
|
34
|
-
print_divider('-', 75, header: " #{project_name} warnings:")
|
35
|
-
relevant_warning_groups.each do |group|
|
36
|
-
group.each do |line|
|
37
|
-
relevant_warnings_file.puts(line)
|
38
|
-
puts line
|
39
|
-
end
|
40
|
-
end
|
41
|
-
print_divider('-', 75)
|
42
|
-
puts "#{project_name} warnings written to #{relevant_warnings_file.path}."
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def report_irrelevant_warning_groups
|
47
|
-
if irrelevant_warning_groups.any?
|
48
|
-
irrelevant_warning_groups.each do |group|
|
49
|
-
group.each do |line|
|
50
|
-
irrelevant_warnings_file.puts(line)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
puts "Non #{project_name} warnings were raised during the test run. These have been written to #{irrelevant_warnings_file.path}."
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def reporting_all_groups
|
58
|
-
if relevant_warning_groups.any? || irrelevant_warning_groups.any?
|
59
|
-
puts
|
60
|
-
yield
|
61
|
-
puts "All warnings were written to #{warnings_file.path}."
|
62
|
-
puts
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def print_divider(character, count, options = {})
|
67
|
-
puts
|
68
|
-
|
69
|
-
if options[:header]
|
70
|
-
first_count = 10
|
71
|
-
second_count = options[:header].length - first_count
|
72
|
-
string =
|
73
|
-
horizontal_rule(character, first_count) +
|
74
|
-
options[:header] +
|
75
|
-
horizontal_rule(character, second_count)
|
76
|
-
puts string
|
77
|
-
else
|
78
|
-
puts horizontal_rule(character, count)
|
79
|
-
end
|
80
|
-
|
81
|
-
puts
|
82
|
-
end
|
83
|
-
|
84
|
-
def horizontal_rule(character, count)
|
85
|
-
character * count
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|