Skip to content

Commit

Permalink
Unfudge writes X fields tests
Browse files Browse the repository at this point in the history
Providing a `limit` argument to `split` was a fudge...

Also split examples to fix some rubocop `RSpec/MultipleExpectations`
violations.
  • Loading branch information
alexjfisher committed Sep 4, 2016
1 parent 10a1dae commit 3a2dada
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 5 additions & 2 deletions spec/unit/provider/network_route/redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@ def fixture_data(file)

describe 'writing the route line' do
describe 'For standard (non-default) routes' do
it 'writes 5 fields' do
it 'writes a single line for the route' do
expect(content.scan(%r{^172.17.67.0\/30 .*$}).length).to eq(1)
expect(content.scan(%r{^172.17.67.0\/30 .*$}).first.split(' ', 5).length).to eq(5)
end

it 'writes 7 fields' do
expect(content.scan(%r{^172.17.67.0\/30 .*$}).first.split(' ').length).to eq(7)
end

it 'has the correct fields appended' do
Expand Down
13 changes: 9 additions & 4 deletions spec/unit/provider/network_route/routes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ def fixture_data(file)
end

describe 'writing the route line' do
it 'writes all 5 fields' do
it 'writes a single line for the route' do
expect(content.scan(%r{^172.17.67.0 .*$}).length).to eq(1)
expect(content.scan(%r{^172.17.67.0 .*$}).first.split(%r{\s}, 5).length).to eq(5)
end
it 'writes all 6 fields' do
expect(content.scan(%r{^172.17.67.0 .*$}).first.split(' ').length).to eq(6)
end

it 'has the correct fields appended' do
Expand Down Expand Up @@ -166,9 +168,12 @@ def fixture_data(file)
end

describe 'writing the route line' do
it 'writes only fields' do
it 'writes a single line for the route' do
expect(content.scan(%r{^172.17.67.0 .*$}).length).to eq(1)
expect(content.scan(%r{^172.17.67.0 .*$}).first.split(%r{\s}, 5).length).to eq(4)
end

it 'writes only fields' do
expect(content.scan(%r{^172.17.67.0 .*$}).first.split(' ').length).to eq(4)
end

it 'has the correct fields appended' do
Expand Down

0 comments on commit 3a2dada

Please sign in to comment.