Skip to content

Commit

Permalink
Remove some straggler instance vars from bundle_spec
Browse files Browse the repository at this point in the history
Also remove a lamo tautological test.

Remove a bunch of "should" statements from descriptions, closer to what
rubocop-rspec espouses.
  • Loading branch information
atz committed Aug 22, 2018
1 parent 8e01bd9 commit ea47220
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions spec/bundle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -654,46 +654,45 @@ def bundle_setup(proj)
end

describe "file and directory utilities" do
before do
bundle_setup :proj_revs
@relative = 'abc/def.jpg'
@full = @b.path_in_bundle @relative
end
let(:relative) { 'abc/def.jpg' }
let(:full) { @b.path_in_bundle(relative) }

before { bundle_setup :proj_revs }

it "#path_in_bundle should return expected value" do
expect(@b.path_in_bundle(@relative)).to eq(@full)
it "#path_in_bundle returns expected value" do
expect(@b.path_in_bundle(relative)).to eq('spec/test_data/bundle_input_a/abc/def.jpg')
end

it "#relative_path should return expected value" do
expect(@b.relative_path(@b.bundle_dir, @full)).to eq(@relative)
it "#relative_path returns expected value" do
expect(@b.relative_path(@b.bundle_dir, full)).to eq(relative)
end

it "#relative_path should raise error if given bogus arguments" do
it "#relative_path raises error if given bogus arguments" do
path = "foo/bar/fubb.txt"
exp_msg = /^Bad args to relative_path/
expect { @b.relative_path('', path) }.to raise_error(ArgumentError, exp_msg)
expect { @b.relative_path(path, path) }.to raise_error(ArgumentError, exp_msg)
expect { @b.relative_path('xx', path) }.to raise_error(ArgumentError, exp_msg)
end

it "#get_base_dir should return expected value" do
it "#get_base_dir returns expected value" do
expect(@b.get_base_dir('foo/bar/fubb.txt')).to eq('foo/bar')
end

it "#get_base_dir should raise error if given bogus arguments" do
it "#get_base_dir raises error if given bogus arguments" do
exp_msg = /^Bad arg to get_base_dir/
bad_args = ['foo.txt', '', 'x\y\foo.txt']
bad_args.each do |arg|
expect { @b.get_base_dir(arg) }.to raise_error(ArgumentError, exp_msg)
end
end

it "#dir_glob should return expected information" do
it "#dir_glob returns expected information" do
exp = [1, 2, 3].map { |n| @b.path_in_bundle "image#{n}.tif" }
expect(@b.dir_glob(@b.path_in_bundle "*.tif")).to eq(exp)
end

it "#find_files_recursively should return expected information" do
it "#find_files_recursively returns expected information" do
exp = {
:proj_revs => [
"checksums.txt",
Expand Down Expand Up @@ -724,17 +723,17 @@ def bundle_setup(proj)
describe "misc utilities" do
before { bundle_setup :proj_revs }

it "source_id_suffix() should be empty if not making unique source IDs" do
it '#source_id_suffix is empty if not making unique source IDs' do
@b.uniqify_source_ids = false
expect(@b.source_id_suffix).to eq('')
end

it "source_id_suffix() should look like an integer if making unique source IDs" do
it '#source_id_suffix looks like an integer if making unique source IDs' do
@b.uniqify_source_ids = true
expect(@b.source_id_suffix).to match(/^_\d+$/)
end

it "symbolize_keys() should handle various data structures correctly" do
it '#symbolize_keys handles various data structures correctly' do
tests = [
[{}, {}],
[[], []],
Expand All @@ -755,7 +754,7 @@ def bundle_setup(proj)
end
end

it "values_to_symbols!() should convert string values to symbols" do
it '#values_to_symbols! should convert string values to symbols' do
tests = [
[{}, {}],
[
Expand Down

0 comments on commit ea47220

Please sign in to comment.