onload 1.0.5 → 1.1.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.
@@ -14,4 +14,12 @@ describe Onload do
14
14
  expect(Hello.new.hello).to eq("hello")
15
15
  end
16
16
  end
17
+
18
+ it "adds an entry to the specified ignore file" do
19
+ Onload.with_config(ignore_path: @ignore_path) do
20
+ require "hello"
21
+ ignore_file = Onload::IgnoreFile.load(@ignore_path)
22
+ expect(ignore_file).to include("fixtures/hello.rb")
23
+ end
24
+ end
17
25
  end
data/spec/spec_setup.rb CHANGED
@@ -17,6 +17,14 @@ module Onload
17
17
  processed_file = Onload::File.new(unprocessed_file).outfile
18
18
  ::File.unlink(processed_file) if ::File.exist?(processed_file)
19
19
  $LOADED_FEATURES.delete(unprocessed_file)
20
+
21
+ if defined?(Rails)
22
+ if Rails.respond_to?(:autoloaders)
23
+ Rails.autoloaders.main.reload
24
+ else
25
+ ActiveSupport::Dependencies.remove_unloadable_constants!
26
+ end
27
+ end
20
28
  end
21
29
 
22
30
  yield
@@ -34,7 +42,16 @@ RSpec.configure do |config|
34
42
  config.extend(Onload::TestHelpers)
35
43
 
36
44
  config.around(:each) do |example|
37
- Onload::TestHelpers.with_clean_env { example.run }
45
+ @ignore_path = ::File.join("spec", ".testignore")
46
+
47
+ ::File.unlink(@ignore_path) if ::File.exist?(@ignore_path)
48
+ ::File.write(@ignore_path, "")
49
+
50
+ begin
51
+ Onload::TestHelpers.with_clean_env { example.run }
52
+ ensure
53
+ ::File.unlink(@ignore_path) if ::File.exist?(@ignore_path)
54
+ end
38
55
  end
39
56
  end
40
57
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onload
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
@@ -22,17 +22,20 @@ files:
22
22
  - README.md
23
23
  - Rakefile
24
24
  - lib/onload.rb
25
+ - lib/onload/config.rb
25
26
  - lib/onload/core_ext/kernel.rb
26
27
  - lib/onload/core_ext/kernel_zeitwerk.rb
27
28
  - lib/onload/ext/activesupport/dependencies.rb
28
29
  - lib/onload/ext/bootsnap/autoload.rb
29
30
  - lib/onload/ext/zeitwerk/loader.rb
30
31
  - lib/onload/file.rb
32
+ - lib/onload/ignore_file.rb
31
33
  - lib/onload/railtie.rb
32
34
  - lib/onload/tasks/transpile.rake
33
35
  - lib/onload/tasks/transpile_rails.rake
34
36
  - lib/onload/version.rb
35
37
  - onload.gemspec
38
+ - spec/fixtures/hello.rb
36
39
  - spec/fixtures/hello.rb.up
37
40
  - spec/rails/controllers/home_controller_spec.rb
38
41
  - spec/rails/dummy/app/controllers/application_controller.rb