redtastic 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ return 'bar'
@@ -0,0 +1 @@
1
+ return KEYS[1]..ARGV[1]
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe Redtastic::ScriptManager do
4
+ before do
5
+ Redtastic::ScriptManager.flush_scripts
6
+ Redtastic::ScriptManager.load_scripts('./spec/sample_scripts')
7
+ end
8
+
9
+ it 'allows the script to be called from the script manager' do
10
+ expect(Redtastic::ScriptManager.sample).to eq('bar')
11
+ end
12
+
13
+ it 'allows keys and argv to be passed into script' do
14
+ keys = []
15
+ argv = []
16
+ keys << 'foo'
17
+ argv << 'bar'
18
+ expect(Redtastic::ScriptManager.sample_with_args(keys, argv)).to eq('foobar')
19
+ end
20
+
21
+ it 'throws an error if it has not loaded the script being called' do
22
+ expect { Redtastic::ScriptManager.foo }.to raise_error(RuntimeError)
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter '/spec/'
4
+ end
5
+
6
+ require 'coveralls'
7
+ Coveralls.wear!
8
+
9
+ require 'redtastic'
10
+ require 'dotenv'
11
+
12
+ # Using a mock redis library (such as fakeredis) for testing does not work in this situation, since it does
13
+ # not support lua scripts or certain bitmap methods. Thus, we need to use a real instance of redis for testing.
14
+ # So that it does not overwrite any sensitive information on a locally running redis instance, specify the port you
15
+ # would like the test instance of redis to run with the variable REDIS_PORT in your .env.test file.
16
+ # Remember to boot up a redis instance on this port before running the test suite (ie. $redis-server --port 9123)
17
+ Dotenv.load('.env.test')
18
+ fail('Specify REDIS_PORT in your .env.test') unless ENV['REDIS_PORT'].present?
19
+ redis = Redis.new(host: 'localhost', port: ENV['REDIS_PORT'])
20
+
21
+ RSpec.configure do |config|
22
+ config.before(:each) do
23
+ Redtastic::Connection.establish_connection(redis, 'app1')
24
+ Redtastic::Connection.redis.flushdb
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe DiVita
@@ -144,7 +144,33 @@ executables: []
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
+ - .gitignore
148
+ - .rubocop.yml
149
+ - .travis.yml
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - README.md
147
153
  - lib/redtastic.rb
154
+ - lib/redtastic/connection.rb
155
+ - lib/redtastic/model.rb
156
+ - lib/redtastic/script_manager.rb
157
+ - lib/redtastic/scripts/data_points_for_keys.lua
158
+ - lib/redtastic/scripts/hmfind.lua
159
+ - lib/redtastic/scripts/hmincrby.lua
160
+ - lib/redtastic/scripts/msadd.lua
161
+ - lib/redtastic/scripts/msismember.lua
162
+ - lib/redtastic/scripts/msrem.lua
163
+ - lib/redtastic/scripts/msunion.lua
164
+ - lib/redtastic/scripts/sum.lua
165
+ - lib/redtastic/scripts/union_data_points_for_keys.lua
166
+ - lib/redtastic/version.rb
167
+ - redtastic.gemspec
168
+ - spec/connection_spec.rb
169
+ - spec/model_spec.rb
170
+ - spec/sample_scripts/sample.lua
171
+ - spec/sample_scripts/sample_with_args.lua
172
+ - spec/script_manager_spec.rb
173
+ - spec/spec_helper.rb
148
174
  homepage: https://github.com/bellycard/redtastic
149
175
  licenses: []
150
176
  metadata: {}
@@ -169,4 +195,10 @@ signing_key:
169
195
  specification_version: 4
170
196
  summary: A simple, Redis-backed interface for storing, retrieving, and aggregating
171
197
  analytics
172
- test_files: []
198
+ test_files:
199
+ - spec/connection_spec.rb
200
+ - spec/model_spec.rb
201
+ - spec/sample_scripts/sample.lua
202
+ - spec/sample_scripts/sample_with_args.lua
203
+ - spec/script_manager_spec.rb
204
+ - spec/spec_helper.rb