Skip to content

Commit

Permalink
Merge pull request #4 from vyorkin/master
Browse files Browse the repository at this point in the history
update tests to use the new expect method instead of should
  • Loading branch information
jumph4x committed Apr 9, 2015
2 parents 0a7dadc + 21ad8b3 commit 8f0a4a6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
5 changes: 2 additions & 3 deletions spec/batch_factory/batch_factory_spec.rb
Expand Up @@ -4,9 +4,8 @@
context 'w/ class methods' do
it 'should open a file and return a hashed workbook' do
worksheet = BatchFactory.from_file VALID_SPREADSHEET
puts worksheet.inspect
worksheet.size.should == 1
worksheet[0][:age].should == 50
expect(worksheet.size).to eq 1
expect(worksheet[0][:age]).to eq 50
end
end
end
Expand Down
9 changes: 4 additions & 5 deletions spec/batch_factory/hashed_worksheet_spec.rb
Expand Up @@ -10,20 +10,19 @@
end

it 'should return an array of heading keys' do
worksheet.keys[0].should == 'name'
expect(worksheet.keys[0]).to eq 'name'
end

it 'should return an array of data hashes' do
worksheet.rows[0][:age].should == 50
expect(worksheet.rows[0][:age]).to eq 50
end

it 'should iterate over the rows' do
worksheet.size.should == 1
expect(worksheet.size).to eq 1
worksheet.each_with_index do |hash, index|
hash.should == worksheet.rows[index]
expect(hash).to eq(worksheet.rows[index])
end
end
end

end

26 changes: 13 additions & 13 deletions spec/batch_factory/parser_spec.rb
Expand Up @@ -6,7 +6,7 @@
context 'w/ instance methods' do
it 'should open and parse a valid file' do
parser.open VALID_SPREADSHEET
parser.worksheet.should_not be_nil
expect(parser.worksheet).not_to be_nil
end

context 'when parsing default worksheet' do
Expand All @@ -16,22 +16,22 @@
end

it 'should parse column information' do
parser.column_bounds.should == (0..5)
expect(parser.column_bounds).to eq(0..5)
end

it 'should parse the heading keys' do
parser.heading_keys.should == ['name', 'address', nil, 'country', 'bid', 'age']
expect(parser.heading_keys).to eq(['name', 'address', nil, 'country', 'bid', 'age'])
end

it 'should parse the data rows' do
parser.row_hashes[0]['age'].should == 50
parser.row_hashes.size.should == 1
expect(parser.row_hashes[0]['age']).to eq 50
expect(parser.row_hashes.size).to eq 1
end

it 'should return a hashed worksheet' do
worksheet = parser.hashed_worksheet
worksheet.rows.should == parser.row_hashes
worksheet.keys.should == parser.heading_keys
expect(worksheet.rows).to eq(parser.row_hashes)
expect(worksheet.keys).to eq(parser.heading_keys)
end
end

Expand All @@ -42,22 +42,22 @@
end

it 'should parse column information' do
parser.column_bounds.should == (2..7)
expect(parser.column_bounds).to eq(2..7)
end

it 'should parse the heading keys' do
parser.heading_keys.should == ['name', 'address', nil, 'country', 'bid', 'age']
expect(parser.heading_keys).to eq(['name', 'address', nil, 'country', 'bid', 'age'])
end

it 'should parse the data rows' do
parser.row_hashes[0]['age'].should == 50
parser.row_hashes.size.should == 1
expect(parser.row_hashes[0]['age']).to eq 50
expect(parser.row_hashes.size).to eq 1
end

it 'should return a hashed worksheet' do
worksheet = parser.hashed_worksheet
worksheet.rows.should == parser.row_hashes
worksheet.keys.should == parser.heading_keys
expect(worksheet.rows).to eq(parser.row_hashes)
expect(worksheet.keys).to eq(parser.heading_keys)
end
end
end
Expand Down

0 comments on commit 8f0a4a6

Please sign in to comment.