Skip to content

Instantly share code, notes, and snippets.

['a','b','c'].each do |char|
it "returns xxx for #{char}" do
process(char).should == 'xxx'
end
end
it 'creates a request' do
generator = double('typheous request generator')
generator.should_receive(:create).with("name", 42)
my_obj = MyObject.new(generator)
my_obj.some_method_that_means_something_to_my_domain
end
require 'support/client_user'
before(:all) do
login_user(valid_client.user, valid_client.password)
end
# This is a test helper class
class UI
attr_reader :page
def initialize(page)
@page = page
end
def title
describe "lots of tests" do
100_000.times do |i|
it "tests #{i}" do
i.should eql(i)
end
end
end
def whatever(message)
if message.respond_to? :to_expectation_message
message = message.to_expectation_message
end
message = message.to_str
# ... code with message
end
describe 'let' do
let(:array) { [] }
it "adds" do
array << 1
array.should have(1).item
end
it "adds again" do
array << 2
PredictionGatekeeper
viewing predictions
a third party cannot see the prediction
before the prediction due date
the creator can reveal the prediction
the victim can only view prediction metadata
after the prediction due date
the creator can view the prediction
the victim can view the prediction
revealing predictions
def self.get_random_quiz
quiz_ids = Quiz.all.map(&:id) # simplified to use a symbol proc
random_ids = quiz_ids.shuffle
Quiz.find(random_ids.first)
end
# Misspelled, should be "Challenge"
it "retrieves a random quiz" do
quiz_a = FactoryGirl.create(:quiz_A)
if ENV['SELENIUM_BROWSER']
Capybara.register_driver :selenium do |app|
browser = ENV['SELENIUM_BROWSER'].to_sym
Capybara::Selenium::Driver.new(app, :browser => browser)
end
end