Skip to content
This repository was archived by the owner on Apr 26, 2019. It is now read-only.
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/Gemfile.lock
*.gem
*.sw[o,p]
tmp/*
1 change: 1 addition & 0 deletions lib/redness.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "json" unless defined?(JSON)
require "redis" unless defined?(Redis)
require "active_support"
require "active_support/core_ext" unless defined?(ActiveSupport)

require "precisionable"
Expand Down
4 changes: 4 additions & 0 deletions lib/redness/red_capped_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def get
RedList.get(key)
end

def get_strings
RedList.get_strings(key)
end

def add(value)
RedList.add(key, value)
RedList.trim_to(key, cap)
Expand Down
14 changes: 14 additions & 0 deletions spec/redness/red_capped_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
end
end

describe "#get_strings" do
it "returns the string values of the list at the key" do
r = RedCappedList.new("somekey", 2)

r.get_strings.should == []

r.add("foo")
r.add("bar")
r.add("baz")

r.get_strings.should == ["baz", "bar"]
end
end

describe "#add" do
it "adds to the list at the key" do
r = RedCappedList.new("somekey", 1000)
Expand Down
1 change: 1 addition & 0 deletions spec/spec_integration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

require 'rspec'
require 'redis'
require 'active_support'
require 'active_support/core_ext'
require 'timecop'

Expand Down