diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-02-27 15:33:32 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-02-27 15:33:32 +0300 |
commit | ac8a0fa061283f2eb25f1e673ab244f1009a71a4 (patch) | |
tree | 114b03af8e63f341b32553f6c51766b64b760898 /spec/lib/gitlab/plugin_spec.rb | |
parent | 79d911204ca92c759b696d0b8db8e8d54af6e2f9 (diff) |
Few code improvements for spec/lib/gitlab/plugin_spec.rb
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/lib/gitlab/plugin_spec.rb')
-rw-r--r-- | spec/lib/gitlab/plugin_spec.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/lib/gitlab/plugin_spec.rb b/spec/lib/gitlab/plugin_spec.rb index 1dc508f86ce..065b18858be 100644 --- a/spec/lib/gitlab/plugin_spec.rb +++ b/spec/lib/gitlab/plugin_spec.rb @@ -4,7 +4,7 @@ describe Gitlab::Plugin do describe '.execute' do let(:data) { Gitlab::DataBuilder::Push::SAMPLE_DATA } let(:plugin) { Rails.root.join('plugins', 'test.rb') } - let(:tmp_file) { Tempfile.new('plugin-dump').path } + let(:tmp_file) { Tempfile.new('plugin-dump') } before do File.write(plugin, plugin_source) @@ -13,7 +13,7 @@ describe Gitlab::Plugin do after do FileUtils.rm(plugin) - FileUtils.rm(tmp_file) + tmp_file.close! end subject { described_class.execute(plugin.to_s, data) } @@ -23,17 +23,17 @@ describe Gitlab::Plugin do it 'ensures plugin received data via stdin' do subject - expect(File.read(tmp_file)).to eq(data.to_json) + expect(File.read(tmp_file.path)).to eq(data.to_json) end end private def plugin_source - <<-EOS -#!/usr/bin/env ruby -x = STDIN.read -File.write('#{tmp_file}', x) + <<~EOS + #!/usr/bin/env ruby + x = STDIN.read + File.write('#{tmp_file.path}', x) EOS end end |