spec/lifeboat_spec.rb in lifeboat-0.3.1 vs spec/lifeboat_spec.rb in lifeboat-0.4.0
- old
+ new
@@ -1,7 +1,10 @@
require 'rubygems'
require 'rspec'
+
+RAILS_ENV = "testing"
+
require 'lifeboat'
config = YAML::load(IO.read(File.dirname(__FILE__) + '/../config/database.yml'))
ActiveRecord::Base.logger =
@@ -40,11 +43,10 @@
class XMLRecord < ActiveRecord::Base
attr_accessor :name
has_lifeboat :format => :xml
end
-RAILS_ENV = "test"
class Helper
def self.clean_all_queues
@sqs = RightAws::SqsGen2.new(Credentials.key,Credentials.secret)
@sqs.queues.each do |queue|
@@ -106,38 +108,38 @@
Helper.clean_all_queues
end
it "reads messages from a cue" do
Fake.create(:name => "ivan")
- messages = LifeBoat.read_queue("create_fake_test")
+ messages = LifeBoat.read_queue("create_fake_testing")
messages.size.should == 1
end
it "the message it creates contains the attributes ob the object as json" do
f = Fake.create(:name => "ivan")
- q = LifeBoat.read_queue("create_fake_test")
+ q = LifeBoat.read_queue("create_fake_testing")
q[0].body.should == f.attributes.to_json
end
it "creates a destroy SQS queue when parent is destroyed" do
f = Fake.create(:name => "updated")
f.destroy
- messages = LifeBoat.read_queue("destroy_fake_test")
+ messages = LifeBoat.read_queue("destroy_fake_testing")
messages.size.should == 1
end
it "updates SQS queue when parent is updated" do
f = Fake.create(:name => "Er Update")
f.name= "28347834" ; f.save
- messages= LifeBoat.read_queue("update_fake_test")
+ messages= LifeBoat.read_queue("update_fake_testing")
messages.size.should == 1
end
end
describe LifeBoat, " does XML" do
it "serialices the objects to xml" do
f = XMLRecord.create(:name => "Yo soy XML")
- messages = LifeBoat.read_queue("create_xmlrecord_test")
+ messages = LifeBoat.read_queue("create_xmlrecord_testing")
messages.size.should == 1
messages[0].body.should == f.attributes.to_xml
end
end