Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/nanite/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Mapper

DEFAULT_OPTIONS = COMMON_DEFAULT_OPTIONS.merge({
:user => 'mapper',
:identity => Identity.generate,
:agent_timeout => 15,
:offline_redelivery_frequency => 10,
:persistent => false,
Expand Down Expand Up @@ -114,6 +113,7 @@ def initialize(options)
end
options.delete(:identity) unless options[:identity]
@options.update(custom_config.merge(options))
@options[:identity] ||= Identity.generate
@identity = "mapper-#{@options[:identity]}"
@options[:file_root] ||= File.join(@options[:root], 'files')
@options[:log_path] = false
Expand Down
8 changes: 8 additions & 0 deletions spec/mapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
it "should set the file root" do
@mapper.options[:file_root].should == File.expand_path("#{File.dirname(__FILE__)}/../files")
end

it "should generate a new identity when not provided in the options or config file" do
@mapper1 = Nanite::Mapper.new({:root => ''})
@mapper2 = Nanite::Mapper.new({:root => ''})
@mapper1.identity.should =~ /mapper-.+/
@mapper2.identity.should =~ /mapper-.+/
@mapper1.identity.should_not == @mapper2.identity
end
end

describe "Starting" do
Expand Down