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
['a','b','c'].each do |char| | |
it "returns xxx for #{char}" do | |
process(char).should == 'xxx' | |
end | |
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
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 |
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 'support/client_user' | |
before(:all) do | |
login_user(valid_client.user, valid_client.password) | |
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
# This is a test helper class | |
class UI | |
attr_reader :page | |
def initialize(page) | |
@page = page | |
end | |
def title |
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
describe "lots of tests" do | |
100_000.times do |i| | |
it "tests #{i}" do | |
i.should eql(i) | |
end | |
end | |
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 whatever(message) | |
if message.respond_to? :to_expectation_message | |
message = message.to_expectation_message | |
end | |
message = message.to_str | |
# ... code with message | |
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
describe 'let' do | |
let(:array) { [] } | |
it "adds" do | |
array << 1 | |
array.should have(1).item | |
end | |
it "adds again" do | |
array << 2 |
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
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 |
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 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) |
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
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 |