rspectacular 0.13.0 → 0.14.0

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.
@@ -3,7 +3,7 @@
3
3
  ##############################################################################
4
4
 
5
5
  RSpec.configure do |config|
6
- config.before(:each, :singletons => lambda { |v| !!v }) do |example|
6
+ config.around(:each, :singletons => lambda { |v| !!v }) do |example|
7
7
  require 'singleton'
8
8
 
9
9
  options = example.metadata[:singletons]
@@ -13,5 +13,11 @@ RSpec.configure do |config|
13
13
  singletons_to_reset.each do |singleton|
14
14
  Singleton.__init__(singleton)
15
15
  end
16
+
17
+ example.run
18
+
19
+ singletons_to_reset.each do |singleton|
20
+ Singleton.__init__(singleton)
21
+ end
16
22
  end
17
23
  end
@@ -1,18 +1,4 @@
1
- require 'active_record'
2
-
3
- rails_database_yaml_file_path = File.join(Dir.pwd, 'config', 'database.yml')
4
- rails_engine_database_yaml_file_path = File.join(Dir.pwd, 'spec', 'dummy', 'config', 'database.yml')
5
-
6
- database_yaml_file_path = if File.exist? rails_engine_database_yaml_file_path
7
- rails_engine_database_yaml_file_path
8
- else
9
- rails_database_yaml_file_path
10
- end
11
-
12
- connection_info = YAML.load_file(database_yaml_file_path)['test']
13
-
14
- ActiveRecord::Base.establish_connection(connection_info)
15
-
1
+ require File.expand_path(File.join('..', 'active_record_connection_setup'), __FILE__)
16
2
  require 'rspectacular'
17
3
 
18
4
  Dir[File.join(Dir.pwd, 'spec', 'support', '**', '*.rb')].each { |f| require f }
@@ -0,0 +1,24 @@
1
+ require 'active_record'
2
+ require 'fileutils'
3
+ require 'logger'
4
+
5
+ begin
6
+ FileUtils.mkdir 'log'
7
+ rescue Errno::EEXIST
8
+ end
9
+
10
+ log_file = File.join(Dir.pwd, 'log', 'activerecord.log')
11
+
12
+ rails_database_yaml_file_path = File.join(Dir.pwd, 'config', 'database.yml')
13
+ rails_engine_database_yaml_file_path = File.join(Dir.pwd, 'spec', 'dummy', 'config', 'database.yml')
14
+
15
+ database_yaml_file_path = if File.exist? rails_engine_database_yaml_file_path
16
+ rails_engine_database_yaml_file_path
17
+ else
18
+ rails_database_yaml_file_path
19
+ end
20
+
21
+ connection_info = YAML.load_file(database_yaml_file_path)['test']
22
+
23
+ ActiveRecord::Base.logger = Logger.new(log_file)
24
+ ActiveRecord::Base.establish_connection(connection_info)
@@ -1,4 +1,6 @@
1
1
  ENV["RAILS_ENV"] ||= 'test'
2
+
3
+ require File.expand_path(File.join('..', 'active_record_connection_setup'), __FILE__)
2
4
  require File.join(Dir.pwd, 'spec', 'dummy', 'config', 'environment')
3
5
 
4
6
  require 'rspec/rails'
@@ -1,3 +1,3 @@
1
1
  module RSpectacular
2
- VERSION = '0.13.0'
2
+ VERSION = '0.14.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspectacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-22 00:00:00.000000000 Z
12
+ date: 2013-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -88,6 +88,7 @@ files:
88
88
  - lib/rspectacular/selectors/defaults.rb
89
89
  - lib/rspectacular/selectors.rb
90
90
  - lib/rspectacular/spec_helpers/active_record_basic.rb
91
+ - lib/rspectacular/spec_helpers/active_record_connection_setup.rb
91
92
  - lib/rspectacular/spec_helpers/rails_engine.rb
92
93
  - lib/rspectacular/support/focused.rb
93
94
  - lib/rspectacular/support/formatters.rb