rspec-todo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5dd31131ee403a76e605cecfedcc10fabc021471
4
+ data.tar.gz: fcb29ec1bf71a68d1c8fe6cec08330e62dec6bd4
5
+ SHA512:
6
+ metadata.gz: ae826bd4f4c505688ae5e4a86749dcc62768c81ca70d1405f2b789013c7028f0b4799b31ed8eb6142740440d314363e8f79a3350819c8576891408293ce28f2f
7
+ data.tar.gz: a5ecad56e6c3e04d4cc3f1390f185067b158881a8882e849a28375bf32cde62f3171b0df4c80380edccac12c568941b4ccebeb3722bfe5d90e1439b520715b1b
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ rspec-todo
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ default
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec-todo.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 okitan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Rspec::Todo [![Build Status](https://travis-ci.org/okitan/rspec-todo.png?branch=master)](https://travis-ci.org/okitan/rspec-todo)
2
+
3
+ todo: pending if failed
4
+ not_todo: result errors if passed
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'rspec-todo'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install rspec-todo
19
+
20
+ ## Usage
21
+
22
+ ```ruby
23
+ require "rspec/todo"
24
+
25
+ describe "rspec-todo" do
26
+ include ::RSpec::Todo
27
+
28
+ it "todo results pending if failed" do
29
+ todo {
30
+ # your test code which may fail and will fix later
31
+ }
32
+ end
33
+
34
+ it "not_todo report error when test passed" do
35
+ not_todo {
36
+ # your test code which is not correct but cannot fix for some reason
37
+ # (e.g. released with the bug and user have already integrated system using the bug)
38
+ }
39
+ end
40
+ end
41
+ ```
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core'
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = FileList['spec/**/*_spec.rb']
7
+ end
8
+
9
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/lib/rspec/todo.rb ADDED
@@ -0,0 +1,37 @@
1
+ module RSpec
2
+ module Todo
3
+ def todo(reason = nil, &block)
4
+ if block_given?
5
+ begin
6
+ yield
7
+ rescue => e
8
+ if reason
9
+ pending(reason)
10
+ else
11
+ pending(e.inspect)
12
+ end
13
+ end
14
+ else
15
+ pending(reason)
16
+ end
17
+ end
18
+
19
+ def not_todo(reason = nil, *errors_expected, &block)
20
+ if block_given?
21
+ begin
22
+ yield
23
+ rescue RSpec::Expectations::ExpectationNotMetError, *errors_expected => e
24
+ # do nothing
25
+ else
26
+ if reason
27
+ raise(reason)
28
+ else
29
+ raise "not todo but passed"
30
+ end
31
+ end
32
+ else
33
+ pending(reason)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "rspec-todo"
5
+ spec.version = File.read(File.expand_path("VERSION", File.dirname(__FILE__))).chomp
6
+ spec.authors = ["okitan"]
7
+ spec.email = ["okitakunio@gmail.com"]
8
+ spec.description = "todo: pending if failed"
9
+ spec.summary = "todo: pending if failed"
10
+ spec.homepage = "https://github.com/okitan/rspec-todo"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_runtime_dependency "rspec"
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+
23
+ # debug
24
+ spec.add_development_dependency "pry"
25
+ spec.add_development_dependency "tapp"
26
+ end
@@ -0,0 +1,45 @@
1
+ require "spec_helper"
2
+
3
+ describe "rspec-todo" do
4
+ context "todo" do
5
+ context "with description" do
6
+ it "becomes pending if failed" do
7
+ todo("will raise hoge") { raise "hoge" }
8
+ end
9
+ end
10
+
11
+ context "without description" do
12
+ it "passes" do
13
+ todo { true }
14
+ end
15
+
16
+ it "becomes pending if failed" do
17
+ todo { raise "hoge" }
18
+ end
19
+ end
20
+ end
21
+
22
+ context "not todo" do
23
+ it "result error if successed" do
24
+ expect {
25
+ not_todo { true }
26
+ }.to raise_exception
27
+ end
28
+
29
+ it "results nothing when expectation not matched" do
30
+ not_todo { 1.should == 2 }
31
+ end
32
+
33
+ it "results nothing when specified error occured" do
34
+ not_todo("runtime error occured", RuntimeError) do
35
+ raise
36
+ end
37
+ end
38
+
39
+ it "results error if runtime error occured" do
40
+ expect {
41
+ not_todo { raise }
42
+ }.to raise_exception
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,17 @@
1
+ require "bundler/setup"
2
+
3
+ require "rspec/todo"
4
+
5
+ RSpec.configure do |config|
6
+ config.treat_symbols_as_metadata_keys_with_true_values = true
7
+ config.run_all_when_everything_filtered = true
8
+ config.filter_run :focus
9
+
10
+ # Run specs in random order to surface order dependencies. If you find an
11
+ # order dependency and want to debug it, you can fix the order by providing
12
+ # the seed, which is printed after each run.
13
+ # --seed 1234
14
+ config.order = 'random'
15
+
16
+ include ::RSpec::Todo
17
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-todo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - okitan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: tapp
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: 'todo: pending if failed'
84
+ email:
85
+ - okitakunio@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - .ruby-gemset
92
+ - .ruby-version
93
+ - .travis.yml
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - VERSION
99
+ - lib/rspec/todo.rb
100
+ - rspec-todo.gemspec
101
+ - spec/rspec/todo_spec.rb
102
+ - spec/spec_helper.rb
103
+ homepage: https://github.com/okitan/rspec-todo
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.0.3
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: 'todo: pending if failed'
127
+ test_files:
128
+ - spec/rspec/todo_spec.rb
129
+ - spec/spec_helper.rb