tailor 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/Gemfile.lock +39 -31
- data/History.md +220 -207
- data/README.md +58 -45
- data/features/step_definitions/indentation_steps.rb +1 -1
- data/lib/tailor/reporter.rb +19 -7
- data/lib/tailor/rulers/spaces_before_lbrace_ruler.rb +0 -1
- data/lib/tailor/rulers/spaces_before_rbrace_ruler.rb +0 -1
- data/lib/tailor/rulers/spaces_in_empty_braces_ruler.rb +0 -1
- data/lib/tailor/version.rb +1 -1
- data/spec/functional/conditional_parentheses_spec.rb +1 -1
- data/spec/functional/conditional_spacing_spec.rb +1 -1
- data/spec/functional/configuration_spec.rb +61 -52
- data/spec/functional/horizontal_spacing/braces_spec.rb +134 -134
- data/spec/functional/horizontal_spacing/brackets_spec.rb +34 -36
- data/spec/functional/horizontal_spacing/comma_spacing_spec.rb +25 -27
- data/spec/functional/horizontal_spacing/hard_tabs_spec.rb +42 -42
- data/spec/functional/horizontal_spacing/long_lines_spec.rb +15 -17
- data/spec/functional/horizontal_spacing/long_methods_spec.rb +4 -4
- data/spec/functional/horizontal_spacing/parens_spec.rb +45 -45
- data/spec/functional/horizontal_spacing/trailing_whitespace_spec.rb +7 -8
- data/spec/functional/horizontal_spacing_spec.rb +10 -11
- data/spec/functional/indentation_spacing/argument_alignment_spec.rb +33 -62
- data/spec/functional/indentation_spacing/bad_indentation_spec.rb +176 -179
- data/spec/functional/indentation_spacing_spec.rb +13 -14
- data/spec/functional/naming/camel_case_methods_spec.rb +4 -6
- data/spec/functional/naming/screaming_snake_case_classes_spec.rb +28 -31
- data/spec/functional/naming_spec.rb +3 -3
- data/spec/functional/rake_task_spec.rb +9 -28
- data/spec/functional/string_interpolation_spec.rb +1 -1
- data/spec/functional/string_quoting_spec.rb +1 -1
- data/spec/functional/vertical_spacing/class_length_spec.rb +4 -6
- data/spec/functional/vertical_spacing/method_length_spec.rb +15 -17
- data/spec/functional/vertical_spacing_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/support/argument_alignment_cases.rb +32 -32
- data/spec/support/conditional_parentheses_cases.rb +26 -26
- data/spec/support/good_indentation_cases.rb +205 -205
- data/spec/support/horizontal_spacing_cases.rb +53 -54
- data/spec/support/line_indentation_cases.rb +20 -20
- data/spec/support/naming_cases.rb +12 -12
- data/spec/support/string_interpolation_cases.rb +17 -17
- data/spec/support/string_quoting_cases.rb +12 -12
- data/spec/support/vertical_spacing_cases.rb +8 -8
- data/spec/unit/tailor/cli/options_spec.rb +20 -14
- data/spec/unit/tailor/cli_spec.rb +29 -43
- data/spec/unit/tailor/composite_observable_spec.rb +1 -1
- data/spec/unit/tailor/configuration/file_set_spec.rb +10 -11
- data/spec/unit/tailor/configuration/style_spec.rb +41 -42
- data/spec/unit/tailor/configuration_spec.rb +14 -12
- data/spec/unit/tailor/formatter_spec.rb +3 -3
- data/spec/unit/tailor/formatters/yaml_spec.rb +12 -13
- data/spec/unit/tailor/lexed_line_spec.rb +67 -69
- data/spec/unit/tailor/lexer/token_spec.rb +7 -7
- data/spec/unit/tailor/lexer_spec.rb +24 -24
- data/spec/unit/tailor/problem_spec.rb +12 -12
- data/spec/unit/tailor/reporter_spec.rb +8 -9
- data/spec/unit/tailor/ruler_spec.rb +10 -10
- data/spec/unit/tailor/rulers/indentation_spaces_ruler/indentation_manager_spec.rb +90 -86
- data/spec/unit/tailor/rulers/indentation_spaces_ruler_spec.rb +13 -13
- data/spec/unit/tailor/rulers/spaces_after_comma_ruler_spec.rb +4 -4
- data/spec/unit/tailor/rulers/spaces_after_lbrace_ruler_spec.rb +19 -19
- data/spec/unit/tailor/rulers/spaces_before_lbrace_ruler_spec.rb +6 -6
- data/spec/unit/tailor/rulers/spaces_before_rbrace_ruler_spec.rb +6 -6
- data/spec/unit/tailor/rulers_spec.rb +1 -1
- data/spec/unit/tailor/version_spec.rb +1 -2
- data/spec/unit/tailor_spec.rb +2 -2
- data/tailor.gemspec +3 -3
- metadata +20 -6
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'tailor/cli/options'
|
3
3
|
|
4
|
+
# Module to use in tests.
|
4
5
|
module OptionHelpers
|
5
6
|
def cli_option(name)
|
6
7
|
"--#{name.to_s.gsub('_', '-')}"
|
7
8
|
end
|
9
|
+
|
8
10
|
def option_value(name, value)
|
9
11
|
options = Tailor::CLI::Options.parse!([cli_option(name), value])
|
10
12
|
options.style[name]
|
@@ -13,6 +15,7 @@ end
|
|
13
15
|
|
14
16
|
describe Tailor::CLI::Options do
|
15
17
|
include OptionHelpers
|
18
|
+
|
16
19
|
describe '#parse!' do
|
17
20
|
[
|
18
21
|
:indentation_spaces,
|
@@ -31,20 +34,23 @@ describe Tailor::CLI::Options do
|
|
31
34
|
:spaces_in_empty_braces,
|
32
35
|
:trailing_newlines
|
33
36
|
].each do |o|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
37
|
+
it 'parses a valid numeric argument correct' do
|
38
|
+
expect(option_value(o, '1')).to eq 1
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'marks the ruler as off if the option is specified as "off"' do
|
42
|
+
expect(option_value(o, 'off')).to eq :off
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'marks a ruler as off if the option is specified as "false"' do
|
46
|
+
expect(option_value(o, 'false')).to eq :off
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'raises if the argument is otherwise not an integer' do
|
50
|
+
expect do
|
51
|
+
option_value(o, 'not-an-integer')
|
52
|
+
end.to raise_error(OptionParser::InvalidArgument)
|
48
53
|
end
|
54
|
+
end
|
49
55
|
end
|
50
56
|
end
|
@@ -1,24 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'tailor/cli'
|
3
3
|
|
4
|
-
|
5
4
|
describe Tailor::CLI do
|
6
5
|
let(:args) { [] }
|
7
6
|
let(:options) { double 'Options', show_config: false }
|
8
7
|
|
9
8
|
let(:config) do
|
10
|
-
double 'Tailor::Configuration',
|
11
|
-
file_sets: nil, formatters: nil, load!: nil
|
9
|
+
double 'Tailor::Configuration', file_sets: nil, formatters: nil, load!: nil
|
12
10
|
end
|
13
11
|
|
14
12
|
before do
|
15
|
-
Tailor::Configuration.
|
16
|
-
Tailor::Critic.
|
17
|
-
Tailor::Reporter.
|
18
|
-
end
|
19
|
-
|
20
|
-
after do
|
21
|
-
Tailor::Configuration.unstub(:new)
|
13
|
+
allow(Tailor::Configuration).to receive(:new).and_return config
|
14
|
+
allow(Tailor::Critic).to receive(:new)
|
15
|
+
allow(Tailor::Reporter).to receive(:new)
|
22
16
|
end
|
23
17
|
|
24
18
|
subject { Tailor::CLI.new(args) }
|
@@ -26,39 +20,40 @@ describe Tailor::CLI do
|
|
26
20
|
describe '::run' do
|
27
21
|
it "creates an instance of Tailor::CLI and calls that object's #execute!" do
|
28
22
|
cli = double 'Tailor::CLI'
|
29
|
-
cli.
|
30
|
-
Tailor::CLI.
|
23
|
+
expect(cli).to receive(:execute!)
|
24
|
+
expect(Tailor::CLI).to receive(:new).and_return cli
|
31
25
|
Tailor::CLI.run([])
|
32
26
|
end
|
33
27
|
end
|
34
28
|
|
35
29
|
describe '#initialize' do
|
36
|
-
let(:args) { %w
|
30
|
+
let(:args) { %w(last) }
|
37
31
|
|
38
32
|
it 'uses Options to parse the args' do
|
39
|
-
Tailor::Configuration.
|
40
|
-
Tailor::Critic.
|
41
|
-
Tailor::Reporter.
|
42
|
-
Tailor::CLI::Options.
|
33
|
+
allow(Tailor::Configuration).to receive(:new).and_return config
|
34
|
+
allow(Tailor::Critic).to receive(:new)
|
35
|
+
allow(Tailor::Reporter).to receive(:new)
|
36
|
+
expect(Tailor::CLI::Options).to receive(:parse!).
|
37
|
+
with(args).and_return options
|
43
38
|
|
44
39
|
Tailor::CLI.new(args)
|
45
40
|
end
|
46
41
|
|
47
42
|
it 'creates a new Configuration from the file/dir and options' do
|
48
|
-
Tailor::CLI::Options.
|
49
|
-
Tailor::Configuration.
|
50
|
-
|
43
|
+
allow(Tailor::CLI::Options).to receive(:parse!).and_return(options)
|
44
|
+
expect(Tailor::Configuration).to receive(:new).with(args, options).
|
45
|
+
and_return config
|
51
46
|
Tailor::Critic.stub(:new)
|
52
47
|
|
53
48
|
Tailor::CLI.new(args)
|
54
49
|
end
|
55
50
|
|
56
51
|
context 'options.show_config is true' do
|
57
|
-
|
52
|
+
pending
|
58
53
|
end
|
59
54
|
|
60
55
|
context 'options.show_config is false' do
|
61
|
-
|
56
|
+
pending
|
62
57
|
end
|
63
58
|
end
|
64
59
|
|
@@ -67,26 +62,21 @@ describe Tailor::CLI do
|
|
67
62
|
let(:critic) { double 'Tailor::Critic', problem_count: 0 }
|
68
63
|
|
69
64
|
before do
|
70
|
-
Tailor::Critic.
|
71
|
-
Tailor::Reporter.
|
65
|
+
allow(Tailor::Critic).to receive(:new).and_return(critic)
|
66
|
+
allow(Tailor::Reporter).to receive(:new).and_return(reporter)
|
72
67
|
subject.instance_variable_set(:@critic, critic)
|
73
68
|
subject.instance_variable_set(:@reporter, reporter)
|
74
69
|
end
|
75
70
|
|
76
|
-
after do
|
77
|
-
Tailor::Critic.unstub(:new)
|
78
|
-
Tailor::Reporter.unstub(:new)
|
79
|
-
end
|
80
|
-
|
81
71
|
it 'calls @critic.critique and yields file problems and the label' do
|
82
72
|
problems_for_file = {}
|
83
73
|
label = :test
|
84
|
-
config.
|
85
|
-
critic.
|
86
|
-
critic.
|
87
|
-
critic.
|
88
|
-
reporter.
|
89
|
-
reporter.
|
74
|
+
expect(config).to receive(:output_file)
|
75
|
+
allow(critic).to receive(:problem_count).and_return 1
|
76
|
+
allow(critic).to receive(:problems)
|
77
|
+
allow(critic).to receive(:critique).and_yield(problems_for_file, label)
|
78
|
+
allow(reporter).to receive(:summary_report)
|
79
|
+
expect(reporter).to receive(:file_report).with(problems_for_file, label)
|
90
80
|
|
91
81
|
subject.execute!
|
92
82
|
end
|
@@ -96,20 +86,16 @@ describe Tailor::CLI do
|
|
96
86
|
let(:critic) { double 'Tailor::Critic', problem_count: 0 }
|
97
87
|
|
98
88
|
before do
|
99
|
-
Tailor::Critic.
|
89
|
+
allow(Tailor::Critic).to receive(:new).and_return(critic)
|
100
90
|
subject.instance_variable_set(:@critic, critic)
|
101
91
|
end
|
102
92
|
|
103
|
-
after do
|
104
|
-
Tailor::Critic.unstub(:new)
|
105
|
-
end
|
106
|
-
|
107
93
|
it 'calls @critic.critique and return @critique.problems hash' do
|
108
94
|
problems = {}
|
109
|
-
critic.
|
110
|
-
critic.
|
95
|
+
expect(critic).to receive(:critique)
|
96
|
+
expect(critic).to receive(:problems).and_return(problems)
|
111
97
|
|
112
|
-
subject.result.
|
98
|
+
expect(subject.result).to eq problems
|
113
99
|
end
|
114
100
|
end
|
115
101
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'tailor/configuration/file_set'
|
3
3
|
|
4
|
-
|
5
4
|
describe Tailor::Configuration::FileSet do
|
6
5
|
describe '#build_file_list' do
|
7
6
|
context 'param is a file name' do
|
@@ -12,14 +11,14 @@ describe Tailor::Configuration::FileSet do
|
|
12
11
|
|
13
12
|
it 'builds an Array with that file\'s expanded path' do
|
14
13
|
new_list = subject.instance_eval { build_file_list('./test.rb') }
|
15
|
-
new_list.
|
16
|
-
new_list.first.
|
14
|
+
expect(new_list).to be_an Array
|
15
|
+
expect(new_list.first).to match(%r{/test.rb$})
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
20
19
|
context 'the file does not exist' do
|
21
20
|
it 'returns an empty Array' do
|
22
|
-
subject.instance_eval { build_file_list('test.rb') }.
|
21
|
+
expect(subject.instance_eval { build_file_list('test.rb') }).to eq []
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
@@ -30,8 +29,8 @@ describe Tailor::Configuration::FileSet do
|
|
30
29
|
end
|
31
30
|
|
32
31
|
it 'returns the Array with expanded file paths' do
|
33
|
-
subject.instance_eval { build_file_list(['test.rb']) }.
|
34
|
-
|
32
|
+
expect(subject.instance_eval { build_file_list(['test.rb']) }.first).
|
33
|
+
to match(%r{/test.rb$})
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
@@ -43,8 +42,8 @@ describe Tailor::Configuration::FileSet do
|
|
43
42
|
|
44
43
|
it 'returns the expanded file paths in that directory' do
|
45
44
|
list = subject.instance_eval { build_file_list('test') }
|
46
|
-
list.size.
|
47
|
-
list.first.
|
45
|
+
expect(list.size).to eq 1
|
46
|
+
expect(list.first).to match(/.+\/test.rb/)
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
@@ -57,9 +56,9 @@ describe Tailor::Configuration::FileSet do
|
|
57
56
|
|
58
57
|
it 'builds the file list and concats that to @file_list' do
|
59
58
|
subject.update_file_list('test2.rb')
|
60
|
-
subject.instance_variable_get(:@file_list).size.
|
61
|
-
subject.instance_variable_get(:@file_list).last.
|
62
|
-
|
59
|
+
expect(subject.instance_variable_get(:@file_list).size).to eq 2
|
60
|
+
expect(subject.instance_variable_get(:@file_list).last).
|
61
|
+
to match(%r{/test2.rb})
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'tailor/configuration/style'
|
3
3
|
|
4
|
-
|
5
4
|
describe Tailor::Configuration::Style do
|
6
5
|
describe '.define_property' do
|
7
6
|
it 'defines an instance method that takes 2 params' do
|
@@ -12,7 +11,7 @@ describe Tailor::Configuration::Style do
|
|
12
11
|
it 'allows access to the values via #to_hash' do
|
13
12
|
Tailor::Configuration::Style.define_property(:test_method)
|
14
13
|
subject.test_method(1, level: :pants)
|
15
|
-
subject.to_hash.
|
14
|
+
expect(subject.to_hash).to include test_method: [1, { level: :pants }]
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
@@ -20,134 +19,134 @@ describe Tailor::Configuration::Style do
|
|
20
19
|
describe 'sets up default values' do
|
21
20
|
describe 'allow_camel_case_methods' do
|
22
21
|
specify do
|
23
|
-
subject.instance_variable_get(:@allow_camel_case_methods).
|
24
|
-
false, { level: :error }]
|
22
|
+
expect(subject.instance_variable_get(:@allow_camel_case_methods)).
|
23
|
+
to eq [false, { level: :error }]
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
27
|
describe 'allow_hard_tabs' do
|
29
28
|
specify do
|
30
|
-
subject.instance_variable_get(:@allow_hard_tabs).
|
31
|
-
false, { level: :error }]
|
29
|
+
expect(subject.instance_variable_get(:@allow_hard_tabs)).
|
30
|
+
to eq [false, { level: :error }]
|
32
31
|
end
|
33
32
|
end
|
34
33
|
|
35
34
|
describe 'allow_screaming_snake_case_classes' do
|
36
35
|
specify do
|
37
|
-
subject.instance_variable_get(:@allow_screaming_snake_case_classes).
|
38
|
-
|
36
|
+
expect(subject.instance_variable_get(:@allow_screaming_snake_case_classes)).
|
37
|
+
to eq [false, { level: :error }]
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
41
|
describe 'allow_trailing_line_spaces' do
|
43
42
|
specify do
|
44
|
-
subject.instance_variable_get(:@allow_trailing_line_spaces).
|
45
|
-
|
43
|
+
expect(subject.instance_variable_get(:@allow_trailing_line_spaces)).
|
44
|
+
to eq [false, { level: :error }]
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
49
48
|
describe 'indentation_spaces' do
|
50
49
|
specify do
|
51
|
-
subject.instance_variable_get(:@indentation_spaces).
|
52
|
-
2, { level: :error }]
|
50
|
+
expect(subject.instance_variable_get(:@indentation_spaces)).
|
51
|
+
to eq [2, { level: :error }]
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
56
55
|
describe 'max_code_lines_in_class' do
|
57
56
|
specify do
|
58
|
-
subject.instance_variable_get(:@max_code_lines_in_class).
|
59
|
-
300, { level: :error }]
|
57
|
+
expect(subject.instance_variable_get(:@max_code_lines_in_class)).
|
58
|
+
to eq [300, { level: :error }]
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
62
|
describe 'max_code_lines_in_method' do
|
64
63
|
specify do
|
65
|
-
subject.instance_variable_get(:@max_code_lines_in_method).
|
66
|
-
30, { level: :error }]
|
64
|
+
expect(subject.instance_variable_get(:@max_code_lines_in_method)).
|
65
|
+
to eq [30, { level: :error }]
|
67
66
|
end
|
68
67
|
end
|
69
68
|
|
70
69
|
describe 'max_line_length' do
|
71
70
|
specify do
|
72
|
-
subject.instance_variable_get(:@max_line_length).
|
73
|
-
80, { level: :error }]
|
71
|
+
expect(subject.instance_variable_get(:@max_line_length)).
|
72
|
+
to eq [80, { level: :error }]
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
77
76
|
describe 'spaces_after_comma' do
|
78
77
|
specify do
|
79
|
-
subject.instance_variable_get(:@spaces_after_comma).
|
80
|
-
1, { level: :error }]
|
78
|
+
expect(subject.instance_variable_get(:@spaces_after_comma)).
|
79
|
+
to eq [1, { level: :error }]
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
84
83
|
describe 'spaces_after_lbrace' do
|
85
84
|
specify do
|
86
|
-
subject.instance_variable_get(:@spaces_after_lbrace).
|
87
|
-
1, { level: :error }]
|
85
|
+
expect(subject.instance_variable_get(:@spaces_after_lbrace)).
|
86
|
+
to eq [1, { level: :error }]
|
88
87
|
end
|
89
88
|
end
|
90
89
|
|
91
90
|
describe 'spaces_after_lbracket' do
|
92
91
|
specify do
|
93
|
-
subject.instance_variable_get(:@spaces_after_lbracket).
|
94
|
-
0, { level: :error }]
|
92
|
+
expect(subject.instance_variable_get(:@spaces_after_lbracket)).
|
93
|
+
to eq [0, { level: :error }]
|
95
94
|
end
|
96
95
|
end
|
97
96
|
|
98
97
|
describe 'spaces_after_lparen' do
|
99
98
|
specify do
|
100
|
-
subject.instance_variable_get(:@spaces_after_lparen).
|
101
|
-
0, { level: :error }]
|
99
|
+
expect(subject.instance_variable_get(:@spaces_after_lparen)).
|
100
|
+
to eq [0, { level: :error }]
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
105
104
|
describe 'spaces_before_comma' do
|
106
105
|
specify do
|
107
|
-
subject.instance_variable_get(:@spaces_before_comma).
|
108
|
-
0, { level: :error }]
|
106
|
+
expect(subject.instance_variable_get(:@spaces_before_comma)).
|
107
|
+
to eq [0, { level: :error }]
|
109
108
|
end
|
110
109
|
end
|
111
110
|
|
112
111
|
describe 'spaces_before_lbrace' do
|
113
112
|
specify do
|
114
|
-
subject.instance_variable_get(:@spaces_before_lbrace).
|
115
|
-
1, { level: :error }]
|
113
|
+
expect(subject.instance_variable_get(:@spaces_before_lbrace)).
|
114
|
+
to eq [1, { level: :error }]
|
116
115
|
end
|
117
116
|
end
|
118
117
|
|
119
118
|
describe 'spaces_before_rbrace' do
|
120
119
|
specify do
|
121
|
-
subject.instance_variable_get(:@spaces_before_rbrace).
|
122
|
-
1, { level: :error }]
|
120
|
+
expect(subject.instance_variable_get(:@spaces_before_rbrace)).
|
121
|
+
to eq [1, { level: :error }]
|
123
122
|
end
|
124
123
|
end
|
125
124
|
|
126
125
|
describe 'spaces_before_rbracket' do
|
127
126
|
specify do
|
128
|
-
subject.instance_variable_get(:@spaces_before_rbracket).
|
129
|
-
0, { level: :error }]
|
127
|
+
expect(subject.instance_variable_get(:@spaces_before_rbracket)).
|
128
|
+
to eq [0, { level: :error }]
|
130
129
|
end
|
131
130
|
end
|
132
131
|
|
133
132
|
describe 'spaces_before_rparen' do
|
134
133
|
specify do
|
135
|
-
subject.instance_variable_get(:@spaces_before_rparen).
|
136
|
-
0, { level: :error }]
|
134
|
+
expect(subject.instance_variable_get(:@spaces_before_rparen)).
|
135
|
+
to eq [0, { level: :error }]
|
137
136
|
end
|
138
137
|
end
|
139
138
|
|
140
139
|
describe 'spaces_in_empty_braces' do
|
141
140
|
specify do
|
142
|
-
subject.instance_variable_get(:@spaces_in_empty_braces).
|
143
|
-
0, { level: :error }]
|
141
|
+
expect(subject.instance_variable_get(:@spaces_in_empty_braces)).
|
142
|
+
to eq [0, { level: :error }]
|
144
143
|
end
|
145
144
|
end
|
146
145
|
|
147
146
|
describe 'trailing_newlines' do
|
148
147
|
specify do
|
149
|
-
subject.instance_variable_get(:@trailing_newlines).
|
150
|
-
1, { level: :error }]
|
148
|
+
expect(subject.instance_variable_get(:@trailing_newlines)).
|
149
|
+
to eq [1, { level: :error }]
|
151
150
|
end
|
152
151
|
end
|
153
152
|
end
|
@@ -184,7 +183,7 @@ describe Tailor::Configuration::Style do
|
|
184
183
|
end
|
185
184
|
|
186
185
|
it 'returns a Hash of all of the attributes and values' do
|
187
|
-
subject.to_hash.
|
186
|
+
expect(subject.to_hash).to eq default_values
|
188
187
|
end
|
189
188
|
|
190
189
|
context 'with a user-added property' do
|
@@ -194,7 +193,7 @@ describe Tailor::Configuration::Style do
|
|
194
193
|
end
|
195
194
|
|
196
195
|
it 'includes the new property as part of the Hash' do
|
197
|
-
subject.to_hash.
|
196
|
+
expect(subject.to_hash).to include long_pants: [1, { level: :warn }]
|
198
197
|
end
|
199
198
|
end
|
200
199
|
end
|