Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added base ruby rspec

  • Loading branch information...
commit d0cefa63032845d74913456c3ffdd81140d52540 1 parent 031a2fc
@jeffgirard authored
View
4 ruby/Gemfile
@@ -1,3 +1,5 @@
source :rubygems
-gem 'cassandra'
+gem 'cassandra'
+gem 'rspec'
+gem 'rspec-mocks'
View
11 ruby/Gemfile.lock
@@ -6,8 +6,17 @@ GEM
rake
simple_uuid (>= 0.2.0)
thrift_client (>= 0.7.0)
+ diff-lcs (1.1.3)
json (1.7.3)
rake (0.9.2.2)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.1)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
simple_uuid (0.2.0)
thrift (0.8.0)
thrift_client (0.8.1)
@@ -18,3 +27,5 @@ PLATFORMS
DEPENDENCIES
cassandra
+ rspec
+ rspec-mocks
View
6 ruby/Mnam.rb → ruby/mnam.rb
@@ -1,11 +1,11 @@
require 'rubygems'
require 'bundler'
require 'cassandra'
-require File.expand_path 'ruby/MnamCass.rb'
+require_relative 'mnam_cass'
module Mnam
- def self.init_group group_name, columns
- Mnam.init
+ def self.force_mnam_cass val
+ @mnam_cass = val
end
def self.write group_name, key, fields
View
0  ruby/MnamCass.rb → ruby/mnam_cass.rb
File renamed without changes
View
0  ruby/MnamGroup.rb → ruby/mnam_group.rb
File renamed without changes
View
0  ruby/spec/mnam_cass_spec.rb
No changes.
View
0  ruby/spec/mnam_group_spec.rb
No changes.
View
25 ruby/spec/mnam_spec.rb
@@ -0,0 +1,25 @@
+require 'rubygems'
+require 'spec_helper'
+
+describe Mnam do
+ before :each do
+ cass_inst = mock('Cassandra')
+ cass_inst.stub(:insert).and_return(true)
+
+ mnam_cass = mock('MnamCass')
+ mnam_cass.stub(:new).and_return(mnam_cass)
+ mnam_cass.stub(:get_cassandra).and_return(cass_inst)
+
+ Mnam.force_mnam_cass(mnam_cass)
+ end
+
+ it 'should write single message' do
+ Mnam.write('login', 'jeff', {:name => 'jeff'}).should be_true
+ end
+
+ it 'should write many messages' do
+ Mnam.write_many('login', [{'jeff' => [:name => 'jeff']}, {'jeff' => [:name => 'jeff']}, {'jeff' => [:name => 'jeff']}]).should be_true
+ end
+
+ it 'should read single message'
+end
View
14 ruby/spec/spec_helper.rb
@@ -0,0 +1,14 @@
+require_relative '../mnam_cass'
+require_relative '../mnam'
+require_relative '../mnam_group'
+
+RSpec.configure do |config|
+ # Use color in STDOUT
+ config.color_enabled = true
+
+ # Use color not only in STDOUT but also in pagers and files
+ config.tty = true
+
+ # Use the specified formatter
+ config.formatter = :documentation # :progress, :html, :textmate
+end
Please sign in to comment.
Something went wrong with that request. Please try again.