Skip to content

Instantly share code, notes, and snippets.

View ivliaspiration's full-sized avatar

Paul Nossoff ivliaspiration

View GitHub Profile
require 'spec_helper'
describe Person do
before(:each) { @person = Person.new(name: "John", description: "cool guy") }
it { @person.should be_valid }
it 'validates name' do
@person.name = ''
@person.should_not be_valid
end
require 'spec_helper'
describe 'logging in' do
it "lets the admin log in" do
visit login_path
page.should have_css("input#password")
fill_in "password", :with => "secret"
click_on "Log in"
page.should have_content("Sucessfully logged in")
end
@ivliaspiration
ivliaspiration / bootstrap_form_builder.rb
Created March 18, 2012 20:00
Twitter Bootstrap FormBuilder
# FormBuilder for Ruby on Rails which produces HTML code compatible with Twitter Bootstrap
# horizontal forms styles (see here: http://twitter.github.com/bootstrap/base-css.html#forms)
#
# Features:
# * displays validation errors in-line
# * has custom option - label-text - to override default label text for an input
#
# Requirements:
# By default, Rails will wrap a field with validation error in an ugly div tag that breaks
# the layout. To override this behaviour, add