Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted shared specs to RSpec-style shared 'describe' blocks.
- Loading branch information
Brian Ford
committed
Jul 17, 2008
1 parent
41dac50
commit 63dc9eb
Showing
352 changed files
with
7,093 additions
and
7,447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
shared :argf_each_line do |cmd| | ||
describe "ARGF.#{cmd}" do | ||
before :each do | ||
ARGV.clear | ||
@file1 = ARGFSpecs.fixture_file('file1.txt') | ||
@file2 = ARGFSpecs.fixture_file('file2.txt') | ||
@stdin = ARGFSpecs.fixture_file('stdin.txt') | ||
@contents_file1 = File.read(@file1) | ||
@contents_file2 = File.read(@file2) | ||
@contents_stdin = File.read(@stdin) | ||
end | ||
describe :argf_each_line, :shared => true do | ||
before :each do | ||
ARGV.clear | ||
@file1 = ARGFSpecs.fixture_file('file1.txt') | ||
@file2 = ARGFSpecs.fixture_file('file2.txt') | ||
@stdin = ARGFSpecs.fixture_file('stdin.txt') | ||
@contents_file1 = File.read(@file1) | ||
@contents_file2 = File.read(@file2) | ||
@contents_stdin = File.read(@stdin) | ||
end | ||
|
||
after :each do | ||
# Close any open file (catch exception if already closed) | ||
ARGF.close rescue nil | ||
ARGFSpecs.fixture_file_delete(@file1,@file2,@stdin) | ||
end | ||
|
||
after :each do | ||
# Close any open file (catch exception if already closed) | ||
ARGF.close rescue nil | ||
ARGFSpecs.fixture_file_delete(@file1,@file2,@stdin) | ||
end | ||
|
||
it "reads each line of files" do | ||
ARGFSpecs.file_args('file1.txt', 'file2.txt', '-') | ||
STDIN.reopen(@stdin) | ||
line_list = [] | ||
ARGF.send(cmd) { |b| line_list << b } | ||
line_list.should == (@contents_file1 + @contents_file2 + @contents_stdin).split($/).collect { |l| l+$/} # ord | ||
end | ||
it "reads each line of files" do | ||
ARGFSpecs.file_args('file1.txt', 'file2.txt', '-') | ||
STDIN.reopen(@stdin) | ||
line_list = [] | ||
ARGF.send(@method) { |b| line_list << b } | ||
line_list.should == (@contents_file1 + @contents_file2 + @contents_stdin).split($/).collect { |l| l+$/} # ord | ||
end | ||
end | ||
end |
Oops, something went wrong.