Skip to content

Instantly share code, notes, and snippets.

View tjtuom's full-sized avatar

Toni Tuominen tjtuom

View GitHub Profile
(ns statistics-one.core
(:use [incanter core stats charts]))
(view (histogram (sample-normal 1000)))
Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
with_scope(selector) do
if defined?(Spec::Rails::Matchers)
page.should have_xpath("//*[text()='#{text}']", :visible => true)
else
assert page.has_xpath("//*[text()='#{text}']", :visible => true)
end
end
end
module DateHelper
def auction_date(date)
I18n.localize date, :format => :auction
end
end
context "build" do
should "update collection without save" do
project = Project.create
project.statuses.build(:name => 'Foo')
project.statuses.size.should == 1
end
should "save built document when saving parent" do
project = Project.create
status = project.statuses.build(:name => 'Foo')
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/gists/219223.txt
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"