fat_free_crm 0.15.0.beta → 0.15.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fat_free_crm might be problematic. Click here for more details.

Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -0
  3. data/.rubocop_todo.yml +517 -0
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.md +145 -9
  6. data/Gemfile +11 -13
  7. data/Gemfile.lock +104 -92
  8. data/README.md +2 -9
  9. data/app/assets/javascripts/application.js.erb +1 -1
  10. data/app/assets/javascripts/crm_select2.js.coffee +0 -1
  11. data/app/controllers/application_controller.rb +6 -6
  12. data/app/controllers/comments_controller.rb +7 -5
  13. data/app/controllers/entities/contacts_controller.rb +4 -4
  14. data/app/controllers/entities/opportunities_controller.rb +3 -3
  15. data/app/controllers/entities_controller.rb +3 -2
  16. data/app/controllers/home_controller.rb +21 -14
  17. data/app/controllers/passwords_controller.rb +1 -1
  18. data/app/controllers/users_controller.rb +3 -3
  19. data/app/helpers/accounts_helper.rb +2 -2
  20. data/app/helpers/application_helper.rb +20 -19
  21. data/app/helpers/campaigns_helper.rb +1 -1
  22. data/app/helpers/opportunities_helper.rb +4 -3
  23. data/app/helpers/tasks_helper.rb +6 -4
  24. data/app/helpers/users_helper.rb +1 -1
  25. data/app/helpers/versions_helper.rb +1 -1
  26. data/app/inputs/date_pair_input.rb +1 -1
  27. data/app/inputs/date_time_input.rb +1 -1
  28. data/app/models/entities/contact.rb +1 -0
  29. data/app/models/entities/lead.rb +4 -9
  30. data/app/models/entities/opportunity.rb +3 -6
  31. data/app/models/fields/field.rb +2 -3
  32. data/app/models/polymorphic/address.rb +1 -1
  33. data/app/models/polymorphic/comment.rb +1 -1
  34. data/app/models/polymorphic/task.rb +2 -3
  35. data/app/models/polymorphic/version.rb +5 -5
  36. data/app/models/setting.rb +6 -7
  37. data/app/models/users/user.rb +2 -2
  38. data/app/views/shared/_tags.html.haml +1 -5
  39. data/config/environments/test.rb +1 -1
  40. data/config/initializers/assets.rb +1 -1
  41. data/config/initializers/paper_trail.rb +1 -1
  42. data/config/initializers/simple_form.rb +1 -1
  43. data/config/initializers/views.rb +0 -1
  44. data/config/locales/th.rb +4 -4
  45. data/config/unicorn.rb +2 -2
  46. data/db/migrate/20100928030620_remove_uuid.rb +2 -4
  47. data/db/migrate/20111201030535_add_field_groups_klass_name.rb +2 -1
  48. data/db/migrate/20120224073107_remove_default_value_and_clear_settings.rb +1 -1
  49. data/db/schema.rb +0 -2
  50. data/fat_free_crm.gemspec +5 -5
  51. data/lib/fat_free_crm.rb +1 -3
  52. data/lib/fat_free_crm/callback.rb +2 -1
  53. data/lib/fat_free_crm/core_ext/string.rb +2 -2
  54. data/lib/fat_free_crm/engine.rb +1 -1
  55. data/lib/fat_free_crm/fields.rb +1 -1
  56. data/lib/fat_free_crm/i18n.rb +1 -1
  57. data/lib/fat_free_crm/mail_processor/base.rb +8 -2
  58. data/lib/fat_free_crm/mail_processor/comment_replies.rb +2 -1
  59. data/lib/fat_free_crm/permissions.rb +1 -1
  60. data/lib/fat_free_crm/version.rb +1 -1
  61. data/lib/gravatar_image_tag.rb +2 -2
  62. data/lib/tasks/ffcrm/comment_replies.rake +2 -2
  63. data/lib/tasks/ffcrm/config.rake +7 -6
  64. data/lib/tasks/ffcrm/demo.rake +1 -1
  65. data/lib/tasks/ffcrm/dropbox.rake +2 -2
  66. data/lib/tasks/ffcrm/setup.rake +4 -2
  67. data/lib/tasks/ffcrm/update_data.rake +5 -7
  68. data/spec/controllers/entities/campaigns_controller_spec.rb +1 -1
  69. data/spec/controllers/entities/leads_controller_spec.rb +1 -1
  70. data/spec/controllers/home_controller_spec.rb +5 -5
  71. data/spec/controllers/tasks_controller_spec.rb +3 -2
  72. data/spec/factories/sequences.rb +1 -2
  73. data/spec/factories/shared_factories.rb +5 -5
  74. data/spec/factories/user_factories.rb +3 -3
  75. data/spec/models/entities/opportunity_spec.rb +1 -1
  76. data/spec/models/fields/custom_field_pair_spec.rb +2 -2
  77. data/spec/models/setting_spec.rb +1 -1
  78. data/spec/shared/controllers.rb +1 -1
  79. data/spec/support/auth_macros.rb +6 -5
  80. data/spec/support/macros.rb +1 -1
  81. data/spec/views/application/auto_complete.haml_spec.rb +3 -3
  82. data/spec/views/campaigns/show.haml_spec.rb +2 -2
  83. data/spec/views/leads/update.js.haml_spec.rb +1 -1
  84. data/spec/views/tasks/index.haml_spec.rb +1 -1
  85. data/spec/views/tasks/update.js.haml_spec.rb +7 -7
  86. metadata +29 -4
@@ -43,6 +43,7 @@ module FatFreeCRM
43
43
  def self.view_responder(method)
44
44
  @@responder[method] ||= @@classes.map(&:instance).select { |instance| instance.class.view_hooks[method] }
45
45
  end
46
+
46
47
  # Invokes the view hook Proc stored under :hook and captures its output.
47
48
  # => Instead of defining methods on the class, view hooks are
48
49
  # stored as Procs in a hash. This allows the same hook to be manipulated in
@@ -52,7 +53,7 @@ module FatFreeCRM
52
53
  # - a hash of arrays containing Procs and positions to insert content.
53
54
  #--------------------------------------------------------------------------
54
55
  def self.view_hook(hook, caller, context = {})
55
- view_responder(hook).inject(Hash.new([])) do |response, instance|
56
+ view_responder(hook).each_with_object(Hash.new([])) do |instance, response|
56
57
  # Process each operation within each view hook, storing the data in a hash.
57
58
  instance.class.view_hooks[hook].each do |op|
58
59
  response[op[:position]] += [op[:proc].call(caller, context)]
@@ -34,10 +34,10 @@ class String
34
34
  # A query with 4 words will generate 6 permutations
35
35
  def name_permutations
36
36
  parts = split(" ")
37
- (parts.size - 1).times.map do|i|
37
+ Array.new((parts.size - 1)) do |i|
38
38
  # ["A", "B", "C", "D"] => [["A B C", "D"], ["A B", "C D"], ["A", "B C D"]]
39
39
  [parts[(0..i)].join(" "), parts[(i + 1)..-1].join(" ")]
40
- end.inject([]) do |arr, perm|
40
+ end.each_with_object([]) do |perm, arr|
41
41
  # Search both [first, last] and [last, first]
42
42
  # e.g. for every ["A B C", "D"], also include ["D", "A B C"]
43
43
  arr << perm
@@ -11,7 +11,7 @@ module FatFreeCRM
11
11
  config.active_record.observers = [:lead_observer, :opportunity_observer,
12
12
  :task_observer, :entity_observer]
13
13
 
14
- initializer "model_core.factories", :after => "factory_girl.set_factory_paths" do
14
+ initializer "model_core.factories", after: "factory_girl.set_factory_paths" do
15
15
  FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
16
16
  end
17
17
 
@@ -79,7 +79,7 @@ module FatFreeCRM
79
79
  # Refresh columns and try again.
80
80
  self.class.reset_column_information
81
81
  # If new record, create new object from class, else reload class
82
- object = self.new_record? ? self.class.new : (reload && self)
82
+ object = new_record? ? self.class.new : (reload && self)
83
83
  # ensure serialization is setup if needed
84
84
  self.class.serialize_custom_fields!
85
85
  # Try again if object now responds to method, else return nil
@@ -13,7 +13,7 @@ module FatFreeCRM
13
13
  super(args.first, default: args.first.to_s)
14
14
  elsif args.second.is_a?(Hash)
15
15
  super(*args)
16
- elsif args.second.is_a?(Fixnum)
16
+ elsif args.second.is_a?(Integer)
17
17
  super(args.first, count: args.second)
18
18
  else
19
19
  super(args.first, value: args.second)
@@ -16,7 +16,9 @@ module FatFreeCRM
16
16
 
17
17
  #--------------------------------------------------------------------------------------
18
18
  def initialize
19
- @archived, @discarded, @dry_run = 0, 0, false
19
+ @archived = 0
20
+ @discarded = 0
21
+ @dry_run = false
20
22
  end
21
23
 
22
24
  # Setup imap folders in settings.
@@ -81,7 +83,11 @@ module FatFreeCRM
81
83
  if @imap
82
84
  @imap.logout
83
85
  unless @imap.disconnected?
84
- @imap.disconnect rescue nil
86
+ begin
87
+ @imap.disconnect
88
+ rescue
89
+ nil
90
+ end
85
91
  end
86
92
  end
87
93
  end
@@ -39,7 +39,8 @@ module FatFreeCRM
39
39
  #--------------------------------------------------------------------------------------
40
40
  def with_subject_line(email)
41
41
  if /\[([^:]*):([^\]]*)\]/ =~ email.subject
42
- entity_name, entity_id = Regexp.last_match[1], Regexp.last_match[2]
42
+ entity_name = Regexp.last_match[1]
43
+ entity_id = Regexp.last_match[2]
43
44
  # Check that entity is a known model
44
45
  if ENTITY_SHORTCUTS.values.include?(entity_name)
45
46
  yield entity_name, entity_id
@@ -74,7 +74,7 @@ module FatFreeCRM
74
74
  permissions_to_remove = []
75
75
  end
76
76
 
77
- permissions_to_remove.each { |p| (permissions.delete(p); p.destroy) }
77
+ permissions_to_remove.each { |p| permissions.delete(p); p.destroy }
78
78
  end
79
79
 
80
80
  # Save the model along with its permissions if any.
@@ -8,7 +8,7 @@ module FatFreeCRM
8
8
  MAJOR = 0
9
9
  MINOR = 15
10
10
  TINY = 0
11
- PRE = 'beta'
11
+ PRE = 'beta.2'
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
14
14
  end
@@ -46,11 +46,11 @@ module GravatarImageTag
46
46
  end
47
47
 
48
48
  def self.gravatar_id(email, filetype = nil)
49
- "#{ Digest::MD5.hexdigest(email) }#{ ".#{filetype}" unless filetype.nil? }" unless email.nil?
49
+ "#{Digest::MD5.hexdigest(email)}#{".#{filetype}" unless filetype.nil?}" unless email.nil?
50
50
  end
51
51
 
52
52
  def self.url_params(gravatar_params)
53
- return nil if gravatar_params.keys.size == 0
53
+ return nil if gravatar_params.keys.empty?
54
54
  "?#{gravatar_params.map { |key, value| "#{key}=#{URI.escape(value.is_a?(String) ? value : value.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))}" }.join('&amp;')}"
55
55
  end
56
56
  end
@@ -8,13 +8,13 @@ namespace :ffcrm do
8
8
  desc "Run comment inbox crawler and process incoming emails"
9
9
  task run: :environment do
10
10
  require "fat_free_crm/mail_processor/comment_replies"
11
- FatFreeCRM::MailProcessor::CommentReplies.new.run(dry_run = false)
11
+ FatFreeCRM::MailProcessor::CommentReplies.new.run(false)
12
12
  end
13
13
  namespace :run do
14
14
  desc "[Dry run] - Run comment inbox crawler and process incoming emails"
15
15
  task dry: :environment do
16
16
  require "fat_free_crm/mail_processor/comment_replies"
17
- FatFreeCRM::MailProcessor::CommentReplies.new.run(dry_run = true)
17
+ FatFreeCRM::MailProcessor::CommentReplies.new.run(true)
18
18
  end
19
19
  end
20
20
 
@@ -9,7 +9,8 @@ namespace :ffcrm do
9
9
  task :copy_database_yml do
10
10
  require 'fileutils'
11
11
  filename = "config/database.#{ENV['DB'] || 'postgres'}.yml"
12
- orig, dest = FatFreeCRM.root.join(filename), Rails.root.join('config/database.yml')
12
+ orig = FatFreeCRM.root.join(filename)
13
+ dest = Rails.root.join('config/database.yml')
13
14
  unless File.exist?(dest)
14
15
  puts "Copying #{filename} to config/database.yml ..."
15
16
  FileUtils.cp orig, dest
@@ -27,13 +28,13 @@ namespace :ffcrm do
27
28
  require 'fileutils'
28
29
  require 'syck'
29
30
  require 'psych'
30
- Dir[File.join(Rails.root, 'config', '**', '*.yml')].each do |file|
31
+ Dir[File.join(Rails.root, 'config', '**', '*.yml')].each do |file_path|
31
32
  YAML::ENGINE.yamler = 'syck'
32
- puts "Converting #{file}"
33
- yml = YAML.load(File.read(file))
34
- FileUtils.cp file, "#{file}.bak"
33
+ puts "Converting #{file_path}"
34
+ yml = YAML.load(File.read(file_path))
35
+ FileUtils.cp file_path, "#{file_path}.bak"
35
36
  YAML::ENGINE.yamler = 'psych'
36
- File.open(file, 'w') { |file| file.write(YAML.dump(yml)) }
37
+ File.open(file_path, 'w') { |file| file.write(YAML.dump(yml)) }
37
38
  end
38
39
  end
39
40
  end
@@ -46,7 +46,7 @@ namespace :ffcrm do
46
46
 
47
47
  if [Account, Campaign, Contact, Lead, Opportunity].include?(item.class)
48
48
  viewed_at = created_at + rand(12 * 60).minutes
49
- version = create_version(event: "view", created_at: viewed_at, user: user, item: item)
49
+ create_version(event: "view", created_at: viewed_at, user: user, item: item)
50
50
  end
51
51
  print "." if item.id % 10 == 0
52
52
  end
@@ -8,14 +8,14 @@ namespace :ffcrm do
8
8
  desc "Run dropbox crawler and process incoming emails"
9
9
  task run: :environment do
10
10
  require "fat_free_crm/mail_processor/dropbox"
11
- FatFreeCRM::MailProcessor::Dropbox.new.run(dry_run = false)
11
+ FatFreeCRM::MailProcessor::Dropbox.new.run(false)
12
12
  end
13
13
 
14
14
  namespace :run do
15
15
  desc "[Dry run] - Run dropbox crawler and process incoming emails"
16
16
  task dry: :environment do
17
17
  require "fat_free_crm/mail_processor/dropbox"
18
- FatFreeCRM::MailProcessor::Dropbox.new.run(dry_run = true)
18
+ FatFreeCRM::MailProcessor::Dropbox.new.run(true)
19
19
  end
20
20
  end
21
21
 
@@ -28,7 +28,9 @@ namespace :ffcrm do
28
28
  namespace :setup do
29
29
  desc "Create admin user"
30
30
  task admin: :environment do
31
- username, password, email = ENV["USERNAME"], ENV["PASSWORD"], ENV["EMAIL"]
31
+ username = ENV["USERNAME"]
32
+ password = ENV["PASSWORD"]
33
+ email = ENV["EMAIL"]
32
34
  unless username && password && email
33
35
  puts "\nTo create the admin user you will be prompted to enter username, password,"
34
36
  puts "and email address. You might also specify the username of existing user.\n"
@@ -40,7 +42,7 @@ namespace :ffcrm do
40
42
 
41
43
  password ||= "manager"
42
44
  print "Password [#{password}]: "
43
- echo = lambda { |toggle| return if RUBY_PLATFORM =~ /mswin/; system(toggle ? "stty echo && echo" : "stty -echo") }
45
+ echo = ->(toggle) { return if RUBY_PLATFORM =~ /mswin/; system(toggle ? "stty echo && echo" : "stty -echo") }
44
46
  begin
45
47
  echo.call(false)
46
48
  reply = STDIN.gets.strip
@@ -210,16 +210,14 @@ in a console and continue. This is strongly discouraged. You have been warned!
210
210
  # SELECT "addresses".* FROM "addresses"
211
211
  # WHERE (("addresses"."country" = 'AU' OR "addresses"."country" = 'Australia'))
212
212
  convert_table.each do |ct|
213
- t = Address.arel_table
214
- scope = t[:country].eq(ct[0]) # Australia
215
- scope = scope.or(t[:country].eq(ct[1])) # AU
213
+ table = Address.arel_table
214
+ scope = table[:country].eq(ct[0]) # Australia
215
+ scope = scope.or(table[:country].eq(ct[1])) # AU
216
216
 
217
217
  tmp = Address.where(scope)
218
218
  tmp.map { |t| t.country = ct[2] }
219
219
 
220
- unless tmp.blank?
221
- addresses_to_update << tmp
222
- end
220
+ addresses_to_update << tmp unless tmp.blank?
223
221
  end
224
222
 
225
223
  Address.transaction do
@@ -229,8 +227,8 @@ in a console and continue. This is strongly discouraged. You have been warned!
229
227
  end
230
228
  Setting.have_run_country_migration = true
231
229
  rescue Exception => e
232
- ActiveRecord::Rollback
233
230
  puts e
231
+ raise ActiveRecord::Rollback
234
232
  end
235
233
  end
236
234
  end
@@ -373,7 +373,7 @@ describe CampaignsController do
373
373
 
374
374
  xhr :put, :update, id: 42, campaign: { name: "Hello", access: "Shared", user_ids: %w(7 8) }
375
375
  expect(assigns[:campaign].access).to eq("Shared")
376
- expect(assigns[:campaign].user_ids.sort).to eq([7, 8])
376
+ expect(assigns[:campaign].user_ids.sort).to eq([he.id, she.id])
377
377
  end
378
378
 
379
379
  describe "campaign got deleted or otherwise unavailable" do
@@ -467,7 +467,7 @@ describe LeadsController do
467
467
  she = FactoryGirl.create(:user, id: 8)
468
468
 
469
469
  xhr :put, :update, id: @lead.id, lead: { access: "Shared", user_ids: %w(7 8) }
470
- expect(@lead.user_ids.sort).to eq([7, 8])
470
+ expect(@lead.user_ids.sort).to eq([he.id, she.id])
471
471
  end
472
472
 
473
473
  it "should get the data for leads sidebar when called from leads index" do
@@ -21,7 +21,7 @@ describe HomeController do
21
21
  end
22
22
 
23
23
  it "should not include views in the list of activities" do
24
- activity = FactoryGirl.create(:version, item: FactoryGirl.create(:account, user: @current_user), event: "view")
24
+ FactoryGirl.create(:version, item: FactoryGirl.create(:account, user: @current_user), event: "view")
25
25
  expect(controller).to receive(:get_activities).once.and_return([])
26
26
 
27
27
  get :index
@@ -42,11 +42,12 @@ describe HomeController do
42
42
  end
43
43
 
44
44
  it "should not display completed tasks" do
