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
assert_select "a[onclick*=?]", /setAttribute\(\'value\'\,\s\'delete\'\)/ |
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
validate :"that I don't have any balls" | |
define_method "that I don't have any balls" do | |
false | |
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
> bits = [15.8, 8.0, 9.4, 3.0, 1.6, 2.0, 12.0, 4.8, 1.7, 6.0, 3.0, 17.7, 6.0, 4.0, 3.0, 2.0] | |
=> [15.8, 8.0, 9.4, 3.0, 1.6, 2.0, 12.0, 4.8, 1.7, 6.0, 3.0, 17.7, 6.0, 4.0, 3.0, 2.0] | |
> result = bits.inject(0.0) {|sum, v| sum += v} | |
=> 100.0 | |
> result > 100.0 | |
=> true | |
> # huh!? why is 100.0 > 100.0 | |
> # Although admittedly this is in Ruby 1.8.4 |
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 'rubygems' | |
require 'smqueue' | |
# This script shows how posting to separate queues with the same client id blows up | |
def default_config | |
# Change host to whatever activemq host you want to use | |
{:adapter => "StompAdapter", :host => "localhost", :reliable => false} | |
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
# You can use a param variable in another params default value, like this: | |
def get_name(firstname, lastname, error_message="You blew it #{firstname}, you messed up") | |
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
# Turns a fixture file name into a full path | |
def fixture_file(filename) | |
return '' if filename == '' | |
ERB.new(File.read(File.expand_path(RAILS_ROOT + '/spec/fixtures/' + filename))).result(binding) | |
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
Business value and MMF | |
====================== | |
You should discuss the “In order to” part of the feature and pop the why | |
stack max 5 times (ask why recursively) until you end up with one of the | |
following business values: | |
* Protect revenue | |
* Increase revenue | |
* Manage cost | |
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 File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe Event do | |
it "should be refillable if the event is floating and not complete" do | |
event = Event.new(:complete => false) | |
event.stub!(:floating?).and_return true | |
event.should be_refillable | |
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
def schedule_task_to_next_available_worker(task) | |
@workers.each do |worker| | |
task_scheduler = TaskScheduler.new(worker.bucket) | |
if task_scheduler.task_valid_for_putting_into_buckets?(task) | |
task_scheduler.schedule_task(task) | |
if !worker.bucket.has_warning?(:overdue) | |
remove_task_from_workers_events(worker, task) | |
worker.bucket.clear_warnings! |
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 schedule_task_to_next_available_worker(task) | |
@workers.each do |worker| | |
task_scheduler = TaskScheduler.new(worker.bucket) | |
if task_scheduler.task_valid_for_putting_into_buckets?(task) | |
task_scheduler.schedule_task(task) | |
if !worker.bucket.has_warning?(:overdue) | |
if !any_workers_after_this_one_have_hat(task.hat) | |
@tasks_past_deadline << task |
OlderNewer