bmabey-clispec 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Ben Mabey
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,6 @@
1
+ = CliSpec
2
+ This is a work-in-progress gem.. I'm slowly extracting various helpers that I have used on many projects where I had to test CLI tools.
3
+
4
+ == Copyright
5
+
6
+ Copyright (c) 2009 Ben Mabey. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "clispec"
8
+ gem.summary = %Q{Helpers for testing CLI tools with Cucumber and RSpec}
9
+ gem.description = %Q{Step defs, world helpers, etc. for testing CLI tools with Cucumber. Custom example group to help test CLI tools in RSpec.}
10
+ gem.email = "ben@benmabey.com"
11
+ gem.homepage = "http://github.com/bmabey/clispec"
12
+ gem.authors = ["Ben Mabey"]
13
+ gem.add_development_dependency "rspec"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
20
+ require 'spec/rake/spectask'
21
+ Spec::Rake::SpecTask.new(:spec) do |spec|
22
+ spec.libs << 'lib' << 'spec'
23
+ spec.spec_files = FileList['spec/**/*_spec.rb']
24
+ end
25
+
26
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
27
+ spec.libs << 'lib' << 'spec'
28
+ spec.pattern = 'spec/**/*_spec.rb'
29
+ spec.rcov = true
30
+ end
31
+
32
+ task :spec => :check_dependencies
33
+
34
+ task :default => :spec
35
+
36
+ require 'rake/rdoctask'
37
+ Rake::RDocTask.new do |rdoc|
38
+ if File.exist?('VERSION')
39
+ version = File.read('VERSION')
40
+ else
41
+ version = ""
42
+ end
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "clispec #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
data/clispec.gemspec ADDED
@@ -0,0 +1,54 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{clispec}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ben Mabey"]
12
+ s.date = %q{2009-09-01}
13
+ s.description = %q{Step defs, world helpers, etc. for testing CLI tools with Cucumber. Custom example group to help test CLI tools in RSpec.}
14
+ s.email = %q{ben@benmabey.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "clispec.gemspec",
27
+ "lib/clispec.rb",
28
+ "lib/clispec/example_groups/runner.rb",
29
+ "spec/clispec_spec.rb",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/bmabey/clispec}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.3}
36
+ s.summary = %q{Helpers for testing CLI tools with Cucumber and RSpec}
37
+ s.test_files = [
38
+ "spec/clispec_spec.rb",
39
+ "spec/spec_helper.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ s.add_development_dependency(%q<rspec>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<rspec>, [">= 0"])
50
+ end
51
+ else
52
+ s.add_dependency(%q<rspec>, [">= 0"])
53
+ end
54
+ end
data/lib/clispec.rb ADDED
@@ -0,0 +1 @@
1
+ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), 'clispec'))) unless $LOAD_PATH.include?(File.expand_path(File.join(File.dirname(__FILE__), 'clispec')))
@@ -0,0 +1,63 @@
1
+ class RunnerExampleGroup < Spec::Example::ExampleGroup
2
+ Spec::Example::ExampleGroupFactory.register(:runner, self)
3
+
4
+ def self.stub_exit!
5
+ before(:each) do
6
+ Kernel.stub!(:exit)
7
+ end
8
+ end
9
+
10
+
11
+ def self.it_exits(message, expected_status_code, options)
12
+ it "exits #{message}" do
13
+ Kernel.should_receive(:exit).with(expected_status_code)
14
+ run(options[:when_run_with] || '')
15
+ end
16
+ end
17
+
18
+ def self.it_exits_with_error_code(options)
19
+ expected_status_code = options[:error_code] || 1
20
+ it_exits("with error code #{expected_status_code}", expected_status_code, options)
21
+ end
22
+
23
+ def self.it_exits_successfully(options)
24
+ expected_status_code = options[:error_code] || 0
25
+ it_exits("without error (#{expected_status_code})", expected_status_code, options)
26
+ end
27
+
28
+ def run(args)
29
+ args = args.is_a?(String) ? args.split(' ') : args
30
+ self.class.described_class.run(args, out_stream, error_stream)
31
+ end
32
+
33
+ def out_stream
34
+ @out_stream ||= StringIO.new
35
+ end
36
+
37
+ def error_stream
38
+ @error_stream ||= StringIO.new
39
+ end
40
+
41
+ def output
42
+ out_stream.string
43
+ end
44
+
45
+ def error
46
+ error_stream.string
47
+ end
48
+
49
+ def when_run_with(args)
50
+ yield
51
+ run args
52
+ end
53
+
54
+ def after_running_with(args)
55
+ run args
56
+ yield
57
+ end
58
+
59
+ def running_with(args)
60
+ lambda { run(args) }
61
+ end
62
+
63
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Clispec" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'clispec'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bmabey-clispec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Ben Mabey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-01 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: Step defs, world helpers, etc. for testing CLI tools with Cucumber. Custom example group to help test CLI tools in RSpec.
26
+ email: ben@benmabey.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Rakefile
40
+ - VERSION
41
+ - clispec.gemspec
42
+ - lib/clispec.rb
43
+ - lib/clispec/example_groups/runner.rb
44
+ - spec/clispec_spec.rb
45
+ - spec/spec_helper.rb
46
+ has_rdoc: false
47
+ homepage: http://github.com/bmabey/clispec
48
+ post_install_message:
49
+ rdoc_options:
50
+ - --charset=UTF-8
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.2.0
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: Helpers for testing CLI tools with Cucumber and RSpec
72
+ test_files:
73
+ - spec/clispec_spec.rb
74
+ - spec/spec_helper.rb