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 'spec_helper.rb' | |
describe "Migration" do | |
before(:all) do | |
MyModel = Object.new | |
require 'my_migration' | |
end | |
before(:each) do |
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
Spec::Matchers.create(:be_successful) do | |
matches do |rack| | |
rack.status == 200 | |
end | |
message do |not_string, rack| | |
"Expected #{describe_request(rack)}#{not_string} " \ | |
"to be successful, but it returned a #{rack.status}" | |
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
<p><b>Title:</b> <%=h @race.title %></p> | |
<p><b>State:</b> <%=h @race.state.title %></p> | |
<p><b>Racetype:</b> <%=h @race.racetype.title %></p> | |
<hr> | |
<h3>Questions</h3> | |
<% form_tag :action => :manage_questions, :id => @race do %> | |
<table> |
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.dirname(__FILE__) + '/../spec_helper' | |
class Foo | |
def self.per_page | |
10 | |
end | |
end | |
describe Foo do | |
should_have_per_page 10 |
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
given "logged in" do | |
login | |
end | |
given "anonymous" do end | |
describe "Homepage: url(:home)", :given => "logged in" do | |
before(:each) do | |
@rack = request(:home) | |
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
Feature: Compile C code into Ruby extensions. | |
In order to automate compilation process. | |
As a Gem developer. | |
I want rake tasks compile source code for me. | |
Scenario: Compile single extension | |
Given a safe project directory | |
And scaffold code for extension 'extension_one' | |
And 'tmp' folder is deleted |
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
resource 'posts/:id' do |id| | |
get do | |
# show post id | |
end | |
delete do | |
# destroy post id | |
end | |
get :comments do |
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 'A Collection' do | |
subject { Collection.new } | |
action { clear } | |
should_return_self | |
should_clear_itself | |
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
module Matchers | |
class HaveNotice | |
def initialize(contents, scope) | |
@contents, @scope = contents, scope | |
end | |
def matches?(response) | |
response.should @scope.have_tag('div.notice', @contents) | |
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
class Cart < ActiveRecord::Base | |
has_many :items, :class_name => 'CartItem', :dependent => :destroy | |
# ... | |
def empty! | |
items.each(&:destroy) | |
self | |
end | |
OlderNewer