From fc2993a5ca5ef3aa2406e973025bdce6607504e0 Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Sat, 23 Nov 2013 22:08:53 +0200 Subject: [PATCH] spec/code_spec.rb: refactor tests - Use fixtures as a test files - Write more concise spec titles --- spec/code_spec.rb | 18 +++++++++--------- spec/fixtures/slinky.rb | 0 spec/fixtures/slinky/stinky.rb | 0 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 spec/fixtures/slinky.rb create mode 100644 spec/fixtures/slinky/stinky.rb diff --git a/spec/code_spec.rb b/spec/code_spec.rb index 0b44b867..3f06e808 100644 --- a/spec/code_spec.rb +++ b/spec/code_spec.rb @@ -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 diff --git a/spec/fixtures/slinky.rb b/spec/fixtures/slinky.rb new file mode 100644 index 00000000..e69de29b diff --git a/spec/fixtures/slinky/stinky.rb b/spec/fixtures/slinky/stinky.rb new file mode 100644 index 00000000..e69de29b