rspec-kickstarter 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,8 @@ dry_run = false
11
11
  spec_dir = './spec'
12
12
 
13
13
  opt = OptionParser.new
14
- opt.on('-f', 'Creates new specs or appends on existing specs') { |_| force_write = true }
15
- opt.on('-n', 'Dry run') { |_| dry_run = true }
14
+ opt.on('-f', 'Create if absent or append to the existing spec') { |_| force_write = true }
15
+ opt.on('-n', 'Dry run mode') { |_| dry_run = true }
16
16
  opt.on('-o VAL', 'Output directory') { |dir| spec_dir = dir }
17
17
 
18
18
  args = opt.parse(ARGV)
@@ -62,7 +62,7 @@ module RSpecKickstarter
62
62
  "\n #{instance_name(c)} = #{get_complete_class_name(c)}.new"
63
63
  else
64
64
  get_params_initialization_code(constructor) +
65
- "\n #{instance_name(c)} = #{get_complete_class_name(c)}.new#{constructor.params}"
65
+ "\n #{instance_name(c)} = #{get_complete_class_name(c)}.new(#{to_param_names_array(constructor.params).join(', ')})"
66
66
  end
67
67
  end
68
68
  end
@@ -104,11 +104,11 @@ module RSpecKickstarter
104
104
  end
105
105
 
106
106
  parser = RDoc::Parser::Ruby.new(
107
- top_level,
108
- file_path,
109
- body,
110
- RDoc::Options.new,
111
- stats
107
+ top_level,
108
+ file_path,
109
+ body,
110
+ RDoc::Options.new,
111
+ stats
112
112
  )
113
113
  top_level = parser.scan
114
114
  c = get_target(top_level)
@@ -127,7 +127,7 @@ module RSpecKickstarter
127
127
  else
128
128
  additional_spec = <<SPEC
129
129
  #{racking_methods.map { |method|
130
- <<EACH_SPEC
130
+ <<EACH_SPEC
131
131
  # TODO auto-generated
132
132
  describe '#{method.name}' do
133
133
  it 'should work' do#{get_instantiation_code(c, method)}#{get_params_initialization_code(method)}
@@ -141,7 +141,7 @@ SPEC
141
141
  last_end_not_found = true
142
142
  code = existing_spec.split("\n").reverse.reject { |line|
143
143
  if last_end_not_found
144
- last_end_not_found = line.strip.gsub(/#.+$/, '') != "end"
144
+ last_end_not_found = line.gsub(/#.+$/, '').strip != "end"
145
145
  true
146
146
  else
147
147
  false
@@ -166,7 +166,7 @@ require '#{self_path}'
166
166
  describe #{get_complete_class_name(c)} do
167
167
 
168
168
  #{c.method_list.select { |m| m.visibility == :public }.map { |method|
169
- <<EACH_SPEC
169
+ <<EACH_SPEC
170
170
  # TODO auto-generated
171
171
  describe '#{method.name}' do
172
172
  it 'should work' do#{get_instantiation_code(c, method)}#{get_params_initialization_code(method)}
@@ -179,12 +179,12 @@ EACH_SPEC
179
179
  end
180
180
  SPEC
181
181
 
182
- if File.exist?(spec_path)
183
- puts "#{spec_path} already exists."
182
+ if dry_run
183
+ puts "----- #{spec_path} -----"
184
+ puts code
184
185
  else
185
- if dry_run
186
- puts "----- #{spec_path} -----"
187
- puts code
186
+ if File.exist?(spec_path)
187
+ puts "#{spec_path} already exists."
188
188
  else
189
189
  FileUtils.mkdir_p(File.dirname(spec_path))
190
190
  File.open(spec_path, 'w') { |f| f.write(code) }
@@ -1,3 +1,3 @@
1
1
  module RSpecKickstarter
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -1,6 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require "rspec_kickstarter/generator"
4
3
  require "rspec_kickstarter/version"
5
4
 
6
5
  module RSpecKickstarter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-kickstarter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  version: '0'
47
47
  requirements: []
48
48
  rubyforge_project:
49
- rubygems_version: 1.8.23
49
+ rubygems_version: 1.8.24
50
50
  signing_key:
51
51
  specification_version: 3
52
52
  summary: RSpec kickstarter generates spec files for existing code.