text
stringlengths
10
2.61M
class CreateJudgement attr_reader :params, :evaluation def initialize(params, evaluation) @params = params @evaluation = evaluation end def call return false unless changed? message = create_message EvaluationMessage.create(sent_at: Time.now, message: message, from_system: true, ...
require 'csv' class Collection attr_accessor :id, :institution_id, :name, :size_int, :subjects, :places, :metadata, :people, :dates, :digitized_metadata_size_int, :digitized_size_int, :department, :academic_departments, :divisions def initialize(metadata) @metadata = metadata @id = metadata['gfs_id']...
module Fog module Google class SQL class Mock include Fog::Google::Shared def initialize(options) shared_initialize(options[:google_project], GOOGLE_SQL_API_VERSION, GOOGLE_SQL_BASE_URL) end def self.data @data ||= Hash.new do |hash, key| has...
require_relative 'boot' require 'rails/all' require 'net/http' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module DemoApp class Application < Rails::Application # Initialize configuration defaults for original...
class SchedulesController < AuthenticatedController include PdfGeneratable before_action :set_team before_action :set_schedule, only: [:show, :edit, :update, :destroy] before_action :check_director, only: [:new, :create, :edit, :update, :destroy, :notificate_schedule] before_action :set_year_month_params, o...
module Markascend class Macro %w[del underline sub sup].each do |m| eval <<-RUBY def parse_#{m} "<#{m}>\#{::Markascend.escape_html content}</#{m}>" end RUBY end def parse_img s = ::StringScanner.new content unless src = s.scan(/(\\\ |\S)+/) env.wa...
include DataMagic Given(/^I'm a credit card customer and migration is not enabled$/) do visit LoginPage on(LoginPage) do |page| login_data = page.data_for(:non_migration_account) username = login_data['username'] password = login_data['password'] ssoid = login_data['ssoid'] page.login(username...
require 'rails_helper' feature "Home", type: :feature, js: true do let!(:user) { create :user } scenario 'Verify log in form' do visit(home_index_path) expect(page).to have_content('Entrar') end scenario 'Valid log in', js: true do visit(home_index_path) fill_in('Email', with: 'admin@admin....
# -*- coding: utf-8 -*- require_relative 'photo_variant' module Plugin::Photo # 1種類の画像を扱うModel。 # 同じ画像の複数のサイズ、別形式(Photo Variant)を含むことができ、それらを自動的に使い分ける。 class Photo < Diva::Model include Diva::Model::PhotoInterface register :photo, name: Plugin[:photo]._('画像') field.has :variants, [Diva::Model], requ...
require "rails_helper" feature "patient search returns list of patients", type: :feature do let!(:john) { FactoryBot.create(:patient, first_name: "John", last_name: "Doe") } let!(:jane) { FactoryBot.create(:patient, first_name: "Jane", last_name: "Doe") } let!(:freddie) { FactoryBot.create(:patient, first_name: ...
class Item # To access in these variable from Receipt class attr_accessor :name, :price, :sales_taxes, :import_taxes def initialize(name, price, sales_taxes, import_taxes) @name = name @price = price @sales_taxes = sales_taxes @import_taxes = import_taxes end end
require "pry" require "yaml" MESSAGES = YAML.load_file('messages.yml') def calculator(x,y,operation) if x.to_i.integer? x = x.to_i else "Please input a valid integer for x" end if y.to_i.integer? y = y.to_i else "Please input a valid integer for y" end if operation == "+" "The answer ...
class V1::PerformerResource < JSONAPI::Resource attributes :instrument has_one :person has_one :song end
DevToolsApp::Application.routes.draw do root 'tools#index' get 'login' => 'auths#new' delete 'logout' => 'auths#destroy' get 'tools/list', :to => "tools#list" resources :users, only: [:index, :show, :create, :new] resources :tools, only: [:index, :show, :create, :new, :edit, :update, :destroy] resou...
require 'rspec/core/rake_task' default_opts = ['--format progress', '--color'] namespace :spec do desc "Run all specs" RSpec::Core::RakeTask.new(:all) do |t| t.rspec_opts = [*default_opts] end desc "Run all specs that should pass" RSpec::Core::RakeTask.new(:ok) do |t| t.rspec_opts = [*default_opts,...
class CreateGermanArticles < ActiveRecord::Migration def change Article.transaction do Article.all.each do |legacy_article| legacy_article.article_tags.each_with_index do |article_tag, index| position = index + 1 legacy_article.article_tag_positions.create!({ tag: a...
# # Cookbook Name:: nodejs # Recipe:: default # # Copyright 2014, YOUR_COMPANY_NAME # # All rights reserved - Do Not Redistribute # def install_nodejs(source, file, build_dir, prefix, flags) remote_file "#{Chef::Config[:file_cache_path]}/#{file}" do source source mode "0644" action :create_if_missing ...
json.array!(@pagecounts) do |pagecount| json.extract! pagecount, :pageview json.url pagecount_url(pagecount, format: :json) end
class DeliveryCenter::Deploy < DeliveryCenter::ApplicationRecord belongs_to :application, class_name: 'DeliveryCenter::Application' belongs_to :revision, class_name: 'DeliveryCenter::Revision' def mark_current! self.class.transaction do self.class.where(application_id: application_id).update_all(curren...
require 'rails_helper' RSpec.describe UsersController, type: :controller do describe "GET show" do it "returns http status success" do user = create(:user) sign_in user get :show expect(response).to have_http_status(:success) end end end
require 'rails_helper' RSpec.describe FileParser::CSVParser do let(:csv_file) { fixture_file_upload(Rails.root.join('spec', 'support', 'files', 'command_file.csv'), 'text/csv') } describe '#parse_data' do specify do expect(FileParser::CSVParser.new(csv_file).parse_data) .to eq(['PLACE 1,2,EAST',...
FactoryGirl.define do factory :shipping_matrix_rule, class: Spree::ShippingMatrixRule do association :matrix, factory: :shipping_matrix association :role min_line_item_total 25 amount 2.99 end end
require "application_system_test_case" class GoodsTest < ApplicationSystemTestCase setup do @good = goods(:one) end test "visiting the index" do visit goods_url assert_selector "h1", text: "Goods" end test "creating a Good" do visit goods_url click_on "New Good" fill_in "Article", ...
require 'spec_helper' describe EssayStylesController do let(:issue) { FactoryBot.create(:issue) } let(:essay_style) { FactoryBot.create(:essay_style) } describe "#show" do it "succeeds" do get :show, issue_id: issue.friendly_id, id: essay_style.friendly_id expect(response).to be_success end ...
class CreateFlats < ActiveRecord::Migration[5.1] def change create_table :flats do |t| t.float :length t.float :width t.boolean :for_sale, :default => false t.boolean :for_rent, :default => false t.boolean :is_balcony t.boolean :is_parking t.boolean :is_garden t.boolean :is...
module RedmineUserDefaultGroup # Patches Redmine's Users dynamically. Adds a +after_create+ filter. module UserPatch def self.included(base) # :nodoc: base.send(:include, InstanceMethods) # Same as typing in the class base.class_eval do unloadable # Send unloadable so it will not...
class Workout < ActiveRecord::Base attr_accessor :trained_on_date # Associations belongs_to :user has_many :workout_items, :dependent => :destroy has_many :exercises, :through => :workout_items # Scopes scope :starting_from, lambda { |date| {:conditions => ["trained_on <= ?", date] }} scope :on, ...
class CreateClaimNotes < ActiveRecord::Migration def change create_table :claim_notes do |t| t.string :title t.integer :claim_note_category_id t.text :body t.integer :claim_id t.timestamps null: false end end end
require 'boxzooka/xml/serialization_helper' require 'ox' module Boxzooka module Xml # Serializes a descendant of BaseElement to XML. class Serializer include Boxzooka::Xml::SerializationHelper # +obj+: the object to serialize. # +node_name+: optional override for the base node name. ...
class CreateRelationship < ActiveRecord::Migration[4.2] def change create_table :relationships do |t| t.integer :source_id, null: false t.integer :target_id, null: false t.belongs_to :user t.string :relationship_type, null: false, index: true t.float :original_weight, :float, default...
class Server < ActiveRecord::Base attr_accessible :name, :team_id belongs_to :team has_many :services, dependent: :destroy has_many :properties, dependent: :destroy has_many :checks, dependent: :destroy has_many :users, dependent: :destroy validates :name, presence: true, uniqueness: { scope: :team_id...
require 'spec_helper' describe 'login cookie' do before :each do User.delete_all user end let(:user) { User.create(email: 'test@example.com', password: 'test') } it 'creates login cookie after user logging in' do visit '/users/sign_in' login assert_logged_in cookies['user_token'].shou...
module Bowling class BowlingLeaguesController < ApplicationController skip_before_action :verify_authenticity_token before_action :authorize_user, :set_league def index @leagues = current_user.bowling_leagues.order(updated_at: :asc) end def export BowlingExporter.export(@league) ...
class Student < ActiveRecord::Base #validates :student_name, presence: true validates :Age, presence: true validates :terms_of_service, acceptance: { accept: true } validates :email, presence: true, confirmation: true, uniqueness: true validates :email_confirmation, presence: true validates :pincode, length: { is...
require "./lib/cyrus-code-challenge/version" Gem::Specification.new do |spec| spec.name = 'cyrus-code-challenge' spec.version = CyrusCodeChallenge::VERSION spec.licenses = ['MIT'] spec.summary = "My solution for the cyrus-code-challenge, packaged into a CLI gem." spec.author = ["Brennen...
class CreateItemReagents < ActiveRecord::Migration def change create_table :item_reagents do |t| t.date :shelf_life t.string :conservation t.string :current_volume t.string :current_weight end end end
class CreateEntryPhotos < ActiveRecord::Migration def change create_table :entry_photos do |t| t.belongs_to :entry t.belongs_to :photo t.timestamps end add_index :entry_photos, :entry_id add_index :entry_photos, :photo_id end end
module RubyMotionQuery class RMQ # @return [RMQ] def attr(new_settings) selected.each do |view| new_settings.each do |k,v| view.send "#{k}=", v end end self end # Get or set the most common data for a particuliar view(s) in a # performant way (more per...
class DataCorrection < LoanModification include FormatterConcern belongs_to :old_lending_limit, class_name: 'LendingLimit' belongs_to :lending_limit format :postcode, with: PostcodeFormatter format :old_postcode, with: PostcodeFormatter end
module RealEstatesDescriptors FLATS_DESCRIPTORS = [:storey, :has_balcony, :furnished, :has_roof, :has_garden, :has_elevator, :cellar, :rooms, :baths, :direction, # both direction and direction: [] NEED to be listed :flat_type, :furnished_description...
module Ricer::Plug class Password def initialize(string) @string = string end def empty? @string.nil? || @string.empty? end def to_s @string.nil? ? '' : @string.to_s end def length empty? ? 0 : @string.length end def matches?(passwo...
class Product < ActiveRecord::Base validates :name, :quantity_in_stock, :price, presence: true validates :quantity_in_stock, numericality: {greater_than_or_equal_to: 1} validates :price, numericality: {greater_than_or_equal_to: 0.01} validates :name, uniqueness: true has_many :cart_items end
def hello(name) "Hello, " + name end def starts_with_consonant?(s) first_letter = s[0, 1].upcase consonants = [*('B'..'H'),*('J'..'N'),*('P'..'T'),*('V'..'Z')] consonants.each do |x| if x == first_letter return true end end return false end =begin Original starts_with_...
module GitAnalysis # prints information about the repository class Printer attr_reader :repo attr_reader :open_pr_count attr_reader :closed_pr_count def initialize(repo_object, open_pr_count, closed_pr_count) @repo = repo_object @open_pr_count = open_pr_count @closed_pr_count = cl...
class Board attr_reader :grid class IllegalMoveError < StandardError; end def initialize(empty_board = false) @grid = Array.new(8) { Array.new(8) } set_board(@grid) unless empty_board @captured_pieces = [] end def in_check?(color) king = king_pos(color) check = false @grid.fla...
require 'rails_helper' RSpec.describe 'Profile Item Types API' do let!(:profile_item_type1) { create(:profile_item_type, code: 'ENTH', type_code: 'VALU' )} let!(:profile_item_type2) { create(:profile_item_type, code: 'HGHT', type_code: 'MIMA' )} let!(:profile_item_type3) { create(:profile_item_type, code: 'BRAS'...
require "spec_helper" module Scenic describe Scenic::Statements do before do allow(Scenic).to receive(:database) .and_return(class_double("Scenic::Adapters::Postgres").as_null_object) end describe "create_view" do it "creates a view from a file" do version = 15 defini...
class SongsController < ApplicationController def index @genre = Genre.find(params[:genre_id]) @songs = @genre.songs end def show @song = Song.find(params[:id]) @genres = @song.genres end def new @genres = Genre.all end def create # manual way: # new_song = Song.new # ne...
require "spec_helper" describe AreaBasePricesController do describe "routing" do it "routes to #index" do get("/area_base_prices").should route_to("area_base_prices#index") end it "routes to #new" do get("/area_base_prices/new").should route_to("area_base_prices#new") end it "route...
class QuestionsController < ApplicationController before_filter :set_question, only: [:show, :results] before_filter :check_secret_is_unique, only: [:create] def new @question = Question.new @option = Option.new end def create @question = Question.new(question_params) @question.secret = Sec...
class DonationsController < ApplicationController before_action :authenticate_user! before_filter :require_permission skip_before_filter :authenticate_user!, :only => [:payment_notify] skip_before_filter :require_permission, :only => [:payment_notify] skip_before_filter :verify_authenticity_token, :only =>...
class RecipesController < ApplicationController skip_before_action :authenticate_user!, only: [ :index, :api ] before_action :find_recipe, only: [ :index, :api ] def index recipe_params = [] Recipe.all.each do |recipe| recipe_params << [ recipe.carbs, recipe.fat, recipe.protein ] end index ...
class AddUniqToItems < ActiveRecord::Migration[5.1] def change add_index :items, :cid, :unique => true end end
require 'spec_helper' describe Guild do before(:each) do end it "should create a new instance given valid attributes" do Factory.create(:Guild) end it "should know its characters" do @guild = Factory.create(:Guild) @characters = [Factory.create(:Character),Factory.create(:Character)] @gui...
class RenameColumn < ActiveRecord::Migration def up rename_column :links, :author_id, :user_id end def down end end
class Search < ApplicationRecord RESOURCES = %w[Question Answer User Comment].freeze def self.find(query, search_object = nil) search_object&.capitalize! object = search_object.in?(RESOURCES) ? search_object.constantize : ThinkingSphinx object.search(query) end end
# Add estimation sessions reference class AddEstimationSessionRefToProjects < ActiveRecord::Migration[5.0] def change add_reference :projects, :estimation_session, foreign_key: true end end
class MediaController < ApplicationController def show type = params[:type] id = params[:id].to_i if type == 'instagram' @media = fetch_instagram_media(id) elsif type == 's3' @media = fetch_s3_media(id) end render json: @media end private def fetch_instagram_media(id) ...
module JanusGateway class Resource::Plugin < Resource # @return [JanusGateway::Resource::Session] attr_reader :session # @return [String] attr_reader :name # @param [JanusGateway::Client] client # @param [JanusGateway::Resource::Session] session # @param [String] plugin_name def init...
describe Inventory do let(:inventory) { Inventory.new } let(:cart) { inventory.new_cart } describe "with no discounts" do it "can tell the total price of all products" do inventory.register 'The Best of Coltrane CD', '1.99' cart.add 'The Best of Coltrane CD' cart.add 'The Best of Coltrane ...
module ActiveEs module Schema module Definition extend ActiveSupport::Concern FieldDetaTypes = %w( text keyword long integer short byte double float half_float scaled_float date boolean binary integer_range float_range long_range dou...
class AddTeamToSources < ActiveRecord::Migration def change add_column :sources, :team_id, :integer add_index :sources, :team_id Source.find_each do |s| u = s.user t = u.teams.first unless u.nil? s.update_columns(team_id: t.id) unless t.nil? end end end
require 'test_helper' class LowCreditUsersTest < ActiveSupport::TestCase test "low credit users" do rows = exec_low_credit_users assert_equal 2, rows.size low_credit_users = [users(:ljf), users(:jess)] user_ids = Set[rows.map {|u| u["user_id"]}] assert_equal Set[low_credit_users.map(&:id)], user_...
class AddLegacyTradeCodesToTaxonConcepts < ActiveRecord::Migration def change add_column :taxon_concepts, :legacy_trade_code, :string end end
json.array!(@posts) do |post| json.color post.color.color json.url post_item_path(post.slug) json.picture image_url(post.picture.url(:preview)) json.title post.title json.announce post.announce.truncate(300).html_safe if post.announce json.categories post.categories.map{|c| [c.name, c.slug] } end
class TripsController < ApplicationController # To access Devise view in this controller before_action :configure_permitted_parameters, :if => :devise_controller? def resource_name :user end def resource @resource ||= User.new end def devise_mapping @devise_mapping ||= Devise.mappings[:use...
class CreateProductReviews < ActiveRecord::Migration[6.1] def change create_table :product_reviews do |t| t.string :title t.integer :rating t.boolean :published t.text :content t.integer :parent_id t.timestamps end add_reference :product_reviews, :product, index: true ...
namespace :lookup do desc "Process cached word lookup requests queued during a Wordnik API failure" task failed_words: :environment do puts "Attempting to process queued queries..." WordRequestCache.process_queued_queries end end
class AddPhotoAndAdminToUser < ActiveRecord::Migration def change add_column :users, :photo_url, :string, :default => nil add_column :users, :admin, :boolean, :default => false end end
class AddTransformatorToTrparams < ActiveRecord::Migration[5.0] add_column :trparams, :transformator_id, :integer add_foreign_key :trparams, :transformators add_index :trparams, :transformator_id end
class WorkItemSerializer < ActiveModel::Serializer attributes :id, :user_id, :task, :start_time, :end_time, :description end
class Catalog < ActiveRecord::Base attr_accessible :drop_date, :name, :initial_page_count, :size has_many :pages, :as => :book, :dependent => :destroy after_save :create_catalog_pages private def create_catalog_pages order = 1 self.initial_page_count.times do page = self...
# base on Oink::InstanceTypeCounter module MongoDbLogger def self.extended_active_record? @oink_extended_active_record end def self.extended_active_record! @oink_extended_active_record = true end module InstanceCounter def self.included(klass) if Rails.logger && Rails.logger.respond_to?(...
class RemoteDeploymentsController < ApplicationController respond_to :json def index respond_with deployment_service.all end def show respond_with deployment_service.find(params[:id]) end def create override = TemplateBuilder.create(params[:override]) deployment = deployment_service.cre...
# frozen_string_literal: true FactoryBot.define do factory :score do wakeup_on { '2019-04-28' } score { 1 } reason { 'よく寝た' } cause { '早く寝た' } user end end
require 'rspec' require_relative './lib/tictactoe.rb' require 'stringio' def capture_name $stdin.gets.chomp end RSpec.describe Tictactoe do describe '#play' do before do $stdin = StringIO.new("s\n1\n2\n3\n4\n5\n6\n7\n8\n9") end after do $stdin = STDIN ...
class AddProductVarientsToSpreeVariants < ActiveRecord::Migration def change add_column :spree_variants, :expireable, :boolean add_column :spree_variants, :pestissue, :boolean add_column :spree_variants, :multiplebarcode, :boolean end end
require 'cucumber/rspec/doubles' Given(/^I am on the home page$/) do visit('/') end When(/^I enter "([^"]*)" in the "([^"]*)" field$/) do |text, field| fill_in(field, with: text) end Then(/^I see "([^"]*)"$/) do |text| expect(page).to have_content(text) end When(/^I press the "([^"]*)" button$/) do |button| ...
class UsersController < ApplicationController before_filter :authenticate_user!, :except => [:create] unless Rails.env.test? def create # Create the user from params @user = User.new(params.require(:user).permit(:name, :email, :password, :password_confirmation)) if @user.save # Deliver the signu...
class Vocabulist < Formula desc "Personalized vocabulary frequency list for learning Japanese" homepage "https://github.com/odakaui/vocabulist" license "MIT" if OS.mac? url "https://github.com/odakaui/vocabulist/releases/download/v0.1.8/vocabulist-v0.1.8-x86_64-apple-darwin.tar.gz" sha256 "496854379ba7...
module Report attr_reader :report def patient Patient.find(patient_id) end def header address = %(\n#{Date.today.strftime('%m %B %Y')}\n\n#{patient.address_line_1 unless patient.address_line_1.blank?}) [patient.address_line_2, patient.address_line_3].each do |line| address += %(\n#{line}) u...
class CreateUsuarios < ActiveRecord::Migration def change create_table :usuarios do |t| t.string :nome t.string :cpf t.string :telefone t.string :email t.string :login t.string :senha t.boolean :ativo t.boolean :gerente t.index :cpf, unique: true t.inde...
# TODO: # - Table of Contents require 'net/http' require 'json' module ApiDump Version = "1.0.0.5" BuildDate = "190430a" CrLf = 13.chr + 10.chr class ApiRequest attr_accessor :url, :http_method, :output, :headers, :params def initialize(url, http_method, params = nil, headers = nil) ...
class AddColumnToUserReply < ActiveRecord::Migration def change add_column :user_replies, :follow_up_cycle_email, :text end end
class UrbanProjectsController < ApplicationController def index @urban_projects = UrbanProject.all end end
# # == Schema Information # # Table name: genres # # id :integer not null, primary key # name :string # created_at :datetime not null # updated_at :datetime not null # external_id :integer # # frozen_string_literal: true require 'rails_helper' RSpec.describe Genre, type: ...
require 'rubygems' require './app.rb' namespace :assets do # desc 'compile assets' task :compile => [:compile_js, :compile_css] do end # desc 'compile javascript assets' task :compile_js do sprockets = App.settings.sprockets asset = sprockets['application.js'] outpath = File.join(App.setti...
require "spec_helper" describe UserMailer do # describe "Registration Confirmation mail" do # let(:mail) { UserMailer.registration_confirmation(user) } # it { expect(mail.to).to have_content("#{user.email}") } # it { expect(mail.subject).to eq(full_title("Registration Confirmation for #{ user.name }")) }...
class CreateSpecimenGroupRelationships < ActiveRecord::Migration def change create_table :specimen_group_relationships do |t| t.references :specimen, index: true, foreign_key: true t.references :specimen_group, index: true, foreign_key: true t.timestamps null: false end end end
#!/usr/bin/env ruby -wKU # Prints out the infomation about playcounts from a specifed YAML file # Bilal Syed Hussain require "yaml" require "pp" require 'trollop' Sorts = { name: -> k,v { k } , tracks: -> k,v { -v[:total_tracks]} , creation: -> k,v { v[:...
class AddPlaidIdToCategory < ActiveRecord::Migration def change add_column :categories, :plaid_id, :string, index: true end end
class Customer attr_reader :name attr_reader :date_of_birth attr_reader :rentals attr_reader :address def initialize(name, date_of_birth, address) @name = name @date_of_birth = date_of_birth @rentals = [] @address = address end def add_rental(movie) @rentals << movie end def sum...
def shuffled_shoe(number_of_decks = 6) # Returns a "shoe" array filled with 312 shuffled "card" arrays, each with a value and suit. deck_of_values = [] # A place in which to repeatedly collect the thirteen card values. deck_of_suits = [] # A place in which to establish thirteen instances of each suit. 4.t...
version = node[:vim][:version] comp_opts = node[:vim][:compile_opts].join(' ') Chef::Log.info("Compiling vim version #{version}") Chef::Log.info("Compile options are #{comp_opts}") scripts = %w(libperl-dev python-dev) if node[:vim][:rubycompiled] Chef::Log.info("Ruby headers already present") else Chef::Log.info(...
class ArtistBalance < ApplicationRecord belongs_to :artist validates :artist_id, numericality: {message: "%{value} Debe ser el ID de un Artista."} validates :balance, numericality: {message: "%{value} Debe ser un decimal."} end
json.array!(@datos) do |dato| json.extract! dato, :id, :fullname, :phone, :direccion json.url dato_url(dato, format: :json) end
#--------------------------------------------------------------- # 3.9 Exercises # 1. You saw that Ruby does not allow addition of floats and strings. What type combinations does Ruby allow to be added? puts "Integers & Floats, Strings & Strings, Integers & Integers" # 2. Using irb , initialize three variables, x , ...
require 'helper' class TestFarmActivity < Minitest::Test def build_fields(fields) fields.map do |field_hash| Field.new.tap do |field| field.grow(field_hash[:crop], field_hash[:time]) if field_hash[:crop] end end end def test_field_collection fields = [Field.new] farm_activit...
class Event < ActiveRecord::Base has_and_belongs_to_many :users has_and_belongs_to_many :search_terms has_many :messages, :limit=>10, :order=>"created desc" belongs_to :creator, :class_name => "User", :foreign_key => "creator_id" validates_presence_of :name, :on => :create, :message => "can't be blank" val...
require 'spec_helper' feature "Deleting mentees" do scenario "Deleting a mentee" do Factory(:mentee, :name => "My Test Mentee") visit '/' click_link "See all mentees" click_link "My Test Mentee" click_link "Delete Mentee" page.should have_content("Mentee has been deleted.") visit '/' ...