Skip to content

Commit

Permalink
Fix failing specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Gleeson committed May 22, 2011
1 parent c22c9ac commit fb73589
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/yard/cli/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def optparse(*args)
parse_options(opts, args)

if args.empty? && libraries.empty?
if !File.exist?('.yardoc')
if !File.exist? File.expand_path('.yardoc')
log.enter_level(Logger::INFO) do
log.info "No .yardoc file found in current directory, parsing source before starting server..."
end
Expand Down
14 changes: 7 additions & 7 deletions spec/cli/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def unstub_adapter

def run(*args)
if @libraries.empty?
library = Server::LibraryVersion.new(File.basename(Dir.pwd), nil, '.yardoc')
library = Server::LibraryVersion.new(File.basename(Dir.pwd), nil, File.expand_path('.yardoc'))
@libraries = {library.name => [library]}
end
unless @no_verify_libraries
@libraries.values.each {|libs| libs.each {|lib| File.should_receive(:exist?).at_least(1).times.with(lib.yardoc_file).and_return(true) } }
@libraries.values.each {|libs| libs.each {|lib| File.should_receive(:exist?).at_least(1).times.with(File.expand_path(lib.yardoc_file)).and_return(true) } }
end
unless @no_adapter_mock
@cli.stub!(:adapter).and_return(@adapter)
Expand All @@ -40,19 +40,19 @@ def run(*args)

it "should default to current dir if no library is specified" do
Dir.should_receive(:pwd).and_return('/path/to/foo')
@libraries['foo'] = [Server::LibraryVersion.new('foo', nil, '.yardoc')]
@libraries['foo'] = [Server::LibraryVersion.new('foo', nil, File.expand_path('.yardoc'))]
run
end

it "should use .yardoc as yardoc file is library list is odd" do
@libraries['a'] = [Server::LibraryVersion.new('a', nil,'.yardoc')]
@libraries['a'] = [Server::LibraryVersion.new('a', nil, File.expand_path('.yardoc'))]
run 'a'
end

it "should force multi library if more than one library is listed" do
@options[:single_library] = false
@libraries['a'] = [Server::LibraryVersion.new('a', nil, 'b')]
@libraries['c'] = [Server::LibraryVersion.new('c', nil, '.yardoc')]
@libraries['a'] = [Server::LibraryVersion.new('a', nil, File.expand_path('b'))]
@libraries['c'] = [Server::LibraryVersion.new('c', nil, File.expand_path('.yardoc'))]
run %w(a b c)
end

Expand Down Expand Up @@ -167,4 +167,4 @@ def run(*args)
end
end
end
end
end

0 comments on commit fb73589

Please sign in to comment.