kata 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +78 -17
  2. data/lib/kata/setup.rb +5 -1
  3. metadata +2 -2
data/README.md CHANGED
@@ -80,28 +80,89 @@ To setup a minimal github repo you must first already have a github account and
80
80
  git installed on your machine. To build a kata repo simply use the setup
81
81
  command:
82
82
 
83
- wesbailey@feynman:~/my-katas> kata setup sample.rb
84
- {"repository":{"has_downloads":true,"url":". ... 011-03-11-165513/.git/
85
- [master (root-commit) 804036f] starting kata
86
- 5 files changed, 25 insertions(+), 0 deletions(-)
87
- create mode 100644 README
88
- create mode 100644 lib/my_first.rb
89
- create mode 100644 spec/my_first_spec.rb
90
- create mode 100644 spec/spec_helper.rb
91
- create mode 100644 spec/support/matchers/my_first.rb
92
- Counting objects: 11, done.
93
- Delta compression using up to 4 threads.
94
- Compressing objects: 100% (6/6), done.
95
- Writing objects: 100% (11/11), 973 bytes, done.
96
- Total 11 (delta 0), reused 0 (delta 0)
97
- To git@github.com:wbailey/my_first-2011-03-11-165513.git
98
- * [new branch] master -> master
83
+ wesbailey@feynman:~/scratch-1.9.0> kata setup sample.rb
84
+ Creating github repo...complete
85
+ creating files for repo and initializing...done
86
+ You can now change directories to my_first-2011-03-17-225948 and take your kata
99
87
 
88
+ Looking in that directory you can see what files have been created:
89
+
90
+ .rspec
91
+ README
92
+ lib
93
+ lib/my_first.rb
94
+ spec
95
+ spec/my_first_spec.rb
96
+ spec/spec_helper.rb
97
+ spec/support
98
+ spec/support/helpers
99
+ spec/support/matchers
100
+ spec/support/matchers/my_first.rb
101
+
102
+ For the files that are generated you will see the following default contents:
103
+
104
+ *.rspec*
105
+
106
+ --color --format d
107
+
108
+ *README*
109
+
110
+ Leveling up my ruby awesomeness!
111
+
112
+ *lib/my_first.rb*
113
+
114
+ class MyFirst
115
+ end
116
+
117
+ *spec/my_first_spec.rb*
118
+
119
+ require 'spec_helper'
120
+ require 'my_first'
121
+
122
+ describe MyFirst do
123
+ describe "new" do
124
+ it "should instantiate" do
125
+ lambda {
126
+ MyFirst.new
127
+ }.should_not raise_exception
128
+ end
129
+ end
130
+ end
131
+
132
+ *spec/spec_helper.rb*
133
+
134
+ $: << '.' << File.join(File.dirname(__FILE__), '..', 'lib')
135
+
136
+ require 'rspec'
137
+
138
+ Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
139
+
140
+ *spec/support/matchers/my_first.rb*
141
+
142
+ RSpec::Matchers.define :your_method do |expected|
143
+ match do |your_match|
144
+ #your_match.method_on_object_to_execute == expected
145
+ end
146
+ end
147
+
148
+ Following TDD the first test has been written and passes:
149
+
150
+ wesbailey@feynman:~/katas/my_first-2011-03-17-225948> rspec spec/
151
+
152
+ MyFirst
153
+ new
154
+ should instantiate
155
+
156
+ Finished in 0.0005 seconds
157
+ 1 example, 0 failures
158
+
159
+ With rspec configured you can also run autotest if you have it installed.
160
+
100
161
  ### Administering a Kata ###
101
162
 
102
163
  Running the kata from the command line yields:
103
164
 
104
- wesbailey@feynman:~/my-katas> kata stringcalculator.rb
165
+ wesbailey@feynman:~/katas> kata stringcalculator.rb
105
166
  String Calculator Kata
106
167
  Create an add method that will accept two digits as arguments
107
168
  - invoking with 1 and 2 returns 3
@@ -71,6 +71,10 @@ EOF
71
71
  File.open(File.join(repo_name, 'lib', "#{use_kata_name}.rb"), 'w') {|f| f.write <<EOF}
72
72
  class #{class_name}
73
73
  end
74
+ EOF
75
+ # create the .rspec file
76
+ File.open(File.join(repo_name, '.rspec'), 'w') {|f| f.write <<EOF}
77
+ --color --format d
74
78
  EOF
75
79
 
76
80
  # create the spec_helper.rb file
@@ -87,7 +91,7 @@ EOF
87
91
  require 'spec_helper'
88
92
  require '#{use_kata_name}'
89
93
 
90
- class #{class_name}
94
+ describe #{class_name} do
91
95
  describe "new" do
92
96
  it "should instantiate" do
93
97
  lambda {
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kata
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.4
5
+ version: 1.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Wes
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-03-15 00:00:00 -07:00
14
+ date: 2011-03-18 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency