diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-12 10:35:54 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-12 10:35:54 -0600 |
| commit | e20d0f59ef34dbba8368314aef3ea741466372f1 (patch) | |
| tree | aab68e0be4d353da57353df6a9be96f2f653299e /spec/integration/core | |
| parent | 40460a4d5d7d6265f8adf85eb7255c6fac739ed0 (diff) | |
Add targetted search spec for datafile
Diffstat (limited to 'spec/integration/core')
| -rw-r--r-- | spec/integration/core/data_file_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/integration/core/data_file_spec.rb b/spec/integration/core/data_file_spec.rb new file mode 100644 index 0000000..0a0236a --- /dev/null +++ b/spec/integration/core/data_file_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +RSpec.describe Spandx::Core::DataFile do + subject { described_class.new(root_path) } + + let(:tmp_file) { Tempfile.new } + let(:root_path) { tmp_file.path } + + after do + tmp_file.unlink + end + + describe "#search" do + before do + subject.insert('activemodel', '6.0.2.2', ['MIT']) + subject.insert('spandx', '0.1.0', ['MIT']) + subject.insert('zlib', '1.1.0', ['MIT']) + + subject.index.update! + end + + it 'returns the correct result' do + result = subject.search(name: 'spandx', version: '0.1.0') + + expect(result).to match_array(['spandx', '0.1.0', 'MIT']) + end + end +end |
