bob_test 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/bob_test.rb +6 -1
  2. metadata +1 -1
data/lib/bob_test.rb CHANGED
@@ -18,11 +18,16 @@ module BobTest
18
18
  @test.end_line = Readline::HISTORY.size - 3
19
19
  @test.get_lines(@test.start_line..@test.end_line)
20
20
  # TODO figure out how to find path to rails project.
21
- path_to_file = File.expand_path(File.dirname(__FILE__)) + "/../test/unit/bob/"
21
+ # path_to_file = File.expand_path(File.dirname(__FILE__)) + "../test/unit/bob/"
22
+ path_to_file = "#{RAILS_ROOT}/test/unit/bob/"
23
+ # add require test helper to generated file
24
+ # check if we're in rails and if so put the tests in the test folder
25
+ # else put them in pwd.
22
26
  File.makedirs(path_to_file)
23
27
  filename ="#{self.class_name.underscore}_bob_test.rb"
24
28
  filename_with_path = path_to_file + filename
25
29
  File.open(filename_with_path, 'w+') do |f|
30
+ f.write("require 'test_helper'\n")
26
31
  f.write("class #{self.class_name}BobTest < Bt\nend\n")
27
32
  end unless File.exists?(filename_with_path)
28
33
  @test.write_to_file(filename_with_path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bob_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - deathbob