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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.travis.yml +4 -2
  4. data/README.md +81 -49
  5. data/Rakefile +17 -0
  6. data/VERSION.semver +1 -1
  7. data/example/duck/README.md +9 -0
  8. data/example/duck/app.rb +3 -0
  9. data/example/duck/lib.rb +14 -0
  10. data/example/duck/spec.rb +31 -0
  11. data/example/duck/test.rb +6 -0
  12. data/fix.gemspec +10 -6
  13. data/lib/fix.rb +3 -17
  14. data/lib/fix/dsl.rb +10 -0
  15. data/lib/fix/expectation.rb +48 -0
  16. data/lib/fix/expectation_high.rb +26 -0
  17. data/lib/fix/expectation_low.rb +44 -0
  18. data/lib/fix/expectation_medium.rb +29 -0
  19. data/lib/fix/expectation_set.rb +8 -0
  20. data/lib/fix/helper/it_helper.rb +12 -0
  21. data/lib/fix/helper/its_helper.rb +12 -0
  22. data/lib/fix/helper/let_accessor_helper.rb +11 -0
  23. data/lib/fix/helper/let_reader_helper.rb +9 -0
  24. data/lib/fix/helper/let_writer_helper.rb +13 -0
  25. data/lib/fix/helper/on_helper.rb +12 -0
  26. data/lib/fix/helper/requirement_helper.rb +44 -0
  27. data/lib/fix/it.rb +14 -0
  28. data/lib/fix/its.rb +14 -0
  29. data/lib/fix/on.rb +20 -0
  30. data/lib/fix/spec.rb +16 -10
  31. data/lib/fix/subject.rb +43 -10
  32. data/lib/fix/test.rb +114 -0
  33. data/lib/fix/version.rb +9 -0
  34. data/spec/TODO +0 -0
  35. data/spec/spec_helper.rb +2 -4
  36. data/spec/support.rb +3 -0
  37. data/spec/support/coverage.rb +3 -0
  38. data/spec/support/env.rb +4 -0
  39. data/spec/support/presenter.rb +0 -0
  40. metadata +85 -22
  41. data/.ruby-version +0 -1
  42. data/bin/fix +0 -58
  43. data/lib/fix/base_matcher.rb +0 -38
  44. data/lib/fix/call.rb +0 -16
  45. data/lib/fix/constant.rb +0 -37
  46. data/lib/fix/expectation_target.rb +0 -41
  47. data/lib/fix/helper.rb +0 -34
  48. data/lib/fix/scope.rb +0 -20
  49. data/logo.png +0 -0
  50. data/logo.svg +0 -19
  51. data/spec/subject_spec.rb +0 -5
data/spec/TODO ADDED
File without changes
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,3 @@
1
- require_relative File.join %w(.. lib fix)
1
+ require_relative 'support'
2
2
 
3
- Dir[
4
- File.join %w(spec support ** *.rb)
5
- ].each { |f| require File.expand_path(f) }
3
+ require_relative File.join '..', 'lib', 'fix'
data/spec/support.rb ADDED
@@ -0,0 +1,3 @@
1
+ Dir[File.join File.dirname(__FILE__), 'support', '**' '*.rb'].each do |filename|
2
+ require_relative filename
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'coveralls'
2
+
3
+ Coveralls.wear!
@@ -0,0 +1,4 @@
1
+ if RUBY_VERSION < '2.0.0'
2
+ warn "Needs Ruby 2.0.0, you're running: #{RUBY_VERSION}"
3
+ exit 1
4
+ end
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.0.1.pre
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-08-26 00:00:00.000000000 Z
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
- description: Minimal and fast BDD framework for Ruby.
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
- - bin/fix
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/base_matcher.rb
61
- - lib/fix/call.rb
62
- - lib/fix/constant.rb
63
- - lib/fix/expectation_target.rb
64
- - lib/fix/helper.rb
65
- - lib/fix/scope.rb
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
- - logo.png
69
- - logo.svg
123
+ - lib/fix/test.rb
124
+ - lib/fix/version.rb
125
+ - spec/TODO
70
126
  - spec/spec_helper.rb
71
- - spec/subject_spec.rb
72
- homepage: https://github.com/cyril/fix.rb
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: '0'
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: 1.3.1
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: Fix and keep the green code.
154
+ summary: Specing framework.
96
155
  test_files:
156
+ - spec/TODO
97
157
  - spec/spec_helper.rb
98
- - spec/subject_spec.rb
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"
@@ -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