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
| class Foo | |
| def self.capping_bar | |
| alias_method :orig_bar, :bar | |
| def bar; 'BAR'; end | |
| yield | |
| alias_method :bar, :orig_bar | |
| end | |
| def bar; 'bar'; 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
| 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
| TODOS = [] | |
| def todo(message) | |
| TODOS << "TODO: #{message}\n#{caller(0)[1]}" | |
| end | |
| module Cucumber | |
| module Formatters | |
| class PrettyFormatter | |
| alias_method :orig_dump, :dump |
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 SavingsAccount do | |
| it_should fullfill_role("account") do |contract| | |
| contract.overdraft do |account| | |
| initial_balance = account.balance | |
| account.withdraw(initial_balance + 1) | |
| account.balance.should == initial_balance | |
| 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
| var execute_search = function(ordinal) { | |
| jQuery.ajax({ | |
| type: "GET", | |
| url: jQuery('#asset-search-xml-src').attr('value'), | |
| dataType: "xml", | |
| success: function(xml) { | |
| clear_search_results(ordinal); | |
| jQuery(xml).find('asset').each(function(i, xml_asset) { | |
| asset = new WrappedXmlAsset(xml_asset, ordinal); | |
| if (asset.matches(jQuery('#assets-search-' + ordinal + ' input')[0].value)) { |
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 InstanceVariableHelpers | |
| def set_ivar(type, name, obj) | |
| instance_variable_set ivar_name(type, name), obj | |
| end | |
| def get_ivar(type, name) | |
| returning instance_variable_get(ivar_name(type, name)) do |obj| | |
| yield obj if block_given? | |
| 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
| <% form_for(@user) do |f| %> | |
| ... | |
| <% f.check_boxes_for :roles do |role| %> | |
| <%= role.check_box %> | |
| <%= role.label :name %><br/> | |
| <% end %> | |
| <% end %> | |
| ... or ... | |
OlderNewer