spec/code_spec.rb: refactor tests
- Use fixtures as a test files - Write more concise spec titles
This commit is contained in:
parent
1a24db838c
commit
fc2993a5ca
|
@ -47,28 +47,28 @@ describe Pry::Code do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'find files that are relative to the $LOAD_PATH' do
|
describe 'find Ruby files relative to $LOAD_PATH' do
|
||||||
before do
|
before do
|
||||||
$LOAD_PATH << 'spec/commands'
|
$LOAD_PATH << 'spec/fixtures'
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
$LOAD_PATH.delete 'spec/commands'
|
$LOAD_PATH.delete 'spec/fixtures'
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'find files that are in a directory in the $LOAD_PATH' do
|
it 'finds files with `.rb` extension' do
|
||||||
Pry::Code.from_file('ls_spec.rb').code_type.should == :ruby
|
Pry::Code.from_file('slinky.rb').code_type.should == :ruby
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'find Ruby files in $LOAD_PATH with `.rb` omitted' do
|
it 'finds files with `.rb` omitted' do
|
||||||
Pry::Code.from_file('ls_spec').code_type.should == :ruby
|
Pry::Code.from_file('slinky').code_type.should == :ruby
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'find files that are relative to a directory in the $LOAD_PATH' do
|
it 'finds files in a relative directory with `.rb` extension' do
|
||||||
Pry::Code.from_file('../helper.rb').code_type.should == :ruby
|
Pry::Code.from_file('../helper.rb').code_type.should == :ruby
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'find Ruby files relative to $LOAD_PATH with `.rb` omitted' do
|
it 'finds files in a relative directory with `.rb` omitted' do
|
||||||
Pry::Code.from_file('../helper').code_type.should == :ruby
|
Pry::Code.from_file('../helper').code_type.should == :ruby
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue