Skip to content

Instantly share code, notes, and snippets.

var ars = new Ars("/", "1272473031.21335", "beer");
asyncTest("a consumer boots", function() {
expect(1);
ars.boot(function(){
ok(ars.sections instanceof Object, "sections populated");
start();
});
});
asyncTest("a user requests a list of entries", function() {
class SecureSomething
include Mongoid::Document
field :private_field
field :public_field, :accessible => true
protected_by_default!
end
module Rankable
extend ActiveSupport::Concern
included do
field :ratings_value_sum, :type => Integer, :default => 0
field :ratings_count, :type => Integer, :default => 0
embeds_many :ratings
end
@import "css3";
@include border-radius(10px);
border: 1px solid yellow;
color: white;
position: relative;
min-height: 500px;
overflow: hidden;
background-color: #003300;
margin: 3% 30%;
require 'spec_helper'
describe OauthController do
before(:all) do
@consumer = Factory.create(:oauth_consumer)
end
context 'serving an xauth token request to a valid consumer' do
before(:all) do
@user = Factory.create(:user)
#adds tags where categories don't match up
if data.has_key?('categories')
tags = data['tags'] || []
placement_tags = []
data['categories'].values.map{|c| c.split('/')}.flatten.each do |cat|
unless cat.empty? || tags.include?(cat) || placement_tags.include?(cat)
cat = '@' + cat
placement_tags << cat unless tags.include?(cat) || placement_tags.include?(cat)
end
irb(main):030:0> s = Story.new
=> #<Story _id: 4bc8761e8f80a9282c000004, slug: nil, credits_amount_sum: 0, title: nil, proposal_id: nil>
irb(main):031:0> s.save
=> true
irb(main):032:0> s.id
=> "4bc8761e8f80a9282c000004"
> db.stories.findOne('4bc8761e8f80a9282c000004')
{
def transfer_credits_to(target, amount, message = nil)
debit = Credit.new(:amount => amount * -1, :message => message)
debit.source = target
debit_params = {"_id" => self.id, "credits_amount_sum" => {'$gte' => amount}}
debit_attrs = {
'$push' =>
{'credits' => debit.raw_attributes},
'$inc' =>
{'credits_amount_sum' => debit.amount}
diff --git a/spec/unit/mongoid/dirty_spec.rb b/spec/unit/mongoid/dirty_spec.rb
index e412abc..43103c9 100644
--- a/spec/unit/mongoid/dirty_spec.rb
+++ b/spec/unit/mongoid/dirty_spec.rb
@@ -45,6 +45,18 @@ describe Mongoid::Dirty do
end
end
+ context "when the attribute is mutated in place" do
+ before do
kurt@kurtix:~/Documents/Projects/hector$ rake
(in /home/kurt/Documents/Projects/hector)
/usr/bin/ruby1.8 -I"lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/session_test.rb" "test/unit/identity_test.rb" "test/unit/request_test.rb" "test/unit/irc_error_test.rb" "test/integration/messaging_test.rb" "test/integration/connection_test.rb"
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
EEEEEEEEE..........EE.....EEEFEE
Finished in 0.025307 seconds.
1) Error:
test :"connecting with a valid password should create a session"(Hector::ConnectionTest):