This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SecureSomething | |
include Mongoid::Document | |
field :private_field | |
field :public_field, :accessible => true | |
protected_by_default! | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |