plymouth 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,25 +3,91 @@ plymouth
3
3
 
4
4
  (C) John Mair (banisterfiend) 2012
5
5
 
6
- FIXME: _tagline_
6
+ _Start an interactive session when a test fails_
7
7
 
8
- FIXME: _description goes here_
8
+ **Warning BETA software: Please file an [issue](https://github.com/banister/plymouth) if you have any problems**
9
+
10
+ `plymouth` is a gem to automatically start a [Pry](http://pry.github.com) session when a test fails, putting you in the context of the failure.
11
+ It currently supports [Bacon](https://github.com/chneukirchen/bacon), [Minitest](https://github.com/seattlerb/minitest), and [RSpec](https://github.com/rspec/rspec).
12
+ Support for other testing libraries is (usually) trivial to add.
13
+
14
+ plymouth currently only supports **MRI 1.9.2+ (including 1.9.3)**
9
15
 
10
16
  * Install the [gem](https://rubygems.org/gems/plymouth): `gem install plymouth`
11
- * Read the [documentation](http://rdoc.info/github/banister/plymouth/master/file/README.md)
12
17
  * See the [source code](http://github.com/banister/plymouth)
18
+
19
+ **How to use:**
20
+
21
+ Simply add the following line to your test files:
22
+
23
+ `require 'plymouth'`
24
+
25
+ plymouth should auto-detect which testing library you're using, and 'just work' :)
13
26
 
14
- Example: Example description
27
+
28
+ Example: Intercept a failing test in RSpec
15
29
  --------
16
30
 
17
- Example preamble
31
+ Inside the test file:
32
+
33
+ ```ruby
34
+ require 'plymouth'
35
+
36
+ describe Array do
37
+ before do
38
+ @array = [1]
39
+ end
40
+
41
+ it 'should be empty' do
42
+ @array.empty?.should == true
43
+ end
44
+ end
45
+ ```
46
+
47
+ And here is the result of running the above test with the `rspec` executable:
48
+
49
+ ```ruby
50
+ Frame number: 0/14
51
+ Frame type: block
52
+
53
+ From: /Users/john/ruby/play/rspec_intercept.rb @ line 9:
54
+
55
+ 4: before do
56
+ 5: @array = [1]
57
+ 6: end
58
+ 7:
59
+ 8: it 'should be empty' do
60
+ => 9: @array.empty?.should == true
61
+ 10: end
62
+ 11: end
63
+
64
+ [1] (pry) #<RSpec::Core::ExampleGroup::Nested_1>: 0> @array.size
65
+ => 1
66
+ [2] (pry) #<RSpec::Core::ExampleGroup::Nested_1>: 0> ^D
67
+ F
68
+
69
+ Failures:
70
+
71
+ 1) Array should be empty
72
+ Failure/Error: @array.empty?.should == true
73
+ expected: true
74
+ got: false (using ==)
75
+ # ./rspec_intercept.rb:9:in `block (2 levels) in <top (required)>'
76
+
77
+ Finished in 7.74 seconds
78
+ 1 example, 1 failure
79
+
80
+ Failed examples:
18
81
 
19
- puts "example code"
82
+ rspec ./rspec_intercept.rb:8 # Array should be empty
83
+ ```
20
84
 
21
- Features and limitations
85
+ Limitations
22
86
  -------------------------
23
87
 
24
- Feature List Preamble
88
+ * Occasional segfault on 1.9.3 (seems to work fine on 1.9.2). Please [report](https://github.com/banister/plymouth) all segfaults with a full backtrace!
89
+ * Only supports MRI.
90
+ * Currently limited to just Bacon, RSpec and Minitest. Support for more testing libraries will be added in the future.
25
91
 
26
92
  Contact
27
93
  -------
data/Rakefile CHANGED
@@ -1,75 +1,85 @@
1
- $:.unshift 'lib'
2
-
3
- PROJECT_NAME = "plymouth"
4
-
5
- require "#{PROJECT_NAME}/version"
6
-
7
- CLASS_NAME = Plymouth
8
-
9
- require 'rake/clean'
10
- require 'rake/gempackagetask'
11
-
12
- CLOBBER.include("**/*~", "**/*#*", "**/*.log", "**/*.o")
13
- CLEAN.include("ext/**/*.log", "ext/**/*.o",
14
- "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "**/*#*", "**/*#*.*",
15
- "ext/**/*.def", "ext/**/*.pdb", "**/*_flymake*.*", "**/*_flymake")
16
-
17
- def apply_spec_defaults(s)
18
- s.name = PROJECT_NAME
19
- s.summary = "FIX ME"
20
- s.version = CLASS_NAME::VERSION
21
- s.date = Time.now.strftime '%Y-%m-%d'
22
- s.author = "John Mair (banisterfiend)"
23
- s.email = 'jrmair@gmail.com'
24
- s.description = s.summary
25
- s.require_path = 'lib'
26
- s.add_development_dependency("bacon","~>1.1.0")
27
- s.homepage = "http://github.com/banister/#{PROJECT_NAME}"
28
- s.has_rdoc = 'yard'
29
- s.add_dependency('pry-exception_explorer')
30
- s.files = `git ls-files`.split("\n")
31
- s.test_files = `git ls-files -- test/*`.split("\n")
32
- end
33
-
34
- desc "Run tests"
35
- task :test do
36
- sh "bacon -Itest -rubygems test.rb -q"
37
- end
38
-
39
- namespace :ruby do
40
- spec = Gem::Specification.new do |s|
41
- apply_spec_defaults(s)
42
- s.platform = Gem::Platform::RUBY
43
- end
44
-
45
- Rake::GemPackageTask.new(spec) do |pkg|
46
- pkg.need_zip = false
47
- pkg.need_tar = false
48
- end
49
- end
50
-
51
- desc "Show version"
52
- task :version do
53
- puts "Plymouth version: #{Plymouth::VERSION}"
54
- end
55
-
56
- desc "Generate gemspec file"
57
- task :gemspec => "ruby:gemspec"
58
-
59
- desc "build all platform gems at once"
60
- task :gems => [:clean, :rmgems, "ruby:gem"]
61
-
62
- task :gem => [:gems]
63
-
64
- desc "remove all platform gems"
65
- task :rmgems => ["ruby:clobber_package"]
66
-
67
- desc "build and push latest gems"
68
- task :pushgems => :gems do
69
- chdir("./pkg") do
70
- Dir["*.gem"].each do |gemfile|
71
- sh "gem push #{gemfile}"
72
- end
73
- end
74
- end
75
-
1
+ $:.unshift 'lib'
2
+
3
+ PROJECT_NAME = "plymouth"
4
+
5
+ require "#{PROJECT_NAME}/version"
6
+
7
+ CLASS_NAME = Plymouth
8
+
9
+ require 'rake/clean'
10
+ require 'rake/gempackagetask'
11
+
12
+ CLOBBER.include("**/*~", "**/*#*", "**/*.log", "**/*.o")
13
+ CLEAN.include("ext/**/*.log", "ext/**/*.o",
14
+ "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "**/*#*", "**/*#*.*",
15
+ "ext/**/*.def", "ext/**/*.pdb", "**/*_flymake*.*", "**/*_flymake")
16
+
17
+ def apply_spec_defaults(s)
18
+ s.name = PROJECT_NAME
19
+ s.summary = "FIX ME"
20
+ s.version = CLASS_NAME::VERSION
21
+ s.date = Time.now.strftime '%Y-%m-%d'
22
+ s.author = "John Mair (banisterfiend)"
23
+ s.email = 'jrmair@gmail.com'
24
+ s.description = s.summary
25
+ s.require_path = 'lib'
26
+ s.add_development_dependency("bacon","~>1.1.0")
27
+ s.homepage = "http://github.com/banister/#{PROJECT_NAME}"
28
+ s.has_rdoc = 'yard'
29
+ s.add_dependency('pry-exception_explorer')
30
+ s.files = `git ls-files`.split("\n")
31
+ s.test_files = `git ls-files -- test/*`.split("\n")
32
+ end
33
+
34
+ desc "Run tests"
35
+ task :test do
36
+ sh "bacon -Itest -rubygems test.rb -q"
37
+ end
38
+
39
+ desc "generate gemspec"
40
+ task :gemspec => "ruby:gemspec"
41
+
42
+ namespace :ruby do
43
+ spec = Gem::Specification.new do |s|
44
+ apply_spec_defaults(s)
45
+ s.platform = Gem::Platform::RUBY
46
+ end
47
+
48
+ Rake::GemPackageTask.new(spec) do |pkg|
49
+ pkg.need_zip = false
50
+ pkg.need_tar = false
51
+ end
52
+
53
+ desc "Generate gemspec file"
54
+ task :gemspec do
55
+ File.open("#{spec.name}.gemspec", "w") do |f|
56
+ f << spec.to_ruby
57
+ end
58
+ end
59
+ end
60
+
61
+ desc "Show version"
62
+ task :version do
63
+ puts "Plymouth version: #{Plymouth::VERSION}"
64
+ end
65
+
66
+ desc "Generate gemspec file"
67
+ task :gemspec => "ruby:gemspec"
68
+
69
+ desc "build all platform gems at once"
70
+ task :gems => [:clean, :rmgems, "ruby:gem"]
71
+
72
+ task :gem => [:gems]
73
+
74
+ desc "remove all platform gems"
75
+ task :rmgems => ["ruby:clobber_package"]
76
+
77
+ desc "build and push latest gems"
78
+ task :pushgems => :gems do
79
+ chdir("./pkg") do
80
+ Dir["*.gem"].each do |gemfile|
81
+ sh "gem push #{gemfile}"
82
+ end
83
+ end
84
+ end
85
+
@@ -1,3 +1,3 @@
1
1
  module Plymouth
2
- VERSION = "0.1.0"
3
- end
2
+ VERSION = "0.1.1"
3
+ end
data/lib/plymouth.rb CHANGED
@@ -8,7 +8,9 @@ EE.enabled = true
8
8
 
9
9
  if defined?(Bacon)
10
10
 
11
- EE.intercept(Bacon::Error).skip_until { |frame| frame.klass == Bacon::Context }
11
+ EE.intercept do |frame, ex|
12
+ ex.is_a?(Bacon::Error) && frame.method_name != :run_requirement
13
+ end.skip_until { |frame| frame.klass == Bacon::Context }
12
14
 
13
15
  elsif defined?(RSpec)
14
16
 
data/plymouth.gemspec ADDED
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "plymouth"
5
+ s.version = "0.1.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["John Mair (banisterfiend)"]
9
+ s.date = "2012-02-08"
10
+ s.description = "FIX ME"
11
+ s.email = "jrmair@gmail.com"
12
+ s.files = [".gemtest", ".gitignore", ".yardopts", "CHANGELOG", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/plymouth.rb", "lib/plymouth/version.rb", "plymouth.gemspec", "test/test.rb"]
13
+ s.homepage = "http://github.com/banister/plymouth"
14
+ s.require_paths = ["lib"]
15
+ s.rubygems_version = "1.8.11"
16
+ s.summary = "FIX ME"
17
+ s.test_files = ["test/test.rb"]
18
+
19
+ if s.respond_to? :specification_version then
20
+ s.specification_version = 3
21
+
22
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
23
+ s.add_development_dependency(%q<bacon>, ["~> 1.1.0"])
24
+ s.add_runtime_dependency(%q<pry-exception_explorer>, [">= 0"])
25
+ else
26
+ s.add_dependency(%q<bacon>, ["~> 1.1.0"])
27
+ s.add_dependency(%q<pry-exception_explorer>, [">= 0"])
28
+ end
29
+ else
30
+ s.add_dependency(%q<bacon>, ["~> 1.1.0"])
31
+ s.add_dependency(%q<pry-exception_explorer>, [">= 0"])
32
+ end
33
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: plymouth
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Mair (banisterfiend)
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-02-03 00:00:00 Z
13
+ date: 2012-02-08 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bacon
@@ -53,6 +53,7 @@ files:
53
53
  - Rakefile
54
54
  - lib/plymouth.rb
55
55
  - lib/plymouth/version.rb
56
+ - plymouth.gemspec
56
57
  - test/test.rb
57
58
  homepage: http://github.com/banister/plymouth
58
59
  licenses: []