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 @house_search do |form| %> | |
<div> | |
<%= form.label :keyword %> | |
<%= form.text_field :keyword %> | |
</div> | |
<div> | |
<%= form.label :price %> | |
<%= form.select :price, [['20-30', '20-30k']] %> | |
</div> | |
<div> |
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 HouseSearchTest < ActiveSupport::TestCase | |
should "produce only houses with the keyword in the description when sent #results for such a search" do | |
matching_house = Factory(:house, :description => 'foo') | |
nonmatching_house = Factory(:house, :description => 'bar') | |
results = HouseSearch.new('keyword' => 'fo').results | |
assert_all(results) {|house| house.description =~ /fo/} | |
end | |
should "produce only houses within the price range when sent #results for such a search" do | |
matching_house = Factory(:house, :price => 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
class HouseSearchTest < ActiveSupport::TestCase | |
should "build a new HouseSearch with the expected params" do | |
params = {'keyword' => 'some keyword', | |
'price' => '20-30'} | |
house_search = HouseSearch.new(params) | |
params.each do |field, value| | |
assert_equal value, house_search.send(field) | |
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
class HouseSearchesTest < ActionController::TestCase | |
should_route :get, '/house_searches', | |
:controller => :house_searches, | |
:action => :index | |
context "GET to index with houses" do | |
setup do | |
@houses = [Factory.stub(:house), Factory.stub(:house)] | |
@search = HouseSearch.new | |
HouseSearch.stubs(:new).returns(@search) |
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 SlideshowsController < ApplicationController | |
before_filter :authenticate, :authorize | |
def show | |
if file_exists?(file) | |
render :file => file | |
else | |
render :nothing => true, :status => 404 and return false | |
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
slidedown tdd.md --template=import > tdd.html |
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
!SLIDE | |
## why automated tests? | |
 | |
!SLIDE | |
* prevent regressions | |
* prove functionality with executable code |
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
sudo gem install nakajima-slidedown | |
vim tdd.md |
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
#bee_button a {background-position: 0 0;} | |
#bee_button a:hover {background-position: 0 -41px;} | |
#bee button a:active {background-position: 0 -82px;} |
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
#bee_button a { | |
display: block; | |
text-indent: -5000px; | |
width: 136px; | |
height: 41px; | |
background-image: url(/images/bee_button.png); | |
background-repeat: no-repeat; | |
} |