45
- task_1 = FactoryGirl.create(:task, user_id: current_user.id, name: "Your first task", bucket: "due_asap", assigned_to: current_user.id)
46
- task_2 = FactoryGirl.create(:task, user_id: current_user.id, name: "Completed task", bucket: "due_asap", completed_at: 1.days.ago, completed_by: current_user.id, assigned_to: current_user.id)
45
+ my_task = FactoryGirl.create(:task, user_id: current_user.id, name: "Your first task", bucket: "due_asap", assigned_to: current_user.id)
46
+ FactoryGirl.create(:task, user_id: current_user.id, name: "Completed task", bucket: "due_asap", completed_at: 1.days.ago, completed_by: current_user.id, assigned_to: current_user.id)
47
47
 
48
48
  get :index
49
- expect(assigns[:my_tasks]).to eq([task_1])
49
+
50
+ expect(assigns[:my_tasks]).to eq([my_task])
50
51
  end
51
52
 
52
53
  it "should get a list of my opportunities ordered by closes_on" do
@@ -202,7 +203,6 @@ describe HomeController do
202
203
  end
203
204
 
204
205
  it "should not do anything when state neither Expanded nor Collapsed" do
205
- comment = double(Comment)
206
206
  expect(Comment).not_to receive(:find).with("1")
207
207
  xhr :get, :timeline, type: "comment", id: "1", state: "Explode"
208
208
  end
@@ -14,7 +14,7 @@ describe TasksController do
14
14
  def produce_tasks(user, view)
15
15
  settings = (view != "completed" ? Setting.task_bucket : Setting.task_completed)
16
16
 
17
- settings.inject({}) do | hash, due |
17
+ settings.each_with_object({}) do |due, hash|
18
18
  hash[due] ||= []
19
19
  if Date.tomorrow == Date.today.end_of_week && due == :due_tomorrow
20
20
  due = :due_this_week
@@ -55,7 +55,8 @@ describe TasksController do
55
55
  describe "responding to GET index" do
56
56
  before do
57
57
  update_sidebar
58
- @timezone, Time.zone = Time.zone, 'UTC'
58
+ @timezone = Time.zone
59
+ Time.zone = 'UTC'
59
60
  end
60
61
 
61
62
  after do
@@ -5,8 +5,7 @@
5
5
  #------------------------------------------------------------------------------
6
6
  FactoryGirl.define do
7
7
  sequence :address do |_n|
8
- FFaker::Address.street_address + " " + FFaker::Address.secondary_address + "\n"
9
- FFaker::Address.city + ", " + FFaker::AddressUS.state_abbr + " " + FFaker::AddressUS.zip_code
8
+ FFaker::Address.street_address + " " + FFaker::Address.secondary_address + "\n" + FFaker::Address.city + ", " + FFaker::AddressUS.state_abbr + " " + FFaker::AddressUS.zip_code
10
9
  end
11
10
 
12
11
  sequence :username do |n|
@@ -6,14 +6,14 @@
6
6
  FactoryGirl.define do
7
7
  factory :version do
8
8
  whodunnit ""
9
- item { fail "Please specify :item for the version" }
9
+ item { raise "Please specify :item for the version" }
10
10
  event "create"
11
11
  created_at { FactoryGirl.generate(:time) }
12
12
  end
13
13
 
14
14
  factory :comment do
15
15
  user
16
- commentable { fail "Please specify :commentable for the comment" }
16
+ commentable { raise "Please specify :commentable for the comment" }
17
17
  title { FactoryGirl.generate(:title) }
18
18
  private false
19
19
  comment { FFaker::Lorem.paragraph }
@@ -25,7 +25,7 @@ FactoryGirl.define do
25
25
  factory :email do
26
26
  imap_message_id { "%08x" % rand(0xFFFFFFFF) }
27
27
  user
28
- mediator { fail "Please specify :mediator for the email" }
28
+ mediator { raise "Please specify :mediator for the email" }
29
29
  sent_from { FFaker::Internet.email }
30
30
  sent_to { FFaker::Internet.email }
31
31
  cc { FFaker::Internet.email }
