This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def to_hash | |
begin | |
raise ArgumentError if self.collect {|x| x.flatten.size > 2}.reject {|x| x == false}.size > 0 | |
Hash[*self.flatten] | |
rescue NoMethodError | |
raise ArgumentError | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WorkOrder | |
adding cost codes | |
should not have a cost code (FAILED - 1) | |
should allow you to add a cost code (FAILED - 2) | |
should have one field cost code (FAILED - 3) | |
should have one engineering cost code (FAILED - 4) | |
has 100 hours of Field labor (FAILED - 5) | |
has 100 hours of Engineering labor (FAILED - 6) | |
will update the total field labor on save (FAILED - 7) | |
will update the total engineering labor on save (FAILED - 8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
'AccountController AccountController should be able to upload avatar' FAILED | |
expected: 1, | |
got: 0 (using ==) | |
./spec/controllers/account_controller_spec.rb:144: | |
2) | |
'Pic pic should be valid when files are png or gif' FAILED | |
expected valid_on_create? to return true, got false | |
./spec/models/pic_spec.rb:18: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake spec:models | |
(in /Users/james/development/clients/blanee) | |
./spec/models/../../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement | |
WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.7.3 | |
loading categories and citis | |
load finished | |
Mocha deprecation warning: Mocha::Standalone has been renamed to Mocha::API | |
......................................Ftrue | |
true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mine | |
@user_questions = UserQuestion.by_clinic_id(@clinic.id).by_user_id(current_user.id). | |
ordered | |
# yours | |
@user_questions = UserQuestion.where("question_id IN (?)", question_ids) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AuthenticationSpecHelper | |
def current_user(user=nil) | |
@current_user ||= Factory(:user) | |
end | |
def user_session(stubs = {}, user=nil) | |
@current_user_session ||= mock_model(UserSession, {:user => current_user(user)}) | |
end | |
def login(session_stubs = {}, user=nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'authlogic/test_case' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "Tasks" do | |
before(:each) do | |
login_as(:developer) | |
end | |
describe "GET /tasks" do | |
it "renders" do | |
visit tasks_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserSession < Authlogic::Session::Base | |
extend ActiveModel::Naming | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faker' | |
require "#{Rails.root}/app/lib/railstar_lib/data/masked_field" | |
require "#{Rails.root}/spec/support/factory_sequences" | |
include RailstarLib::Data | |
Factory.define :user do |u| | |
u.name { Faker::Name.name } | |
u.email { Factory.next(:email) } | |
u.password "password" |