declare 0.0.4.1 → 0.0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +38 -0
  3. data/.travis.yml +20 -0
  4. data/.yardopts +1 -0
  5. data/Gemfile +11 -0
  6. data/{LICENSE → MIT-LICENSE} +0 -0
  7. data/README.md +126 -0
  8. data/Rakefile +8 -12
  9. data/declare.gemspec +27 -0
  10. data/example/failure.rb +44 -0
  11. data/example/in_rake/Rakefile +11 -0
  12. data/example/in_rake/example.gemspec +21 -0
  13. data/example/in_rake/test/test_failure.rb +44 -0
  14. data/example/in_rake/test/test_mixed.rb +37 -0
  15. data/example/in_rake/test/test_successfull.rb +34 -0
  16. data/example/mixed.rb +37 -0
  17. data/example/successfull.rb +34 -0
  18. data/example/technote.rb +27 -0
  19. data/lib/declare.rb +9 -7
  20. data/lib/declare/{dsl/assertions.rb → assertions.rb} +65 -50
  21. data/lib/declare/autorun.rb +5 -0
  22. data/lib/declare/{dsl/callerentry.rb → callerentry.rb} +13 -4
  23. data/lib/declare/core_ext.rb +7 -0
  24. data/lib/declare/{exceptions.rb → errors.rb} +1 -2
  25. data/lib/declare/object_extension.rb +25 -0
  26. data/lib/declare/scope.rb +21 -0
  27. data/lib/declare/singleton_class.rb +91 -0
  28. data/lib/declare/version.rb +4 -2
  29. data/test/test_assertions.rb +103 -0
  30. data/test/test_behavior_exception_innner_nested_declare.rb +38 -0
  31. data/test/test_behavior_exception_outer_declare.rb +39 -0
  32. data/test/test_behavior_exception_outer_neted_declare.rb +39 -0
  33. data/test/test_behavior_mixed.rb +51 -0
  34. metadata +91 -61
  35. data/History.rdoc +0 -25
  36. data/Manifest.txt +0 -18
  37. data/README.rdoc +0 -220
  38. data/examples/fail.rb +0 -75
  39. data/examples/mixed.rb +0 -54
  40. data/examples/successfull.rb +0 -46
  41. data/examples/technote.rb +0 -33
  42. data/lib/declare/dsl/basicscope.rb +0 -39
  43. data/lib/declare/dsl/scope.rb +0 -20
  44. data/lib/declare/main.rb +0 -18
  45. data/lib/declare/singletonclass.rb +0 -72
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzY1Y2Y4YjliMDA4ODljOTE1NTg3N2QyODRkMGQ2ZDU4MTU3MzlhOQ==
5
+ data.tar.gz: !binary |-
6
+ YTIzZDJhZjZkOWYwMjBiMDY1NTgzZDFhMmQ2MjU4ZjY2NDdhMjU5OA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YTE3MjBhMTA3NDIyOTI4OWEyZjdiOWUzNzE4MzIwNzk5NmE2N2YzZDQ5Nzhh
10
+ MDczMzY3Y2ZjODAxYzk2YjE3NDIwNmMzNzA2YjQ3MzIyNjExYWVlMjYwYmM3
11
+ NjhkZmFlMjU4MTRmMzJhODE0NDA1YmNhMGRkMTJhYTgwNTRhNDg=
12
+ data.tar.gz: !binary |-
13
+ ZTQ4ODAyYzcxODc4OTBlOTgwOTkzZjQyNGVkYWE0ODAzMTY5YTQxNjNmMzFi
14
+ YTdhZjhmNmFmNWU3OGVhOWU4MjMyNzdhMDU4NTZhZmVmNGRhYmJhZmQyY2M2
15
+ MWVhMjJhNmQxYTBlY2U3MTNjZGFjNDlkYWFlNDNhOTk4ZDg1Nzk=
@@ -0,0 +1,38 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .DS_Store
6
+ .ruby-version
7
+ coverage
8
+ coverage.data
9
+ InstalledFiles
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+
18
+ # bundler
19
+ vendor/
20
+
21
+ # YARD artifacts
22
+ .yardoc
23
+ _yardoc
24
+ doc/
25
+
26
+ # tmp-old
27
+ .old
28
+
29
+ # editor
30
+ *~
31
+ .redcar
32
+
33
+ # other
34
+ *.lock
35
+ *.bak
36
+ tool/
37
+ .rbx/
38
+ *\#*
@@ -0,0 +1,20 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - ruby-head
5
+ - 2.0.0
6
+ - 1.9.3
7
+ - 1.9.2
8
+ - rbx-nightly-19mode
9
+ - jruby-head
10
+ - jruby-19mode
11
+
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: ruby-head
15
+ - rvm: rbx-nightly-19mode
16
+ - rvm: jruby-head
17
+ - rvm: jruby-19mode
18
+
19
+ before_install:
20
+ - gem install bundler
@@ -0,0 +1 @@
1
+ --readme README.md --private lib/**/*.rb
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ end
8
+
9
+ group :test do
10
+ gem 'rake'
11
+ end
File without changes
@@ -0,0 +1,126 @@
1
+ declare
2
+ =======
3
+
4
+ Description
5
+ ------------
6
+
7
+ A unit testing framework with tiny DSL.
8
+
9
+ Features
10
+ --------
11
+
12
+ * Simple syntax.
13
+ * Markdown looks Reports.
14
+ * Tiny keyboard typings :)
15
+
16
+ Usage
17
+ -----
18
+
19
+ ### Overview
20
+
21
+ Product Code
22
+
23
+ ```ruby
24
+ class Person
25
+ attr_reader :name, :birth
26
+
27
+ def initialize(name)
28
+ @name = name
29
+ @birth = Time.now
30
+ end
31
+ end
32
+ ```
33
+
34
+ Test Code
35
+
36
+ ```ruby
37
+ require 'declare/autorun'
38
+
39
+ The Person.new('John') do |john|
40
+ can :name
41
+ can :birth
42
+ is_a Person
43
+ kind_of Object
44
+
45
+ NOT 'Taro'
46
+
47
+ The john.name do |name|
48
+ kind_of String
49
+ is_a 'Taro'
50
+ ok name.kind_of?(String)
51
+ ng name.match(/[1-9]/)
52
+ end
53
+
54
+ The john.birth do
55
+ kind_of Time
56
+ end
57
+ end
58
+ ```
59
+
60
+ Report
61
+
62
+ ```markdown
63
+ Detail testing report
64
+ =====================
65
+
66
+ ### "John" ### [./example/mixed.rb:26]
67
+
68
+ * ./example/mixed.rb:28
69
+ Expected: it == other
70
+ Actual : "John" == "Taro"
71
+
72
+ ------------------------------------------------------------------------------
73
+ 3 scopes, 10 assertions, 1 failures
74
+ ```
75
+
76
+ ```bash
77
+ $ echo $? #=> 1(count of failed behaviors)
78
+ ```
79
+
80
+ ### How to use in Rake Tasks likely with test/unit
81
+
82
+ That's easy.
83
+ Replace below.
84
+
85
+ ```ruby
86
+ require 'test/unit'
87
+ ```
88
+
89
+ to
90
+
91
+ ```ruby
92
+ require 'declare/autorun'
93
+ ```
94
+
95
+ Requirements
96
+ -------------
97
+
98
+ * Ruby - [1.9.2 or later](http://travis-ci.org/#!/kachick/declare)
99
+
100
+ Install
101
+ -------
102
+
103
+ ```bash
104
+ $ gem install declare
105
+ ```
106
+
107
+ Build Status
108
+ -------------
109
+
110
+ [![Build Status](https://secure.travis-ci.org/kachick/declare.png)](http://travis-ci.org/kachick/declare)
111
+
112
+ Link
113
+ ----
114
+
115
+ * [code](https://github.com/kachick/declare)
116
+ * [API](http://kachick.github.com/declare/yard/frames.html)
117
+ * [issues](https://github.com/kachick/declare/issues)
118
+ * [CI](http://travis-ci.org/#!/kachick/declare)
119
+ * [gem](https://rubygems.org/gems/declare)
120
+
121
+ License
122
+ -------
123
+
124
+ The MIT X11 License
125
+ Copyright (c) 2012 Kenichi Kamiya
126
+ See MIT-LICENSE for further details.
data/Rakefile CHANGED
@@ -1,15 +1,11 @@
1
- gem 'hoe', '~> 3.0.8'
2
- require 'hoe'
3
- require 'fileutils'
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
4
3
 
5
- Hoe.plugin :newgem
4
+ require 'rake/testtask'
6
5
 
7
- $hoe = Hoe.spec 'declare' do
8
- developer 'Kenichi Kamiya', 'kachick1+ruby@gmail.com'
9
- self.rubyforge_name = name
10
- require_ruby_version '>= 1.9.2'
11
- dependency 'yard', '~> 0.8.2.1', :development
12
- end
6
+ task default: [:test]
13
7
 
14
- require 'newgem/tasks'
15
- Dir['tasks/**/*.rake'].each {|t|load t}
8
+ Rake::TestTask.new do |tt|
9
+ tt.verbose = true
10
+ tt.warning = true
11
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path('../lib/declare/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ # specific
5
+
6
+ gem.description = %q{A unit testing framework.}
7
+ gem.summary = gem.description.dup
8
+ gem.homepage = 'http://kachick.github.com/declare/'
9
+ gem.license = 'MIT'
10
+ gem.name = 'declare'
11
+ gem.version = Declare::VERSION.dup
12
+
13
+ gem.required_ruby_version = '>= 1.9.2'
14
+ gem.add_development_dependency 'yard', '>= 0.8.6.1', '< 2'
15
+ gem.add_development_dependency 'rake', '>= 10', '< 20'
16
+ gem.add_development_dependency 'bundler', '>= 1.3.5', '< 2'
17
+
18
+ # common
19
+
20
+ gem.authors = ['Kenichi Kamiya']
21
+ gem.email = ['kachick1+ruby@gmail.com']
22
+ gem.files = `git ls-files`.split($\)
23
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
24
+ gem.test_files = gem.files.grep(%r{^(test|spec|features|declare)/})
25
+ gem.require_paths = ['lib']
26
+
27
+ end
@@ -0,0 +1,44 @@
1
+ # coding: us-ascii
2
+ $VERBOSE = true
3
+
4
+ require_relative '../lib/declare/autorun'
5
+
6
+ The(Array) {
7
+ a Module
8
+ kind Hash
9
+ respond :to_str
10
+
11
+ The(it.new) {
12
+ a Hash
13
+ }
14
+ }
15
+
16
+ The(1) {
17
+ is 1.1
18
+ is 2
19
+ NOT 1
20
+ match 2..3
21
+ equal 1.0
22
+ kind Float
23
+ a Integer
24
+ respond :to_str
25
+
26
+ ok false
27
+ ng true
28
+
29
+ The it.succ do
30
+ is 9
31
+
32
+ The it.succ do
33
+ is 200
34
+ end
35
+ end
36
+
37
+ RESCUE SyntaxError do
38
+ raise
39
+ end
40
+
41
+ CATCH RuntimeError do
42
+ raise Exception
43
+ end
44
+ }
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+
4
+ require 'rake/testtask'
5
+
6
+ task default: [:test]
7
+
8
+ Rake::TestTask.new do |tt|
9
+ tt.verbose = true
10
+ tt.warning = true
11
+ end
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.authors = ['foo bar']
3
+ gem.email = ['foo@example.com']
4
+ gem.description = %q{:)}
5
+ gem.summary = %q{:)}
6
+ gem.homepage = 'https://github.com/kachick/declare'
7
+
8
+ gem.files = `git ls-files`.split($\)
9
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
10
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
11
+ gem.name = 'example'
12
+ gem.require_paths = ['lib']
13
+ gem.version = '0.0.1'
14
+
15
+ gem.required_ruby_version = '>= 1.9.2'
16
+
17
+ gem.add_development_dependency 'declare'
18
+ gem.add_development_dependency 'rake'
19
+ gem.add_development_dependency 'bundler'
20
+ end
21
+
@@ -0,0 +1,44 @@
1
+ # coding: us-ascii
2
+ $VERBOSE = true
3
+
4
+ require 'declare/autorun'
5
+
6
+ The(Array) {
7
+ a Module
8
+ kind Hash
9
+ respond :to_str
10
+
11
+ The(it.new) {
12
+ a Hash
13
+ }
14
+ }
15
+
16
+ The(1) {
17
+ is 1.1
18
+ is 2
19
+ NOT 1
20
+ match 2..3
21
+ equal 1.0
22
+ kind Float
23
+ a Integer
24
+ respond :to_str
25
+
26
+ ok false
27
+ ng true
28
+
29
+ The it.succ do
30
+ is 9
31
+
32
+ The it.succ do
33
+ is 200
34
+ end
35
+ end
36
+
37
+ RESCUE SyntaxError do
38
+ raise
39
+ end
40
+
41
+ CATCH RuntimeError do
42
+ raise Exception
43
+ end
44
+ }
@@ -0,0 +1,37 @@
1
+ # coding: us-ascii
2
+ $VERBOSE = true
3
+
4
+ class Person
5
+
6
+ attr_reader :name, :birth
7
+
8
+ def initialize(name)
9
+ @name = name
10
+ @birth = Time.now
11
+ end
12
+
13
+ end
14
+
15
+ require 'declare/autorun'
16
+
17
+ The Person.new('John') do |john|
18
+
19
+ can :name
20
+ can :birth
21
+ is_a Person
22
+ kind_of Object
23
+
24
+ NOT 'Taro'
25
+
26
+ The john.name do |name|
27
+ kind String
28
+ is 'Taro'
29
+ truthy name.kind_of?(String)
30
+ falthy name.match(/[1-9]/)
31
+ end
32
+
33
+ The john.birth do
34
+ kind_of Time
35
+ end
36
+
37
+ end
@@ -0,0 +1,34 @@
1
+ # coding: us-ascii
2
+ $VERBOSE = true
3
+
4
+ require 'declare/autorun'
5
+
6
+ The(Array) {
7
+
8
+ a Class
9
+ kind Module
10
+ respond :new
11
+
12
+ }
13
+
14
+ The(1) {
15
+
16
+ is 1.0
17
+ is 1.to_r
18
+ NOT 2
19
+ match 1..3
20
+ equal 1
21
+ eql 1
22
+ kind Integer
23
+ a Fixnum
24
+ respond :upto
25
+
26
+ RESCUE Exception do
27
+ raise
28
+ end
29
+
30
+ CATCH NameError do
31
+ to_str
32
+ end
33
+
34
+ }