Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Adding factory girl and model test. Adding respond_to_mobile_requests…
Browse files Browse the repository at this point in the history
… to ApplicationController
  • Loading branch information
tscolari committed Sep 14, 2011
1 parent 3cad1ea commit 0db3359
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ group :test, :development do
gem 'rspec'
gem 'rspec-rails'
gem 'sqlite3'
gem 'factory_girl_rails'
end

# Use unicorn as the web server
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ GEM
erubis (2.7.0)
execjs (1.2.6)
multi_json (~> 1.0)
factory_girl (2.1.0)
factory_girl_rails (1.2.0)
factory_girl (~> 2.1.0)
railties (>= 3.0.0)
hike (1.2.1)
i18n (0.6.0)
jquery-mobile (1.0b3)
Expand Down Expand Up @@ -127,6 +131,7 @@ PLATFORMS

DEPENDENCIES
coffee-rails (~> 3.1.0)
factory_girl_rails
jquery-mobile (= 1.0b3)
jquery-rails
mobylette
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
class ApplicationController < ActionController::Base
protect_from_forgery
respond_to_mobile_requests

end
4 changes: 4 additions & 0 deletions spec/factories/notes_factory.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Factory.define :note do |n|
n.sequence(:title) {|s| "random title #{s} #{rand 1000}"}
n.body { |note| note.title * (rand(10) + 1)}
end
6 changes: 5 additions & 1 deletion spec/models/note_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
require 'spec_helper'

describe Note do
pending "add some examples to (or delete) #{__FILE__}"

it "should have a valid factory" do
Factory.build(:note).should be_valid
end

end

0 comments on commit 0db3359

Please sign in to comment.