mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
file_formatter_spec: simplify tests a bit
* simplify test names * use described_class instead of the actual name. It's shorter.
This commit is contained in:
parent
6dc80079c9
commit
2542f07b08
1 changed files with 19 additions and 19 deletions
|
@ -12,33 +12,33 @@ describe Pry::Command::Cat::FileFormatter do
|
|||
end
|
||||
|
||||
describe "windows filesystem" do
|
||||
it "should parse '/'style absolute path without line_num" do
|
||||
it "parses '/'style absolute path without line_num" do
|
||||
file_with_embedded_line = "C:/Ruby193/pry_instance.rb"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "C:/Ruby193/pry_instance.rb"
|
||||
line_num.should eq nil
|
||||
end
|
||||
|
||||
it "should parse '/'style absolute path with line_num" do
|
||||
it "parses '/'style absolute path with line_num" do
|
||||
file_with_embedded_line = "C:/Ruby193/pry_instance.rb:2"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "C:/Ruby193/pry_instance.rb"
|
||||
line_num.should eq 2
|
||||
end
|
||||
|
||||
it "should parse '\\'style absolute path without line_num" do
|
||||
it "parses '\\'style absolute path without line_num" do
|
||||
file_with_embedded_line = "C:\\Ruby193\\pry_instance.rb"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "C:\\Ruby193\\pry_instance.rb"
|
||||
line_num.should eq nil
|
||||
end
|
||||
|
||||
it "should parse '\\'style absolute path with line_num" do
|
||||
it "parses '\\'style absolute path with line_num" do
|
||||
file_with_embedded_line = "C:\\Ruby193\\pry_instance.rb:2"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "C:\\Ruby193\\pry_instance.rb"
|
||||
line_num.should eq 2
|
||||
|
@ -46,34 +46,34 @@ describe Pry::Command::Cat::FileFormatter do
|
|||
end
|
||||
|
||||
describe "UNIX-like filesystem" do
|
||||
it "should parse absolute path without line_num" do
|
||||
it "parses absolute path without line_num" do
|
||||
file_with_embedded_line = "/Ruby193/pry_instance.rb"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "/Ruby193/pry_instance.rb"
|
||||
line_num.should eq nil
|
||||
end
|
||||
|
||||
it "should parse absolute path with line_num" do
|
||||
it "parses absolute path with line_num" do
|
||||
file_with_embedded_line = "/Ruby193/pry_instance.rb:2"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "/Ruby193/pry_instance.rb"
|
||||
line_num.should eq 2
|
||||
end
|
||||
end
|
||||
|
||||
it "should parse relative path without line_num" do
|
||||
it "parses relative path without line_num" do
|
||||
file_with_embedded_line = "pry_instance.rb"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "pry_instance.rb"
|
||||
line_num.should eq nil
|
||||
end
|
||||
|
||||
it "should parse relative path with line_num" do
|
||||
it "parses relative path with line_num" do
|
||||
file_with_embedded_line = "pry_instance.rb:2"
|
||||
ff = Pry::Command::Cat::FileFormatter.new(file_with_embedded_line, @p, @opt)
|
||||
ff = described_class.new(file_with_embedded_line, @p, @opt)
|
||||
file_name, line_num = ff.file_and_line
|
||||
file_name.should eq "pry_instance.rb"
|
||||
line_num.should eq 2
|
||||
|
@ -82,12 +82,12 @@ describe Pry::Command::Cat::FileFormatter do
|
|||
|
||||
describe "#format" do
|
||||
it "formats given files" do
|
||||
ff = Pry::Command::Cat::FileFormatter.new(__FILE__, @p, @opt)
|
||||
ff = described_class.new(__FILE__, @p, @opt)
|
||||
expect(ff.format).to match(/it "formats given files" do/)
|
||||
end
|
||||
|
||||
it "should format given files with line number" do
|
||||
ff = Pry::Command::Cat::FileFormatter.new(__FILE__ + ':83', @p, @opt)
|
||||
it "formats given files with line number" do
|
||||
ff = described_class.new(__FILE__ + ':83', @p, @opt)
|
||||
expect(ff.format).to match(/it "formats given files" do/)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue