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
partial included in listing form | |
<p> | |
<% form.fields_for :address do |address_form| %> | |
<%= render :partial => '/addresses/address_form', :object => address_form %> | |
<% end %> | |
</p> | |
neighbourhood select in address form | |
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 Address < ActiveRecord::Base | |
belongs_to :listing | |
belongs_to :neighbourhood | |
belongs_to :creator, :class_name => User, :foreign_key => 'creator_id' | |
belongs_to :updater, :class_name => User, :foreign_key => 'updater_id' | |
end | |
# == Schema Information | |
# |
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
<p> | |
<%= address_form.label :street_1 %><br /> | |
<%= address_form.text_field :street_1 %> | |
</p> | |
<p> | |
<%= address_form.label :street_2 %><br /> | |
<%= address_form.text_field :street_2 %> | |
</p> | |
<p> | |
<%= address_form.label :landmark %><br /> |
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 BuildPostProcessor | |
def notify_on_failure(&block) | |
on_failure_notifier = BuildNotification.new | |
@build_statuses[:failure] << [block, on_failure_notifier] | |
end | |
def on_success_build_artifacts(artifacts_builder) | |
@build_statuses[:success] << artifacts_builder.new | |
yield(artifacts_builder.new) | |
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
class AppAuthHeaders | |
cattr_accessor :remember_token | |
def self.headers | |
remember_token.blank? ? {"Authorization" => ""} : {"Authorization" => "RememberToken #{self.remember_token}"} | |
end | |
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
require 'spec_helper' | |
class DummyApplicationController < ApplicationController | |
before_filter :require_authentication, :only => :authenticated_resource | |
before_filter :check_if_self, :only => :dummy_method_to_test_check_for_self | |
def get_action | |
render :nothing => true | |
end | |
def authenticated_resource |
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
context "context of a small business scenario" | |
should "exact business requirement" do | |
<on doing this> | |
<this happens> | |
end | |
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
#bad example | |
assert_equal 4, payment.code | |
#good example | |
assert_equal Payment::Status::CANCELLED, payment.code |
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
#with rspec | |
payment.should be_cancelled |
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
A method stub | |
ignores when expected message is received with no args | |
allows a stub and an expectation | |
instructs an instance to respond_to the message | |
calculates return value by executing block passed to #and_return | |
handles multiple stubbed methods | |
ignores when expected message is not received | |
instructs a class object to respond_to the message | |
overrides a pre-existing method | |
keeps returning last value in consecutive calls |
OlderNewer