mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
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
3 changed files with 9 additions and 9 deletions
|
@ -47,28 +47,28 @@ describe Pry::Code do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'find files that are relative to the $LOAD_PATH' do
|
||||
describe 'find Ruby files relative to $LOAD_PATH' do
|
||||
before do
|
||||
$LOAD_PATH << 'spec/commands'
|
||||
$LOAD_PATH << 'spec/fixtures'
|
||||
end
|
||||
|
||||
after do
|
||||
$LOAD_PATH.delete 'spec/commands'
|
||||
$LOAD_PATH.delete 'spec/fixtures'
|
||||
end
|
||||
|
||||
should 'find files that are in a directory in the $LOAD_PATH' do
|
||||
Pry::Code.from_file('ls_spec.rb').code_type.should == :ruby
|
||||
it 'finds files with `.rb` extension' do
|
||||
Pry::Code.from_file('slinky.rb').code_type.should == :ruby
|
||||
end
|
||||
|
||||
should 'find Ruby files in $LOAD_PATH with `.rb` omitted' do
|
||||
Pry::Code.from_file('ls_spec').code_type.should == :ruby
|
||||
it 'finds files with `.rb` omitted' do
|
||||
Pry::Code.from_file('slinky').code_type.should == :ruby
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
0
spec/fixtures/slinky.rb
vendored
Normal file
0
spec/fixtures/slinky.rb
vendored
Normal file
0
spec/fixtures/slinky/stinky.rb
vendored
Normal file
0
spec/fixtures/slinky/stinky.rb
vendored
Normal file
Loading…
Reference in a new issue