spec/code_spec.rb: refactor tests

- Use fixtures as a test files
- Write more concise spec titles
This commit is contained in:
Kyrylo Silin 2013-11-23 22:08:53 +02:00
parent 1a24db838c
commit fc2993a5ca
3 changed files with 9 additions and 9 deletions

View File

@ -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
View File

0
spec/fixtures/slinky/stinky.rb vendored Normal file
View File