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
Company A: $1,000 - $3,000 | |
Company B: $6,000 - $10,000 | |
Company C: $500 - $2,500 |
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
Feature: Allowing users to vote for an answer | |
As a visitor to the FAQ site | |
I want to be able to vote for the answer I think is best | |
In order to crowd-source the question having the most relevant answer | |
Scenario: I can vote for an answer | |
Given there is a question "What is jam?" | |
And it has been answered "Lovely sticky fruit stuff, best smeared on toast" | |
And it has been answered "A problem with too much traffic" | |
When I am on the page for question "What is jam?" |
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
module PublishingLogic | |
module Migrations | |
class AddProgrammes < ActiveRecord::Migration | |
def self.up | |
create_table :programmes do |t| | |
t.boolean :publishing_enabled | |
t.datetime :published_at | |
t.datetime :published_until | |
t.timestamps | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'date' | |
#location = 'http://www.howdoesitfeel.co.uk/podcast.html' | |
location = './podcast.html' |
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
module Capybara::Driver | |
class Envjs | |
PreTypingEvents = ['focus'] | |
TypingEvents = ['keydown', 'keypress', 'keyup'] | |
PostTypingEvents = ['change', 'blur'] | |
def self.type_into(field, value) | |
PreTypingEvents.each { |e| field.trigger(e) } | |
field.set(value) | |
TypingEvents.each { |e| field.trigger(e) } |
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
-- | |
def stub_oauth! | |
TwitterAuth.stub!(:config).and_return({ | |
'strategy' => 'oauth', | |
'oauth_consumer_key' => 'testkey', | |
'oauth_consumer_secret' => 'testsecret' | |
}) | |
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
# ARCHFLAGS may or may not matter - I set mine up this way just in case. | |
~$ echo $ARCHFLAGS | |
-arch i386 -arch x86_64 | |
# Be sure to compile ruby with --enable-shared | |
~$ rvm install 1.9.1 --debug --reconfigure -C --enable-shared=yes | |
# Test to ensure that --enable-shared worked | |
~$ ruby -e "require 'rbconfig'; puts Config::CONFIG['ENABLE_SHARED']" | |
yes |
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
# something like ... | |
# I think this goes in specs/support/whatever.rb | |
def it_should_be_invalid_without(*fields) | |
object_name = described_class.name.underscore | |
fields.each do |field| | |
it "should fail if #{field} is missing" do | |
instance_variable_get("@#{object_name}").send(:"#{field}=", nil) | |
instance_variable_get("@#{object_name}").should_not be_valid_for_create |
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 SomeController | |
before_filter :find_product | |
before_filter :sanitise_segment | |
def show | |
@product.reviews.for_segment(@segment).order_by(sort_order) | |
end | |
def show_extended_detail |
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
# Assuming AR test models are present... | |
# The salient bits are: | |
# | |
# class Developer < ActiveRecord::Base | |
# has_many :audit_logs | |
# end | |
# | |
# class AuditLog < ActiveRecord::Base | |
# belongs_to :developer, :validate => true | |
# end |