@@ -42,7 +42,7 @@ FactoryGirl.define do
42
42
  end
43
43
 
44
44
  factory :address do
45
- addressable { fail "Please specify :addressable for the address" }
45
+ addressable { raise "Please specify :addressable for the address" }
46
46
  street1 { FFaker::Address.street_address }
47
47
  street2 { FFaker::Address.street_address }
48
48
  city { FFaker::Address.city }
@@ -58,7 +58,7 @@ FactoryGirl.define do
58
58
 
59
59
  factory :avatar do
60
60
  user
61
- entity { fail "Please specify :entity for the avatar" }
61
+ entity { raise "Please specify :entity for the avatar" }
62
62
  image { File.new(Rails.root.join('spec', 'fixtures', 'rails.png')) }
63
63
  updated_at { FactoryGirl.generate(:time) }
64
64
  created_at { FactoryGirl.generate(:time) }
@@ -43,15 +43,15 @@ FactoryGirl.define do
43
43
 
44
44
  factory :permission do
45
45
  user
46
- asset { fail "Please specify :asset for the permission" }
46
+ asset { raise "Please specify :asset for the permission" }
47
47
  updated_at { FactoryGirl.generate(:time) }
48
48
  created_at { FactoryGirl.generate(:time) }
49
49
  end
50
50
 
51
51
  factory :preference do
52
52
  user
53
- name { fail "Please specify :name for the preference" }
54
- value { fail "Please specify :value for the preference" }
53
+ name { raise "Please specify :name for the preference" }
54
+ value { raise "Please specify :value for the preference" }
55
55
  updated_at { FactoryGirl.generate(:time) }
56
56
  created_at { FactoryGirl.generate(:time) }
57
57
  end
@@ -35,7 +35,7 @@ describe Opportunity do
35
35
  end
36
36
 
37
37
  it "should be possible to create opportunity with the same name" do
38
- first = FactoryGirl.create(:opportunity, name: "Hello", user: current_user)
38
+ FactoryGirl.create(:opportunity, name: "Hello", user: current_user)
39
39
  expect { FactoryGirl.create(:opportunity, name: "Hello", user: current_user) }.to_not raise_error
40
40
  end
41
41
 
@@ -18,7 +18,7 @@ describe CustomFieldPair do
18
18
  @field = { 'as' => 'foopair', 'field_group_id' => 1, 'label' => 'Event' }
19
19
  @pair1 = { 'name' => 'pair1' }
20
20
  @pair2 = { 'name' => 'pair2' }
21
- @params = { 'field' => @field, 'pair' => { '0' => @pair1, '1' => @pair2 } }
21
+ @params = { 'field' => @field, 'pair' => { '0' => @pair1, '1' => @pair2 } }
22
22
  end
23
23
 
24
24
  it "should create the pair" do
@@ -38,7 +38,7 @@ describe CustomFieldPair do
38
38
  @field = { 'as' => 'foopair', 'field_group_id' => 1, 'label' => 'Event' }
39
39
  @pair1 = { 'name' => 'pair1' }
40
40
  @pair2 = { 'name' => 'pair2' }
41
- @params = { 'id' => '3', 'field' => @field, 'pair' => { '0' => @pair1, '1' => @pair2 } }
41
+ @params = { 'id' => '3', 'field' => @field, 'pair' => { '0' => @pair1, '1' => @pair2 } }
42
42
  end
43
43
 
44
44
  it "should update the pair" do
@@ -31,7 +31,7 @@ describe Setting do
31
31
 
32
32
  it "should use value from YAML if setting is missing from database" do
33
33
  @setting = FactoryGirl.create(:setting, name: "magoody", value: nil)
34
- Setting.yaml_settings.merge!(magoody: "thingymabob")
34
+ Setting.yaml_settings[:magoody] = "thingymabob"
35
35
  expect(Setting[:magoody]).to eq("thingymabob")
36
36
  expect(Setting.magoody).to eq("thingymabob")
37
37
  end