fix 0.6.1 → 0.7.0
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -5
- data/.rubocop.yml +12 -0
- data/.travis.yml +12 -3
- data/.yardopts +1 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +1 -0
- data/LICENSE.md +17 -18
- data/README.md +70 -78
- data/Rakefile +5 -2
- data/VERSION.semver +1 -1
- data/bin/console +7 -0
- data/bin/setup +5 -0
- data/certs/gem-fixrb-public_cert.pem +21 -0
- data/fix.gemspec +17 -18
- data/lib/fix.rb +20 -98
- data/lib/fix/helpers/it_helper.rb +32 -0
- data/lib/fix/helpers/on_helper.rb +29 -0
- data/lib/fix/it.rb +6 -9
- data/lib/fix/on.rb +30 -13
- data/lib/fix/report.rb +61 -0
- data/lib/fix/sandbox.rb +25 -0
- data/lib/fix/test.rb +50 -224
- data/pkg_checksum +11 -0
- metadata +61 -152
- metadata.gz.sig +0 -0
- data/.coveralls.yml +0 -1
- data/bin/fix +0 -5
- data/fix.pem +0 -21
- data/lib/fix/db.rb +0 -23
- data/lib/fix/dsl.rb +0 -17
- data/lib/fix/expectation.rb +0 -80
- data/lib/fix/expectation_high.rb +0 -15
- data/lib/fix/expectation_low.rb +0 -19
- data/lib/fix/expectation_medium.rb +0 -21
- data/lib/fix/helper/it_helper.rb +0 -12
- data/lib/fix/helper/its_helper.rb +0 -20
- data/lib/fix/helper/let_accessor_helper.rb +0 -11
- data/lib/fix/helper/let_reader_helper.rb +0 -13
- data/lib/fix/helper/let_writer_helper.rb +0 -15
- data/lib/fix/helper/on_helper.rb +0 -20
- data/lib/fix/helper/requirement_helper.rb +0 -44
- data/lib/fix/its.rb +0 -13
- data/lib/fix/subject.rb +0 -44
- data/lib/fix/version.rb +0 -9
- data/spec/fix/bin/color_spec.rb +0 -17
- data/spec/fix/bin/exit_status_spec.rb +0 -19
- data/spec/fix/bin/help_spec.rb +0 -13
- data/spec/fix/bin/hide_progress.rb +0 -17
- data/spec/fix/bin/spec_helper.rb +0 -3
- data/spec/fix/bin/version_spec.rb +0 -9
- data/spec/fix/lib/may/error_spec.rb +0 -9
- data/spec/fix/lib/may/info_spec.rb +0 -9
- data/spec/fix/lib/may/spec_helper.rb +0 -1
- data/spec/fix/lib/may/success_spec.rb +0 -9
- data/spec/fix/lib/must/error_spec.rb +0 -9
- data/spec/fix/lib/must/failure_spec.rb +0 -9
- data/spec/fix/lib/must/spec_helper.rb +0 -1
- data/spec/fix/lib/must/success_spec.rb +0 -9
- data/spec/fix/lib/should/error_spec.rb +0 -9
- data/spec/fix/lib/should/info_spec.rb +0 -9
- data/spec/fix/lib/should/spec_helper.rb +0 -1
- data/spec/fix/lib/should/success_spec.rb +0 -9
- data/spec/fix/lib/spec_helper.rb +0 -1
- data/spec/fix/lib/success_spec.rb +0 -9
- data/spec/fix/spec_helper.rb +0 -1
- data/spec/spec_helper.rb +0 -4
- data/spec/support.rb +0 -3
- data/spec/support/coverage.rb +0 -9
- data/spec/support/env.rb +0 -1
- data/spec/support/examples/42/app.rb +0 -1
- data/spec/support/examples/42/may/error/spec.rb +0 -7
- data/spec/support/examples/42/may/error/test.rb +0 -7
- data/spec/support/examples/42/may/info/spec.rb +0 -7
- data/spec/support/examples/42/may/info/test.rb +0 -7
- data/spec/support/examples/42/may/success/spec.rb +0 -12
- data/spec/support/examples/42/may/success/test.rb +0 -7
- data/spec/support/examples/42/must/error/spec.rb +0 -11
- data/spec/support/examples/42/must/error/test.rb +0 -7
- data/spec/support/examples/42/must/failure/spec.rb +0 -7
- data/spec/support/examples/42/must/failure/test.rb +0 -7
- data/spec/support/examples/42/must/success/spec.rb +0 -7
- data/spec/support/examples/42/must/success/test.rb +0 -7
- data/spec/support/examples/42/should/error/spec.rb +0 -11
- data/spec/support/examples/42/should/error/test.rb +0 -7
- data/spec/support/examples/42/should/info/spec.rb +0 -7
- data/spec/support/examples/42/should/info/test.rb +0 -7
- data/spec/support/examples/42/should/success/spec.rb +0 -7
- data/spec/support/examples/42/should/success/test.rb +0 -7
- data/spec/support/examples/duck/app.rb +0 -16
- data/spec/support/examples/duck/success/spec.rb +0 -80
- data/spec/support/examples/duck/success/test.rb +0 -7
- data/spec/support/immutable.rb +0 -12
data/lib/fix/expectation_high.rb
DELETED
data/lib/fix/expectation_low.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require_relative 'expectation_high'
|
2
|
-
|
3
|
-
module Fix
|
4
|
-
class ExpectationMedium < ExpectationHigh
|
5
|
-
private
|
6
|
-
|
7
|
-
def pass result, _subject
|
8
|
-
if super
|
9
|
-
true
|
10
|
-
elsif exception(result).nil?
|
11
|
-
nil
|
12
|
-
else
|
13
|
-
false
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def level
|
18
|
-
2
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/fix/helper/it_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
module Helper
|
3
|
-
module ItsHelper
|
4
|
-
def its attribute, *args, &block
|
5
|
-
unless instance_variable_defined? :@object
|
6
|
-
raise MissingSubjectError, "Incomplete specifications. " \
|
7
|
-
"Please specify a `subject` on the top."
|
8
|
-
end
|
9
|
-
|
10
|
-
@defs = {} unless instance_variable_defined? :@defs
|
11
|
-
@args = [] unless instance_variable_defined? :@args
|
12
|
-
|
13
|
-
i = Its.new @object, @defs, *(@args + [[attribute] + args])
|
14
|
-
i.instance_eval(&block)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
require_relative File.join '..', 'its'
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
module Helper
|
3
|
-
module LetWriterHelper
|
4
|
-
def let name, &block
|
5
|
-
@defs = {} unless instance_variable_defined? :@defs
|
6
|
-
|
7
|
-
if @defs.key? name
|
8
|
-
raise IndexError, 'the given key is already present.'
|
9
|
-
else
|
10
|
-
@defs.update name => block
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/fix/helper/on_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
module Helper
|
3
|
-
module OnHelper
|
4
|
-
def on attribute, *args, &block
|
5
|
-
unless instance_variable_defined? :@object
|
6
|
-
raise MissingSubjectError, "Incomplete specifications. " \
|
7
|
-
"Please specify a `subject` on the top."
|
8
|
-
end
|
9
|
-
|
10
|
-
@defs = {} unless instance_variable_defined? :@defs
|
11
|
-
@args = [] unless instance_variable_defined? :@args
|
12
|
-
|
13
|
-
i = On.new @object, @defs, *(@args + [[attribute] + args])
|
14
|
-
i.instance_eval(&block)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
require_relative File.join '..', 'on'
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require_relative 'let_reader_helper'
|
2
|
-
|
3
|
-
module Fix
|
4
|
-
module Helper
|
5
|
-
module RequirementHelper
|
6
|
-
include Helper::LetReaderHelper
|
7
|
-
|
8
|
-
def MUST definition
|
9
|
-
ExpectationHigh.new @object, true, definition, *@args
|
10
|
-
end
|
11
|
-
|
12
|
-
alias_method :is_REQUIRED_to, :MUST
|
13
|
-
alias_method :SHALL, :MUST
|
14
|
-
|
15
|
-
def MUST_NOT definition
|
16
|
-
ExpectationHigh.new @object, false, definition, *@args
|
17
|
-
end
|
18
|
-
|
19
|
-
alias_method :SHALL_NOT, :MUST_NOT
|
20
|
-
|
21
|
-
def SHOULD definition
|
22
|
-
ExpectationMedium.new @object, true, definition, *@args
|
23
|
-
end
|
24
|
-
|
25
|
-
alias_method :is_RECOMMENDED_to, :SHOULD
|
26
|
-
|
27
|
-
def SHOULD_NOT definition
|
28
|
-
ExpectationMedium.new @object, false, definition, *@args
|
29
|
-
end
|
30
|
-
|
31
|
-
alias_method :is_NOT_RECOMMENDED_to, :SHOULD_NOT
|
32
|
-
|
33
|
-
def MAY definition
|
34
|
-
ExpectationLow.new @object, true, definition, *@args
|
35
|
-
end
|
36
|
-
|
37
|
-
alias_method :is_OPTIONAL_to, :MAY
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
require_relative File.join '..', 'expectation_high'
|
43
|
-
require_relative File.join '..', 'expectation_low'
|
44
|
-
require_relative File.join '..', 'expectation_medium'
|
data/lib/fix/its.rb
DELETED
data/lib/fix/subject.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
class Subject
|
3
|
-
attr_reader :last_arg
|
4
|
-
|
5
|
-
def initialize input, *args
|
6
|
-
@args = args
|
7
|
-
@error = nil
|
8
|
-
@implemented = true
|
9
|
-
@last_arg = -1
|
10
|
-
|
11
|
-
begin
|
12
|
-
@cache_value = params.inject input do |mem, param|
|
13
|
-
@implemented = mem.respond_to? param.first, false
|
14
|
-
@last_arg = @last_arg.next
|
15
|
-
|
16
|
-
mem.__send__(*param)
|
17
|
-
end
|
18
|
-
|
19
|
-
@last_arg = @last_arg.next
|
20
|
-
rescue => @error
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def actual
|
25
|
-
if @error.nil?
|
26
|
-
@cache_value.__send__(*challenge)
|
27
|
-
else
|
28
|
-
raise @error
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def params
|
33
|
-
@args[0..-2]
|
34
|
-
end
|
35
|
-
|
36
|
-
def challenge
|
37
|
-
@args.last
|
38
|
-
end
|
39
|
-
|
40
|
-
def implemented?
|
41
|
-
@error.nil? && @implemented && @cache_value.respond_to?(challenge.first, false)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/lib/fix/version.rb
DELETED
data/spec/fix/bin/color_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
subject Proc.new {
|
4
|
-
`#{BIN_PATH} #{Pathname.new(__FILE__).join '..', '..', '..', 'support', 'examples', 'duck', 'success', 'test.rb'}`
|
5
|
-
}
|
6
|
-
|
7
|
-
its :call do
|
8
|
-
MUST match: /^......$/
|
9
|
-
end
|
10
|
-
|
11
|
-
subject Proc.new {
|
12
|
-
`#{BIN_PATH} #{Pathname.new(__FILE__).join '..', '..', '..', 'support', 'examples', 'duck', 'success', 'test.rb'} --color`
|
13
|
-
}
|
14
|
-
|
15
|
-
its :call do
|
16
|
-
MUST match: /^#{Regexp.escape("\e[32m.\e[0m" * 6)}$/
|
17
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
subject Proc.new {
|
4
|
-
`#{BIN_PATH} #{Pathname.new(__FILE__).join '..', '..', '..', 'support', 'examples', '42', 'must', 'success', 'test.rb'}`
|
5
|
-
$?
|
6
|
-
}
|
7
|
-
|
8
|
-
on :call do
|
9
|
-
its(:exitstatus) { MUST equal: 0 }
|
10
|
-
end
|
11
|
-
|
12
|
-
subject Proc.new {
|
13
|
-
`#{BIN_PATH} #{Pathname.new(__FILE__).join '..', '..', '..', 'support', 'examples', '42', 'must', 'error', 'test.rb'}`
|
14
|
-
$?
|
15
|
-
}
|
16
|
-
|
17
|
-
on :call do
|
18
|
-
its(:exitstatus) { MUST equal: 1 }
|
19
|
-
end
|
data/spec/fix/bin/help_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
subject Proc.new { `#{BIN_PATH} --help` }
|
4
|
-
|
5
|
-
its :call do
|
6
|
-
MUST match: /Usage: fix <files or directories> \[options\]/
|
7
|
-
MUST match: / --color /
|
8
|
-
MUST match: / --debug /
|
9
|
-
MUST match: / --hide_progress /
|
10
|
-
MUST match: / --seed /
|
11
|
-
MUST match: / --warnings /
|
12
|
-
MUST match: / --version /
|
13
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
subject Proc.new {
|
4
|
-
`#{BIN_PATH} #{Pathname.new(__FILE__).join '..', '..', '..', 'support', 'examples', 'duck', 'success', 'test.rb'}`
|
5
|
-
}
|
6
|
-
|
7
|
-
its :call do
|
8
|
-
MUST match: /^......$/
|
9
|
-
end
|
10
|
-
|
11
|
-
subject Proc.new {
|
12
|
-
`#{BIN_PATH} #{Pathname.new(__FILE__).join '..', '..', '..', 'support', 'examples', 'duck', 'success', 'test.rb'} --hide_progress`
|
13
|
-
}
|
14
|
-
|
15
|
-
its :call do
|
16
|
-
MUST_NOT match: /^......$/
|
17
|
-
end
|
data/spec/fix/bin/spec_helper.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require_relative File.join '..', 'spec_helper'
|
@@ -1 +0,0 @@
|
|
1
|
-
require_relative File.join '..', 'spec_helper'
|