Skip to content

Instantly share code, notes, and snippets.

@fytzzz
Created August 25, 2012 18:11
Show Gist options
  • Save fytzzz/3468730 to your computer and use it in GitHub Desktop.
Save fytzzz/3468730 to your computer and use it in GitHub Desktop.
FactoryGirl.define do
include BCrypt
factory :account do
sequence(:name) { |n| "Test McAccount The #{n}" }
sequence(:email) { |n| "account#{n}@email.com" }
password Password.create "Account"
end
factory :account do
sequence(:name) { |n| "Test McSupport The #{n}" }
sequence(:email) { |n| "support#{n}@email.com" }
password Password.create "Account"
support true
end
factory :account do
sequence(:name) { |n| "Test McAdmin The #{n}" }
sequence(:email) { |n| "admin#{n}@email.com" }
password Password.create "Account"
admin true
end
factory :account do
sequence(:name) { |n| "Test McBanned The #{n}" }
sequence(:email) { |n| "banned#{n}@email.com" }
password Password.create "Account"
banned true
end
end
group :development do
gem 'heroku', '2.1.4'
gem 'jquery-rails', '1.0.2'
gem 'rspec-rails', '2.6.1'
gem 'cucumber-rails', '0.4.1'
gem 'factory_girl_rails', '1.0.1'
gem 'capybara', '0.4.1.2'
gem 'delorean', '1.0.0'
gem 'mocha', '0.9.12'
gem 'spork'
gem 'looksee', '1.0.2'
gem 'wirble', '0.1.3'
gem 'awesome_print', '0.4.0'
gem 'utility_belt', '1.1.0'
# gem 'therubyracer', :require => 'v8'
end
└─▪ rake spec
/Users/krainboltgreene/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -S bundle exec rspec ./spec/requests/accounts_spec.rb
.F
Failures:
1) Accounts GET /accounts shows an account
Failure/Error: account = FactoryGirl.create(:account)
NameError:
uninitialized constant FactoryGirl
# ./spec/requests/accounts_spec.rb:12:in `block (3 levels) in <top (required)>'
Finished in 0.43063 seconds
2 examples, 1 failure
Failed examples:
rspec ./spec/requests/accounts_spec.rb:11 # Accounts GET /accounts shows an account
rake aborted!
ruby -S bundle exec rspec ./spec/requests/accounts_spec.rb failed
Tasks: TOP => spec
(See full trace by running task with --trace)
require 'spec_helper'
describe "Accounts" do
describe "GET /accounts" do
it "should be available" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get accounts_path
response.status.should be(200)
end
it "shows an account" do
account = FactoryGirl.create(:account)
get accounts_path
response.body.should include(account.email)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment