josevalim-nested_scenarios 0.2.1 → 0.2.2

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 +2 -2
  2. data/lib/nested_scenarios/fixtures.rb +10 -14
  3. metadata +1 -1
data/README CHANGED
@@ -1,13 +1,13 @@
1
1
  NestedScenarios
2
2
  License: MIT
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
 
5
5
  Description
6
6
  -----------
7
7
 
8
8
  This plugin is based on FixtureScenarios and FixtureScenarioBuilder.
9
9
  It includes both worlds in just one plugin with some fixes, new features
10
- and Rails 2.2 support (check what's new session bellow).
10
+ and Rails 2.2 and 2.3 support (check what's new session bellow).
11
11
 
12
12
  You can check them at:
13
13
 
@@ -1,13 +1,5 @@
1
1
  class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash)
2
- cattr_accessor :current_fixture_path
3
- @@all_cached_fixtures = {}
4
-
5
- # Overwrite cache for connection to take into account the current fixture path.
6
- def self.cache_for_connection(connection)
7
- @@all_cached_fixtures[connection.object_id] ||= {}
8
- @@all_cached_fixtures[connection.object_id][@@current_fixture_path] ||= {}
9
- @@all_cached_fixtures[connection.object_id][@@current_fixture_path]
10
- end
2
+ cattr_accessor :current_fixtures
11
3
 
12
4
  def self.destroy_fixtures(table_names)
13
5
  NestedScenarios.delete_tables(table_names)
@@ -16,7 +8,7 @@ end
16
8
 
17
9
  module ActiveRecord #:nodoc:
18
10
  module TestFixtures #:nodoc:
19
-
11
+
20
12
  def self.included(base)
21
13
  base.class_eval do
22
14
  setup :setup_fixtures
@@ -92,16 +84,20 @@ module ActiveRecord #:nodoc:
92
84
  def load_fixtures
93
85
  @loaded_fixtures = {}
94
86
 
95
- if self.load_root_fixtures
96
- Fixtures.current_fixture_path = self.fixture_path
97
- root_fixtures = Fixtures.create_fixtures(self.fixture_path, self.root_table_names, fixture_class_names)
87
+ current_fixtures = self.fixture_path.to_s + self.scenario_path.to_s
88
+ if Fixtures.current_fixtures != current_fixtures
89
+ Fixtures.current_fixtures = current_fixtures
90
+ Fixtures.reset_cache
98
91
  end
99
92
 
100
93
  if self.scenario_path
101
- Fixtures.current_fixture_path = self.scenario_path
102
94
  scenario_fixtures = Fixtures.create_fixtures(self.scenario_path, self.scenario_table_names, fixture_class_names)
103
95
  end
104
96
 
97
+ if self.load_root_fixtures
98
+ root_fixtures = Fixtures.create_fixtures(self.fixture_path, self.root_table_names, fixture_class_names)
99
+ end
100
+
105
101
  [root_fixtures, scenario_fixtures].each do |fixtures|
106
102
  next if fixtures.nil?
107
103
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: josevalim-nested_scenarios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jos\xC3\xA9 Valim"