Skip to content

Let lock to use redis_options method #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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/redis/objects/locks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def lock(name, options={})
instance_variable_get(ivar_name) or
instance_variable_set(ivar_name,
Redis::Lock.new(
redis_field_key(lock_name), redis_field_redis(lock_name), redis_objects[lock_name.to_sym]
redis_field_key(lock_name), redis_field_redis(lock_name), redis_options(lock_name)
)
)
end
Expand Down
9 changes: 9 additions & 0 deletions spec/redis_objects_model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,15 @@ class CustomIdFieldRoster < UidRoster
VanillaRoster.last_player.should.be.kind_of(Redis::Value)
end

it "should allow subclass objects to get options from superclass" do
@vanilla_roster.available_slots.options[:start].should == 10
@vanilla_roster.contact_information.options[:marshal_keys].should == { 'updated_at'=> true }
@vanilla_roster.resort_lock.options[:timeout].should == 2
@vanilla_roster.starting_pitcher.options[:marshal].should == true
@vanilla_roster.player_stats.options[:marshal].should == true
@vanilla_roster.outfielders.options[:marshal].should == true
end

it "should allow subclass overrides of the same redis object" do
@roster.basic.should == 0
@custom_roster.basic.increment.should == 1
Expand Down