Permalink
Browse files

add preliminary test, and ignore Gemfile.lock

  • Loading branch information...
Jay Bhat
Jay Bhat committed Apr 12, 2012
1 parent eaa64e9 commit 9a923d878c1e984042d0d18653696ca5cf6de8dc
Showing with 32 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +1 −1 cassandra-queue.gemspec
  3. +21 −0 test/queue_test.rb
  4. +9 −0 test/test_helper.rb
View
@@ -1 +1,2 @@
*.gem
+Gemfile.lock
View
@@ -27,7 +27,7 @@ EOS
s.add_dependency "cassandra"
- s.add_development_dependency "bundler", "~> 1.0.10"
+ s.add_development_dependency "bundler", "~> 1.1"
s.add_development_dependency "scope", "~> 0.2.1"
s.add_development_dependency "mocha"
s.add_development_dependency "rake"
View
@@ -0,0 +1,21 @@
+require_relative "test_helper"
+
+class QueueTest < Scope::TestCase
+ context "with cassandra queue" do
+ setup do
+ @cassandra = mock("Cassandra")
+ ::Cassandra.stubs(:new).returns @cassandra
+ @qid = mock "qid"
+ @queue = CassandraQueue::Queue.get_queue(@qid)
+ @cf = :BytesQueue
+ @tid = mock "tuuid"
+ SimpleUUID::UUID.stubs(:new).returns(@tid)
+ @message = mock "message"
+ end
+
+ should "insert into cassandra when asked to" do
+ @cassandra.expects(:insert).with(@cf, @qid, {@tid => @message}, {})
+ @queue.push(@message)
+ end
+ end
+end
View
@@ -0,0 +1,9 @@
+require "rubygems"
+require "bundler"
+Bundler.require(:default, :development)
+require "minitest/autorun"
+
+# For testing Termite itself, use the local version *first*.
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
+
+require "cassandra-queue"

0 comments on commit 9a923d8

Please sign in to comment.