factory_toys 1.0.2 → 1.0.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/factory_toys.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "factory_toys"
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Henry", "Thomas Brand"]
@@ -48,14 +48,11 @@ module FactoryToys
48
48
  FileUtils.mkdir_p(dir)
49
49
  FileUtils.rm_r(Dir.glob(File.join(dir, "*.feature")))
50
50
 
51
- @outputs.each_with_index do |output, i|
52
- File.open(File.join(dir, "#{filename}_#{i}.feature"), 'w') do |f|
53
- begin
54
- f.puts (@header + output).join("\n")
55
- rescue Exception => e
56
- puts e
57
- (debugger; puts '????')
58
- end
51
+ @outputs.each_with_index do |output, i|
52
+ output_file_name = File.join(dir, "#{filename}_#{i}.feature")
53
+ File.open(output_file_name, 'w') do |f|
54
+ output_str = (@header + output).join("\n")
55
+ f.puts output_str
59
56
  end
60
57
  end
61
58
  end
@@ -87,7 +84,7 @@ module FactoryToys
87
84
  scenario_name = self.get_scenario_name(feature_name)
88
85
  raise MissingScenarioError, scenario_name unless self.data[scenario_name]
89
86
  eval(self.data[scenario_name])
90
- @output << eval(scenario_name.to_s)
87
+ @output += eval(scenario_name.to_s).split("\n")
91
88
  @output << ''
92
89
  check_output_length
93
90
  end
data/lib/factory_toys.rb CHANGED
@@ -30,7 +30,7 @@ module FactoryToys
30
30
 
31
31
  protected
32
32
  def source_files
33
- Dir.glob(self.source_location + '/*.rb')
33
+ Dir[File.join(self.source_location, '*.rb')]
34
34
  rescue Errno::ENOENT => e
35
35
  return "Source Directory Does not exist: #{self.source_directory}"
36
36
  end
@@ -70,15 +70,13 @@ describe "FactoryToys" do
70
70
 
71
71
  it 'does not override file if no change' do
72
72
  Object.send(:remove_const, :RAILS_ROOT)
73
- path = File.dirname(__FILE__)
74
- path += Dir.pwd + '/' unless path[0..0] == '/'
75
- Object.const_set(:RAILS_ROOT, path + '/../tmp')
73
+ path = File.expand_path(File.dirname(__FILE__))
74
+ Object.const_set(:RAILS_ROOT, File.join(path, '..', 'tmp'))
76
75
  FileUtils.rm_r(FactoryToys.features_location + '/*', :force => true)
77
76
  FactoryToys.update_features
78
- init_files = Dir.glob(FactoryToys.features_location + '/*.feature').map{|f| [f, File.open(f){|file| file.read}]}
77
+ init_files = Dir.glob(File.join(FactoryToys.features_location, '**', '*.feature')).map{|f| [f, File.open(f){|file| file.read}]}
79
78
  FactoryToys.update_features
80
- new_files = Dir.glob(FactoryToys.features_location + '/*.feature').map{|f| [f, File.open(f){|file| file.read}]}
81
-
79
+ new_files = Dir.glob(File.join(FactoryToys.features_location, '**', '*.feature')).map{|f| [f, File.open(f){|file| file.read}]}
82
80
  init_files.first.last.should == new_files.first.last
83
81
  end
84
82
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_toys
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Henry