spec/program_spec.rb in rprogram-0.3.1 vs spec/program_spec.rb in rprogram-0.3.2
- old
+ new
@@ -1,14 +1,15 @@
-require 'rprogram/program'
-
require 'spec_helper'
require 'classes/named_program'
require 'classes/aliased_program'
require 'classes/ls_program'
+require 'rprogram/program'
+
describe Program do
- subject { Program.new('/usr/bin/cc') }
+ subject { described_class.new('/usr/bin/cc') }
+
after(:all) { LS.path = nil }
describe "named program" do
subject { NamedProgram }
@@ -102,22 +103,22 @@
subject.to_s.should == '/usr/bin/cc'
end
it "should raise an exception for invalid paths" do
lambda {
- Program.new('/totally/doesnt/exist')
+ described_class.new('/totally/doesnt/exist')
}.should raise_error(ProgramNotFound)
end
it "should find a program from a path" do
- prog = Program.find_with_path('/usr/bin/cc')
+ prog = described_class.find_with_path('/usr/bin/cc')
prog.should_not be_nil
end
it "should find a program from given paths" do
- prog = Program.find_with_paths(['/usr/bin/ls','/bin/ls'])
+ prog = described_class.find_with_paths(['/usr/bin/ls','/bin/ls'])
prog.should_not be_nil
end
it "should be able to find a program based on the program names" do
@@ -126,10 +127,10 @@
File.executable?(ls.path).should == true
end
it "should raise a ProgramNotFound exception if no path/name is valid" do
lambda {
- Program.find
+ described_class.find
}.should raise_error(ProgramNotFound)
end
it "should allow using a default path" do
LS.path = '/bin/ls'