mkspec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p392
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mkspec.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.2.4)
5
+ rspec (2.14.1)
6
+ rspec-core (~> 2.14.0)
7
+ rspec-expectations (~> 2.14.0)
8
+ rspec-mocks (~> 2.14.0)
9
+ rspec-core (2.14.5)
10
+ rspec-expectations (2.14.2)
11
+ diff-lcs (>= 1.1.3, < 2.0)
12
+ rspec-mocks (2.14.3)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Ritchie Young
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Ritchie Young
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,35 @@
1
+ Mkspec
2
+ ======
3
+
4
+ Generate your Ruby specs straight from your REPL
5
+
6
+ Whilst mucking around in your Ruby REPL (probably Pry), you decide you
7
+ need a spec to describe your next great feature. Instead of jumping back
8
+ to your editor, just type:
9
+
10
+ require 'mkspec'
11
+ include Mkspec
12
+
13
+ expect(calculator, :calculate, "1+1").to(eq(1+1))
14
+
15
+ and it will generate:
16
+
17
+ describe Calculator do
18
+ subject {described_class.new}
19
+
20
+ describe "#calculate" do
21
+
22
+ it "does something" do
23
+ expect(subject.calculate("1+1")).to eq(2)
24
+ end
25
+
26
+ end
27
+ end
28
+
29
+ WIP
30
+ ===
31
+
32
+ That's all it does right now. It's a simple DSL for generating RSpec
33
+ specs. If it proves useful though, I'm thinking of adding the ability
34
+ to generate more types of specs and the ability to save your specs
35
+ straight into your project.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module Mkspec
2
+ VERSION = "0.0.1"
3
+ end
data/lib/mkspec.rb ADDED
@@ -0,0 +1,41 @@
1
+ module Mkspec
2
+
3
+ class Matcher
4
+
5
+ end
6
+
7
+ class LeftHand
8
+
9
+ def initialize(class_name, method_name, args)
10
+ @class_name = class_name
11
+ @method_name = method_name
12
+ @args = args
13
+ end
14
+
15
+ def to(matcher)
16
+ <<-EOF
17
+ describe #{@class_name} do
18
+ subject {described_class.new}
19
+
20
+ describe "##{@method_name}" do
21
+
22
+ it "does something" do
23
+ expect(subject.#{@method_name}("#{@args}")).to #{matcher}
24
+ end
25
+
26
+ end
27
+ end
28
+ EOF
29
+ end
30
+ end
31
+
32
+ def expect(sut, method, args)
33
+ LeftHand.new(sut.class.name, method, args)
34
+ end
35
+
36
+ def eq(expected)
37
+ "eq(#{expected})"
38
+
39
+ end
40
+
41
+ end
data/mkspec.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mkspec/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mkspec"
8
+ spec.version = Mkspec::VERSION
9
+ spec.authors = ["Ritchie Young"]
10
+ spec.email = ["ritchiey@gmail.com"]
11
+ spec.description = %q{A DSL for generating specs}
12
+ spec.summary = %q{Generate a spec from your REPL using a simple, familiar DSL}
13
+ spec.homepage = "https://github.com/ritchiey/mkspec"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,28 @@
1
+ require_relative '../lib/mkspec'
2
+
3
+ describe Mkspec do
4
+
5
+ it "is a DSL for building specs" do
6
+ class SystemUnderTest
7
+ end
8
+ sut = SystemUnderTest.new
9
+
10
+ sut.extend described_class
11
+ expect(sut.expect(sut, :calculate, "1+1").to(sut.eq(1+1)).to_s).to eq(
12
+ <<-GENERATED_SPEC
13
+ describe SystemUnderTest do
14
+ subject {described_class.new}
15
+
16
+ describe "#calculate" do
17
+
18
+ it "does something" do
19
+ expect(subject.calculate("1+1")).to eq(2)
20
+ end
21
+
22
+ end
23
+ end
24
+ GENERATED_SPEC
25
+ )
26
+ end
27
+
28
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mkspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ritchie Young
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-12-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: A DSL for generating specs
63
+ email:
64
+ - ritchiey@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - .ruby-version
71
+ - Gemfile
72
+ - Gemfile.lock
73
+ - LICENSE
74
+ - LICENSE.txt
75
+ - README.md
76
+ - Rakefile
77
+ - lib/mkspec.rb
78
+ - lib/mkspec/version.rb
79
+ - mkspec.gemspec
80
+ - spec/mkspec_spec.rb
81
+ homepage: https://github.com/ritchiey/mkspec
82
+ licenses:
83
+ - MIT
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 1.8.23
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: Generate a spec from your REPL using a simple, familiar DSL
106
+ test_files:
107
+ - spec/mkspec_spec.rb