]> git.immae.eu Git - github/fretlink/pronto-hlint.git/blobdiff - spec/spec_helper.rb
added ability to set config opts to eslint (#9)
[github/fretlink/pronto-hlint.git] / spec / spec_helper.rb
index b3d85969215cd4beaff60c71a8a47755ff961db0..e147ea7386a56cf01c27046f97c93ec40fae1bff 100644 (file)
@@ -17,10 +17,12 @@ require 'pronto/eslint_npm'
 end
 
 RSpec.shared_context 'with config', config: true do
-  requested_config = metadata[:config].to_yaml
+  requested_config = metadata[:config]
 
-  let(:config_path) { File.join(repo.path.to_s, Pronto::ESLintNpm::CONFIG_FILE) }
+  before(:each) do
+    allow_any_instance_of(Pronto::ESLintNpm).to receive(:config_options).and_return(requested_config)
 
-  before(:each) { File.write(config_path, requested_config) }
-  after(:each) { FileUtils.rm(config_path) }
+    # make sure the config is actually read in the example
+    expect_any_instance_of(Pronto::ESLintNpm).to receive(:read_config).and_call_original
+  end
 end