fix 0.0.1.pre → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +4 -2
- data/README.md +81 -49
- data/Rakefile +17 -0
- data/VERSION.semver +1 -1
- data/example/duck/README.md +9 -0
- data/example/duck/app.rb +3 -0
- data/example/duck/lib.rb +14 -0
- data/example/duck/spec.rb +31 -0
- data/example/duck/test.rb +6 -0
- data/fix.gemspec +10 -6
- data/lib/fix.rb +3 -17
- data/lib/fix/dsl.rb +10 -0
- data/lib/fix/expectation.rb +48 -0
- data/lib/fix/expectation_high.rb +26 -0
- data/lib/fix/expectation_low.rb +44 -0
- data/lib/fix/expectation_medium.rb +29 -0
- data/lib/fix/expectation_set.rb +8 -0
- data/lib/fix/helper/it_helper.rb +12 -0
- data/lib/fix/helper/its_helper.rb +12 -0
- data/lib/fix/helper/let_accessor_helper.rb +11 -0
- data/lib/fix/helper/let_reader_helper.rb +9 -0
- data/lib/fix/helper/let_writer_helper.rb +13 -0
- data/lib/fix/helper/on_helper.rb +12 -0
- data/lib/fix/helper/requirement_helper.rb +44 -0
- data/lib/fix/it.rb +14 -0
- data/lib/fix/its.rb +14 -0
- data/lib/fix/on.rb +20 -0
- data/lib/fix/spec.rb +16 -10
- data/lib/fix/subject.rb +43 -10
- data/lib/fix/test.rb +114 -0
- data/lib/fix/version.rb +9 -0
- data/spec/TODO +0 -0
- data/spec/spec_helper.rb +2 -4
- data/spec/support.rb +3 -0
- data/spec/support/coverage.rb +3 -0
- data/spec/support/env.rb +4 -0
- data/spec/support/presenter.rb +0 -0
- metadata +85 -22
- data/.ruby-version +0 -1
- data/bin/fix +0 -58
- data/lib/fix/base_matcher.rb +0 -38
- data/lib/fix/call.rb +0 -16
- data/lib/fix/constant.rb +0 -37
- data/lib/fix/expectation_target.rb +0 -41
- data/lib/fix/helper.rb +0 -34
- data/lib/fix/scope.rb +0 -20
- data/logo.png +0 -0
- data/logo.svg +0 -19
- data/spec/subject_spec.rb +0 -5
data/spec/TODO
ADDED
File without changes
|
data/spec/spec_helper.rb
CHANGED
data/spec/support.rb
ADDED
data/spec/support/env.rb
ADDED
File without changes
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Wack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: spectus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0.pre
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0.pre
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,38 +52,83 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '10.0'
|
41
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.7'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.7'
|
83
|
+
description: A specing framework for Ruby.
|
42
84
|
email:
|
43
85
|
- cyril@sashite.com
|
44
|
-
executables:
|
45
|
-
- fix
|
86
|
+
executables: []
|
46
87
|
extensions: []
|
47
88
|
extra_rdoc_files: []
|
48
89
|
files:
|
90
|
+
- ".coveralls.yml"
|
49
91
|
- ".gitignore"
|
50
|
-
- ".ruby-version"
|
51
92
|
- ".travis.yml"
|
52
93
|
- Gemfile
|
53
94
|
- LICENSE.md
|
54
95
|
- README.md
|
55
96
|
- Rakefile
|
56
97
|
- VERSION.semver
|
57
|
-
-
|
98
|
+
- example/duck/README.md
|
99
|
+
- example/duck/app.rb
|
100
|
+
- example/duck/lib.rb
|
101
|
+
- example/duck/spec.rb
|
102
|
+
- example/duck/test.rb
|
58
103
|
- fix.gemspec
|
59
104
|
- lib/fix.rb
|
60
|
-
- lib/fix/
|
61
|
-
- lib/fix/
|
62
|
-
- lib/fix/
|
63
|
-
- lib/fix/
|
64
|
-
- lib/fix/
|
65
|
-
- lib/fix/
|
105
|
+
- lib/fix/dsl.rb
|
106
|
+
- lib/fix/expectation.rb
|
107
|
+
- lib/fix/expectation_high.rb
|
108
|
+
- lib/fix/expectation_low.rb
|
109
|
+
- lib/fix/expectation_medium.rb
|
110
|
+
- lib/fix/expectation_set.rb
|
111
|
+
- lib/fix/helper/it_helper.rb
|
112
|
+
- lib/fix/helper/its_helper.rb
|
113
|
+
- lib/fix/helper/let_accessor_helper.rb
|
114
|
+
- lib/fix/helper/let_reader_helper.rb
|
115
|
+
- lib/fix/helper/let_writer_helper.rb
|
116
|
+
- lib/fix/helper/on_helper.rb
|
117
|
+
- lib/fix/helper/requirement_helper.rb
|
118
|
+
- lib/fix/it.rb
|
119
|
+
- lib/fix/its.rb
|
120
|
+
- lib/fix/on.rb
|
66
121
|
- lib/fix/spec.rb
|
67
122
|
- lib/fix/subject.rb
|
68
|
-
-
|
69
|
-
-
|
123
|
+
- lib/fix/test.rb
|
124
|
+
- lib/fix/version.rb
|
125
|
+
- spec/TODO
|
70
126
|
- spec/spec_helper.rb
|
71
|
-
- spec/
|
72
|
-
|
127
|
+
- spec/support.rb
|
128
|
+
- spec/support/coverage.rb
|
129
|
+
- spec/support/env.rb
|
130
|
+
- spec/support/presenter.rb
|
131
|
+
homepage: http://fixrb.org/
|
73
132
|
licenses:
|
74
133
|
- MIT
|
75
134
|
metadata: {}
|
@@ -81,19 +140,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
140
|
requirements:
|
82
141
|
- - ">="
|
83
142
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
143
|
+
version: 2.0.0
|
85
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
145
|
requirements:
|
87
|
-
- - "
|
146
|
+
- - ">="
|
88
147
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
148
|
+
version: '0'
|
90
149
|
requirements: []
|
91
150
|
rubyforge_project:
|
92
151
|
rubygems_version: 2.2.2
|
93
152
|
signing_key:
|
94
153
|
specification_version: 4
|
95
|
-
summary:
|
154
|
+
summary: Specing framework.
|
96
155
|
test_files:
|
156
|
+
- spec/TODO
|
97
157
|
- spec/spec_helper.rb
|
98
|
-
- spec/
|
158
|
+
- spec/support.rb
|
159
|
+
- spec/support/coverage.rb
|
160
|
+
- spec/support/env.rb
|
161
|
+
- spec/support/presenter.rb
|
99
162
|
has_rdoc:
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.2
|
data/bin/fix
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
START_TIME = Time.now
|
4
|
-
|
5
|
-
require_relative File.join %w(.. lib fix)
|
6
|
-
|
7
|
-
include Fix
|
8
|
-
|
9
|
-
absolute_paths = Set.new
|
10
|
-
|
11
|
-
unless ARGV.any?
|
12
|
-
ARGV.concat %w(spec test).select {|s|
|
13
|
-
Dir.exist? File.join(__FILE__, '..', '..', s)
|
14
|
-
}.map {|s| File.absolute_path(File.join(__FILE__, '..', '..', s)) }
|
15
|
-
end
|
16
|
-
|
17
|
-
ARGV.map! do |s|
|
18
|
-
s = File.absolute_path(s) unless s.start_with?('/')
|
19
|
-
s
|
20
|
-
end
|
21
|
-
|
22
|
-
ARGV.map do |s|
|
23
|
-
if File.directory? s
|
24
|
-
spec_files = File.join(s, '**', '*_spec.rb')
|
25
|
-
Dir.glob(spec_files).each do |spec_file|
|
26
|
-
absolute_paths.add spec_file
|
27
|
-
end
|
28
|
-
else
|
29
|
-
absolute_paths.add s
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
unless absolute_paths.any?
|
34
|
-
puts 'Sorry, specs not found.'
|
35
|
-
exit
|
36
|
-
end
|
37
|
-
|
38
|
-
examples = nil
|
39
|
-
failures = nil
|
40
|
-
|
41
|
-
absolute_paths.each do |absolute_path|
|
42
|
-
puts absolute_path
|
43
|
-
require absolute_path
|
44
|
-
|
45
|
-
examples = Fix.run
|
46
|
-
examples.each {|example| print example.to_s }
|
47
|
-
puts
|
48
|
-
|
49
|
-
failures = examples.reject {|example| example.valid? }
|
50
|
-
failures.each do |failure|
|
51
|
-
puts failure.backtrace
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
TIME_TAKEN = Time.now - START_TIME
|
56
|
-
|
57
|
-
puts "Finished in #{TIME_TAKEN} seconds"
|
58
|
-
puts "#{examples.length} examples, #{failures.length} failures"
|
data/lib/fix/base_matcher.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
class BaseMatcher
|
3
|
-
def initialize expected
|
4
|
-
@expected = expected
|
5
|
-
end
|
6
|
-
|
7
|
-
def matches? actual
|
8
|
-
match? @expected, actual
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class Equal < BaseMatcher
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def match? expected, actual
|
17
|
-
actual.equal? expected
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class Eql < BaseMatcher
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def match? expected, actual
|
26
|
-
actual.eql? expected
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class Match < BaseMatcher
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def match? expected, actual
|
35
|
-
!actual.match(expected).nil?
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/fix/call.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
class Call < BasicObject
|
3
|
-
include Helper::CallHelper
|
4
|
-
include Helper::ScopeHelper
|
5
|
-
include Helper::FooHelper
|
6
|
-
|
7
|
-
def initialize subject, method_with_args
|
8
|
-
@subject = subject
|
9
|
-
@method_with_args = method_with_args
|
10
|
-
end
|
11
|
-
|
12
|
-
def subject
|
13
|
-
Subject.new @subject.object.__send__(*@method_with_args), @subject.examples
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/fix/constant.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
class Constant < BasicObject
|
3
|
-
include Helper::CallHelper
|
4
|
-
include Helper::ScopeHelper
|
5
|
-
include Helper::FooHelper
|
6
|
-
|
7
|
-
def initialize const, examples
|
8
|
-
@const = const
|
9
|
-
@subject = Subject.new @const, examples
|
10
|
-
end
|
11
|
-
|
12
|
-
def constant *syms, &block
|
13
|
-
const = syms.inject(@const) do |base, const|
|
14
|
-
base.const_get(const)
|
15
|
-
end
|
16
|
-
|
17
|
-
@constant = Constant.new const, @subject.examples
|
18
|
-
@constant.instance_exec &block if block
|
19
|
-
end
|
20
|
-
|
21
|
-
def subject &block
|
22
|
-
if block
|
23
|
-
update_subject_with @subject.instance_exec &block
|
24
|
-
end
|
25
|
-
|
26
|
-
@subject
|
27
|
-
end
|
28
|
-
|
29
|
-
def update_subject_with obj
|
30
|
-
@subject = Subject.new obj, @subject.examples
|
31
|
-
end
|
32
|
-
|
33
|
-
def should *args
|
34
|
-
@subject.should *args
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
class ExpectationTarget
|
3
|
-
attr_reader :backtrace
|
4
|
-
|
5
|
-
def initialize value
|
6
|
-
@actual = value
|
7
|
-
end
|
8
|
-
|
9
|
-
def to matcher
|
10
|
-
unless matcher.matches?(@actual)
|
11
|
-
@backtrace = "matcher: #{matcher.inspect}, actual: #{@actual}"
|
12
|
-
end
|
13
|
-
|
14
|
-
self
|
15
|
-
end
|
16
|
-
|
17
|
-
def not_to matcher
|
18
|
-
unless !matcher.matches?(@actual)
|
19
|
-
@backtrace = "matcher: !#{matcher}, actual: #{@actual}"
|
20
|
-
end
|
21
|
-
|
22
|
-
self
|
23
|
-
end
|
24
|
-
|
25
|
-
def valid?
|
26
|
-
@backtrace.nil?
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_s
|
30
|
-
case valid?
|
31
|
-
|
32
|
-
when true
|
33
|
-
'.'
|
34
|
-
when false
|
35
|
-
'F'
|
36
|
-
else
|
37
|
-
'?'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/lib/fix/helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
module Helper
|
3
|
-
module FooHelper
|
4
|
-
def equal expected
|
5
|
-
Equal.new expected
|
6
|
-
end
|
7
|
-
|
8
|
-
def eql expected
|
9
|
-
Eql.new expected
|
10
|
-
end
|
11
|
-
|
12
|
-
def match expected
|
13
|
-
Match.new expected
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module CallHelper
|
18
|
-
def call *args, &block
|
19
|
-
@call = Call.new subject, args
|
20
|
-
@call.instance_exec &block
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
module ScopeHelper
|
25
|
-
def scope desc = nil, &block
|
26
|
-
@scope = Scope.new subject, desc
|
27
|
-
@scope.instance_exec &block
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
require_relative 'call'
|
34
|
-
require_relative 'scope'
|
data/lib/fix/scope.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Fix
|
2
|
-
class Scope < BasicObject
|
3
|
-
include Helper::CallHelper
|
4
|
-
include Helper::ScopeHelper
|
5
|
-
include Helper::FooHelper
|
6
|
-
|
7
|
-
def initialize subject, desc
|
8
|
-
@subject = subject
|
9
|
-
@desc = desc
|
10
|
-
end
|
11
|
-
|
12
|
-
def subject &block
|
13
|
-
if block
|
14
|
-
@subject = Subject.new @subject.instance_exec(&block), @subject.examples
|
15
|
-
end
|
16
|
-
|
17
|
-
@subject
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|