This file contains 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
#blue API tokens | |
=============== | |
George (07716354418) - *d204423528650370012868f1c96c6407* | |
Julian (07716354340) - *d204423528650370012868ea84466226* | |
Anne (07716354432) - *d204423928681a7f012868f1434e4834* | |
Timmy (07716354419) - *d204423a28681c3b012868f6db715a59* | |
Dick (07716354406) - *d204423a28681c3b012868fd10f25cf1* | |
This file contains 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
context "Given a bunch of stuff" do | |
setup do | |
@thing = Factory(:thingy) | |
@user = Factory(:user) | |
@user.register_with(@thing) | |
end | |
# THIS is the code I'm actually testing, isolated from the rest of the setup | |
action("the user activates the thing") do | |
@user.activate(@thing) |
This file contains 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
# I've been thinking about high level testing, and trying to describe behaviour in ways that | |
# make it easier to add new tests in the future. Using Chromaroma collections as a base, | |
# here are some thoughts: | |
# So, starting with the first tests that we might write: | |
a normal player | |
should not be able to view the collection admin page | |
should not be able to create a new collection | |
should not be able to edit an existing collection |
This file contains 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 "ruby_manor_participation" | |
conversations = YAML.load_file("ruby_manor_participation.yml") | |
manor_harder = conversations.select { |c| Date.parse(c.date) > Date.parse("2009-10-01") } | |
conversations_by_participant = manor_harder.inject({}) do |a, c| | |
c.participants.uniq.each do |p| | |
a[p] ||= [] | |
a[p] << c | |
end |
This file contains 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
source :rubygems | |
gem 'rails', '2.3.4' | |
gem 'mysql' | |
gem 'RedCloth' | |
gem 'is_paranoid' # though apparently it's deprecated: http://blog.semanticart.com/killing_is_paranoid/ | |
gem 'freerange-deploy', :git => "git://github.com/freerange/deploy.git" | |
gem 'freerange-puppet', :git => "git://github.com/freerange/freerange-puppet.git", :branch => "support-ubuntu" |
This file contains 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 BetterNews | |
def initialize(string, required) | |
@age = required | |
@string = string | |
end | |
attr_reader :age | |
def method_missing(name, *args) | |
self.class.new(@string.send(name, *args), @age) |
This file contains 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
context "a thing" do | |
setup do | |
@mailer = TestMailer.new | |
@thing = Thing.new(@mailer) | |
end | |
should "send an email when poked" do | |
@mailer.expects(:send_email) | |
@thing.poke | |
end |
This file contains 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
context "Posting" do | |
# this is what we are testing, and is run for each test | |
action do | |
post "/#{@stream}/messages?type=#{@type}&oauth_token=#{@token}", @payload | |
end | |
# this is basically setup, but describing the values as defaults clarifies their | |
# relationship to the action above. each further setup or test can modify these values | |
# before the action is actually invoked. | |
defaults do |
This file contains 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
# put this in your .irbrc | |
class Object | |
def __edit_method(method_name, object=self) | |
method = object.method(method_name.to_sym) | |
`open txmt://open?url=file://#{method.__file__}&line=#{method.__line__}` | |
end | |
end |
This file contains 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
#!/bin/sh | |
wget -O - --save-cookies cookies.txt --post-data "save_login=1&email=EMAIL&password=PASSWORD" http://SITE/session > /dev/null | |
wget -r -l 1 --spider --save-cookies cookies.txt --load-cookies cookies.txt http://SITE/home |