fat_free_crm 0.14.2 → 0.15.0.beta

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 (95) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +15 -5
  3. data/{CHANGELOG → CHANGELOG.md} +9 -8
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +78 -70
  6. data/README.md +8 -10
  7. data/app/controllers/admin/users_controller.rb +6 -1
  8. data/app/controllers/application_controller.rb +2 -0
  9. data/app/controllers/users_controller.rb +1 -0
  10. data/app/helpers/tags_helper.rb +1 -1
  11. data/app/models/users/user.rb +10 -9
  12. data/config/initializers/paper_trail.rb +1 -0
  13. data/fat_free_crm.gemspec +4 -4
  14. data/lib/development_tasks/rspec.rake +2 -6
  15. data/lib/fat_free_crm/engine.rb +5 -0
  16. data/lib/fat_free_crm/version.rb +3 -3
  17. data/spec/factories/field_factories.rb +1 -1
  18. data/spec/factories/opportunity_factories.rb +1 -1
  19. data/spec/mailers/subscription_mailer_spec.rb +5 -3
  20. data/spec/mailers/user_mailer_spec.rb +6 -6
  21. data/spec/models/users/abilities/user_ability_spec.rb +3 -3
  22. data/spec/models/users/user_spec.rb +73 -62
  23. data/spec/support/auth_macros.rb +8 -1
  24. data/spec/views/accounts/_edit.haml_spec.rb +1 -1
  25. data/spec/views/accounts/create.js.haml_spec.rb +1 -1
  26. data/spec/views/accounts/destroy.js.haml_spec.rb +1 -1
  27. data/spec/views/accounts/edit.js.haml_spec.rb +2 -2
  28. data/spec/views/accounts/index.haml_spec.rb +2 -2
  29. data/spec/views/accounts/index.js.haml_spec.rb +1 -1
  30. data/spec/views/accounts/update.js.haml_spec.rb +1 -1
  31. data/spec/views/admin/field_groups/create.js.haml_spec.rb +1 -1
  32. data/spec/views/admin/field_groups/edit.js.haml_spec.rb +1 -1
  33. data/spec/views/admin/field_groups/new.js.haml_spec.rb +1 -1
  34. data/spec/views/admin/field_groups/update.js.haml_spec.rb +1 -1
  35. data/spec/views/admin/users/create.js.haml_spec.rb +1 -1
  36. data/spec/views/admin/users/destroy.js.haml_spec.rb +1 -1
  37. data/spec/views/admin/users/edit.js.haml_spec.rb +2 -2
  38. data/spec/views/admin/users/index.haml_spec.rb +1 -1
  39. data/spec/views/admin/users/index.js.haml_spec.rb +2 -2
  40. data/spec/views/admin/users/reactivate.js.haml_spec.rb +1 -1
  41. data/spec/views/admin/users/suspend.js.haml_spec.rb +1 -1
  42. data/spec/views/admin/users/update.js.haml_spec.rb +1 -1
  43. data/spec/views/application/auto_complete.haml_spec.rb +3 -3
  44. data/spec/views/campaigns/_edit.haml_spec.rb +1 -1
  45. data/spec/views/campaigns/create.js.haml_spec.rb +2 -2
  46. data/spec/views/campaigns/destroy.js.haml_spec.rb +1 -1
  47. data/spec/views/campaigns/edit.js.haml_spec.rb +2 -2
  48. data/spec/views/campaigns/index.haml_spec.rb +1 -1
  49. data/spec/views/campaigns/index.js.haml_spec.rb +1 -1
  50. data/spec/views/campaigns/show.haml_spec.rb +4 -4
  51. data/spec/views/campaigns/update.js.haml_spec.rb +1 -1
  52. data/spec/views/contacts/_new.haml_spec.rb +1 -1
  53. data/spec/views/contacts/create.js.haml_spec.rb +3 -3
  54. data/spec/views/contacts/destroy.js.haml_spec.rb +1 -1
  55. data/spec/views/contacts/edit.js.haml_spec.rb +3 -3
  56. data/spec/views/contacts/index.haml_spec.rb +1 -1
  57. data/spec/views/contacts/index.js.html_spec.rb +1 -1
  58. data/spec/views/contacts/new.js.haml_spec.rb +1 -1
  59. data/spec/views/contacts/update.js.haml_spec.rb +2 -2
  60. data/spec/views/home/index.haml_spec.rb +1 -1
  61. data/spec/views/home/index.js.haml_spec.rb +2 -2
  62. data/spec/views/home/options.js.haml_spec.rb +2 -2
  63. data/spec/views/leads/_convert.haml_spec.rb +3 -3
  64. data/spec/views/leads/_edit.haml_spec.rb +2 -2
  65. data/spec/views/leads/_new.haml_spec.rb +1 -1
  66. data/spec/views/leads/_sidebar_show.haml_spec.rb +1 -1
  67. data/spec/views/leads/convert.js.haml_spec.rb +4 -4
  68. data/spec/views/leads/create.js.haml_spec.rb +3 -3
  69. data/spec/views/leads/destroy.js.haml_spec.rb +2 -2
  70. data/spec/views/leads/edit.js.haml_spec.rb +4 -4
  71. data/spec/views/leads/index.haml_spec.rb +1 -1
  72. data/spec/views/leads/index.js.haml_spec.rb +1 -1
  73. data/spec/views/leads/new.js.haml_spec.rb +1 -1
  74. data/spec/views/leads/promote.js.haml_spec.rb +7 -7
  75. data/spec/views/leads/reject.js.haml_spec.rb +2 -2
  76. data/spec/views/leads/show.haml_spec.rb +2 -2
  77. data/spec/views/leads/update.js.haml_spec.rb +4 -4
  78. data/spec/views/opportunities/_edit.haml_spec.rb +5 -5
  79. data/spec/views/opportunities/_new.haml_spec.rb +1 -1
  80. data/spec/views/opportunities/create.js.haml_spec.rb +3 -3
  81. data/spec/views/opportunities/destroy.js.haml_spec.rb +3 -3
  82. data/spec/views/opportunities/edit.js.haml_spec.rb +3 -3
  83. data/spec/views/opportunities/index.haml_spec.rb +1 -1
  84. data/spec/views/opportunities/index.js.haml_spec.rb +1 -1
  85. data/spec/views/opportunities/new.js.haml_spec.rb +1 -1
  86. data/spec/views/opportunities/update.js.haml_spec.rb +4 -4
  87. data/spec/views/tasks/_edit.haml_spec.rb +1 -1
  88. data/spec/views/tasks/complete.js.haml_spec.rb +4 -4
  89. data/spec/views/tasks/create.js.haml_spec.rb +5 -5
  90. data/spec/views/tasks/destroy.js.haml_spec.rb +2 -2
  91. data/spec/views/tasks/index.haml_spec.rb +4 -4
  92. data/spec/views/tasks/uncomplete.js.haml_spec.rb +2 -2
  93. data/spec/views/tasks/update.js.haml_spec.rb +18 -18
  94. data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
  95. metadata +17 -14
@@ -25,7 +25,14 @@ alias :require_user :login
25
25
 
26
26
  #----------------------------------------------------------------------------
27
27
  def login_and_assign(user_stubs = {}, session_stubs = {})
28
- login(user_stubs, session_stubs)
28
+ User.current_user = @current_user = FactoryGirl.build_stubbed(:user, user_stubs)
29
+ @current_user_session = double(Authentication, {record: current_user}.merge(session_stubs))
30
+ allow(Authentication).to receive(:find).and_return(@current_user_session)
31
+ #set_timezone
32
+ assigns[:current_user] = current_user
33
+ end
34
+ def login_and_assign!(user_stubs = {}, session_stubs = {})
35
+ login
29
36
  assigns[:current_user] = current_user
30
37
  end
31
38
 
@@ -10,7 +10,7 @@ describe "/accounts/_edit" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- assign(:account, @account = FactoryGirl.create(:account))
13
+ assign(:account, @account = FactoryGirl.build_stubbed(:account))
14
14
  assign(:users, [current_user])
15
15
  end
16
16
 
@@ -16,7 +16,7 @@ describe "/accounts/create" do
16
16
  # core object Account partial is not embedded.
17
17
  describe "create success" do
18
18
  before do
19
- assign(:account, @account = FactoryGirl.create(:account))
19
+ assign(:account, @account = FactoryGirl.build_stubbed(:account))
20
20
  assign(:accounts, [@account].paginate)
21
21
  assign(:account_category_total, Hash.new(1))
22
22
  render
@@ -10,7 +10,7 @@ describe "/accounts/destroy" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- assign(:account, @account = FactoryGirl.create(:account))
13
+ assign(:account, @account = FactoryGirl.build_stubbed(:account))
14
14
  assign(:accounts, [@account].paginate)
15
15
  assign(:account_category_total, Hash.new(1))
16
16
  render
@@ -10,7 +10,7 @@ describe "/accounts/edit" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- assign(:account, @account = FactoryGirl.create(:account, user: current_user))
13
+ assign(:account, @account = FactoryGirl.build_stubbed(:account, user: current_user))
14
14
  assign(:users, [current_user])
15
15
  end
16
16
 
@@ -31,7 +31,7 @@ describe "/accounts/edit" do
31
31
 
32
32
  it "edit: should hide previously open [Edit Account] for and replace it with account partial" do
33
33
  params[:cancel] = nil
34
- assign(:previous, previous = FactoryGirl.create(:account, user: current_user))
34
+ assign(:previous, previous = FactoryGirl.build_stubbed(:account, user: current_user))
35
35
 
36
36
  render
37
37
  expect(rendered).to include("account_#{previous.id}")
@@ -17,13 +17,13 @@ describe "/accounts/index" do
17
17
  end
18
18
 
19
19
  it "should render account name" do
20
- assign(:accounts, [FactoryGirl.create(:account, name: 'New Media Inc'), FactoryGirl.create(:account)].paginate)
20
+ assign(:accounts, [FactoryGirl.build_stubbed(:account, name: 'New Media Inc'), FactoryGirl.build_stubbed(:account)].paginate)
21
21
  render
22
22
  expect(rendered).to have_tag('a', text: "New Media Inc")
23
23
  end
24
24
 
25
25
  it "should render list of accounts if list of accounts is not empty" do
26
- assign(:accounts, [FactoryGirl.create(:account), FactoryGirl.create(:account)].paginate)
26
+ assign(:accounts, [FactoryGirl.build_stubbed(:account), FactoryGirl.build_stubbed(:account)].paginate)
27
27
 
28
28
  render
29
29
  expect(view).to render_template(partial: "_account")
@@ -13,7 +13,7 @@ describe "/accounts/index" do
13
13
  end
14
14
 
15
15
  it "should render [account] template with @accounts collection if there are accounts" do
16
- assign(:accounts, [FactoryGirl.create(:account, id: 42)].paginate)
16
+ assign(:accounts, [FactoryGirl.build_stubbed(:account, id: 42)].paginate)
17
17
 
18
18
  render template: 'accounts/index', formats: [:js]
19
19
 
@@ -11,7 +11,7 @@ describe "/accounts/update" do
11
11
  before do
12
12
  login_and_assign
13
13
 
14
- assign(:account, @account = FactoryGirl.create(:account, user: current_user))
14
+ assign(:account, @account = FactoryGirl.build_stubbed(:account, user: current_user))
15
15
  assign(:users, [current_user])
16
16
  assign(:account_category_total, Hash.new(1))
17
17
  end
@@ -11,7 +11,7 @@ describe "admin/field_groups/create" do
11
11
  assign(:field_group, field_group)
12
12
  end
13
13
 
14
- let(:field_group) { FactoryGirl.create(:field_group, label: 'test') }
14
+ let(:field_group) { FactoryGirl.build_stubbed(:field_group, label: 'test') }
15
15
 
16
16
  it "renders javascript" do
17
17
  render
@@ -11,7 +11,7 @@ describe "admin/field_groups/edit" do
11
11
  assign(:field_group, field_group)
12
12
  end
13
13
 
14
- let(:field_group) { FactoryGirl.create(:field_group, label: 'test') }
14
+ let(:field_group) { FactoryGirl.build_stubbed(:field_group, label: 'test') }
15
15
 
16
16
  it "renders javascript" do
17
17
  render
@@ -11,7 +11,7 @@ describe "admin/field_groups/new" do
11
11
  assign(:field_group, field_group)
12
12
  end
13
13
 
14
- let(:field_group) { FactoryGirl.create(:field_group, label: 'test') }
14
+ let(:field_group) { FactoryGirl.build_stubbed(:field_group, label: 'test') }
15
15
 
16
16
  it "renders javascript" do
17
17
  render
@@ -11,7 +11,7 @@ describe "admin/field_groups/update" do
11
11
  assign(:field_group, field_group)
12
12
  end
13
13
 
14
- let(:field_group) { FactoryGirl.create(:field_group, label: 'test') }
14
+ let(:field_group) { FactoryGirl.build_stubbed(:field_group, label: 'test') }
15
15
 
16
16
  it "renders javascript" do
17
17
  render
@@ -12,7 +12,7 @@ describe "admin/users/create" do
12
12
 
13
13
  describe "create success" do
14
14
  before do
15
- assign(:user, @user = FactoryGirl.create(:user))
15
+ assign(:user, @user = FactoryGirl.build_stubbed(:user))
16
16
  assign(:users, [@user]) # .paginate
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ describe "admin/users/destroy" do
26
26
 
27
27
  describe "user was not deleted" do
28
28
  before do
29
- assign(:user, @user = FactoryGirl.create(:user))
29
+ assign(:user, @user = FactoryGirl.build_stubbed(:user))
30
30
  end
31
31
 
32
32
  it "should remove confirmation panel" do
@@ -8,7 +8,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
8
8
  describe "admin/users/edit" do
9
9
  before do
10
10
  login_and_assign(admin: true)
11
- assign(:user, @user = FactoryGirl.create(:user))
11
+ assign(:user, @user = FactoryGirl.build_stubbed(:user))
12
12
  end
13
13
 
14
14
  it "cancel replaces [Edit User] form with user partial" do
@@ -19,7 +19,7 @@ describe "admin/users/edit" do
19
19
  end
20
20
 
21
21
  it "edit hides previously open [Edit User] and replaces it with user partial" do
22
- assign(:previous, previous = FactoryGirl.create(:user))
22
+ assign(:previous, previous = FactoryGirl.build_stubbed(:user))
23
23
  render
24
24
 
25
25
  expect(rendered).to include("user_#{previous.id}")
@@ -11,7 +11,7 @@ describe "/admin/users/index" do
11
11
  end
12
12
 
13
13
  it "renders a list of users" do
14
- assign(:users, [FactoryGirl.create(:user)].paginate)
14
+ assign(:users, [FactoryGirl.build_stubbed(:user)].paginate)
15
15
 
16
16
  render
17
17
  expect(view).to render_template(partial: "_user")
@@ -11,8 +11,8 @@ describe "admin/users/index" do
11
11
  end
12
12
 
13
13
  it "renders [admin/user] template with @users collection" do
14
- amy = FactoryGirl.create(:user)
15
- bob = FactoryGirl.create(:user)
14
+ amy = FactoryGirl.build_stubbed(:user)
15
+ bob = FactoryGirl.build_stubbed(:user)
16
16
  assign(:users, [amy, bob].paginate)
17
17
 
18
18
  render template: 'admin/users/index', formats: [:js]
@@ -8,7 +8,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
8
8
  describe "admin/users/reactivate" do
9
9
  before do
10
10
  login_and_assign(admin: true)
11
- assign(:user, @user = FactoryGirl.create(:user, suspended_at: Time.now.yesterday))
11
+ assign(:user, @user = FactoryGirl.build_stubbed(:user, suspended_at: Time.now.yesterday))
12
12
  end
13
13
 
14
14
  it "reloads the requested user partial" do
@@ -8,7 +8,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
8
8
  describe "admin/users/suspend" do
9
9
  before do
10
10
  login_and_assign(admin: true)
11
- assign(:user, @user = FactoryGirl.create(:user, suspended_at: nil))
11
+ assign(:user, @user = FactoryGirl.build_stubbed(:user, suspended_at: nil))
12
12
  end
13
13
 
14
14
  it "reloads the requested user partial" do
@@ -8,7 +8,7 @@ require 'spec_helper'
8
8
  describe "admin/users/update" do
9
9
  before do
10
10
  login_and_assign(admin: true)
11
- assign(:user, @user = FactoryGirl.create(:user))
11
+ assign(:user, @user = FactoryGirl.build_stubbed(:user))
12
12
  end
13
13
 
14
14
  describe "no errors:" do
@@ -15,11 +15,11 @@ describe "/application/_auto_complete" do
15
15
  [:account, :campaign, :contact, :lead, :opportunity].each do |model|
16
16
  it "should render autocomplete list if #{model} matches found" do
17
17
  @auto_complete = if model == :lead
18
- FactoryGirl.create(:lead, first_name: "Billy", last_name: "Bones", company: "Hello, World!")
18
+ FactoryGirl.build_stubbed(:lead, first_name: "Billy", last_name: "Bones", company: "Hello, World!")
19
19
  elsif model == :contact
20
- FactoryGirl.create(:contact, first_name: "Billy", last_name: "Bones")
20
+ FactoryGirl.build_stubbed(:contact, first_name: "Billy", last_name: "Bones")
21
21
  else
22
- FactoryGirl.create(model, name: "Hello, World!")
22
+ FactoryGirl.build_stubbed(model, name: "Hello, World!")
23
23
  end
24
24
  assign(:auto_complete, [@auto_complete])
25
25
 
@@ -10,7 +10,7 @@ describe "/campaigns/_edit" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- assign(:campaign, @campaign = FactoryGirl.create(:campaign))
13
+ assign(:campaign, @campaign = FactoryGirl.build_stubbed(:campaign))
14
14
  assign(:users, [current_user])
15
15
  end
16
16
 
@@ -12,7 +12,7 @@ describe "/campaigns/create" do
12
12
 
13
13
  describe "create success" do
14
14
  before do
15
- assign(:campaign, @campaign = FactoryGirl.create(:campaign))
15
+ assign(:campaign, @campaign = FactoryGirl.build_stubbed(:campaign))
16
16
  assign(:campaigns, [@campaign].paginate)
17
17
  assign(:campaign_status_total, Hash.new(1))
18
18
  render
@@ -37,7 +37,7 @@ describe "/campaigns/create" do
37
37
  describe "create failure" do
38
38
  it "should re-render [create] template in :create_campaign div" do
39
39
  assign(:campaign, FactoryGirl.build(:campaign, name: nil)) # make it invalid
40
- assign(:users, [FactoryGirl.create(:user)])
40
+ assign(:users, [FactoryGirl.build_stubbed(:user)])
41
41
 
42
42
  render
43
43
 
@@ -8,7 +8,7 @@ require 'spec_helper'
8
8
  describe "/campaigns/destroy" do
9
9
  before do
10
10
  login_and_assign
11
- assign(:campaign, @campaign = FactoryGirl.create(:campaign, user: current_user))
11
+ assign(:campaign, @campaign = FactoryGirl.build_stubbed(:campaign, user: current_user))
12
12
  assign(:campaigns, [@campaign].paginate)
13
13
  assign(:campaign_status_total, Hash.new(1))
14
14
  render
@@ -10,7 +10,7 @@ describe "/campaigns/edit" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- assign(:campaign, @campaign = FactoryGirl.create(:campaign, user: current_user))
13
+ assign(:campaign, @campaign = FactoryGirl.build_stubbed(:campaign, user: current_user))
14
14
  assign(:users, [current_user])
15
15
  end
16
16
 
@@ -31,7 +31,7 @@ describe "/campaigns/edit" do
31
31
 
32
32
  it "edit: should hide previously open [Edit Campaign] for and replace it with campaign partial" do
33
33
  params[:cancel] = nil
34
- assign(:previous, previous = FactoryGirl.create(:campaign, user: current_user))
34
+ assign(:previous, previous = FactoryGirl.build_stubbed(:campaign, user: current_user))
35
35
 
36
36
  render
37
37
  expect(rendered).to include("$('#campaign_#{previous.id}').replaceWith('<li class=\\'campaign highlight\\' id=\\'campaign_#{previous.id}\\'")
@@ -17,7 +17,7 @@ describe "/campaigns/index" do
17
17
  end
18
18
 
19
19
  it "should render list of accounts if list of campaigns is not empty" do
20
- assign(:campaigns, [FactoryGirl.create(:campaign)].paginate)
20
+ assign(:campaigns, [FactoryGirl.build_stubbed(:campaign)].paginate)
21
21
 
22
22
  render
23
23
  expect(view).to render_template(partial: "_campaign")
@@ -13,7 +13,7 @@ describe "/campaigns/index" do
13
13
  end
14
14
 
15
15
  it "should render [campaign] template with @campaigns collection if there are campaigns" do
16
- assign(:campaigns, [FactoryGirl.create(:campaign, id: 42)].paginate)
16
+ assign(:campaigns, [FactoryGirl.build_stubbed(:campaign, id: 42)].paginate)
17
17
 
18
18
  render template: 'campaigns/index', formats: [:js]
19
19
 
@@ -10,13 +10,13 @@ describe "/campaigns/show" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- @campaign = FactoryGirl.create(:campaign, id: 42,
14
- leads: [FactoryGirl.create(:lead)],
15
- opportunities: [FactoryGirl.create(:opportunity)])
13
+ @campaign = FactoryGirl.build_stubbed(:campaign, id: 42,
14
+ leads: [FactoryGirl.build_stubbed(:lead)],
15
+ opportunities: [FactoryGirl.build_stubbed(:opportunity)])
16
16
  assign(:campaign, @campaign)
17
17
  assign(:users, [current_user])
18
18
  assign(:comment, Comment.new)
19
- assign(:timeline, [FactoryGirl.create(:comment, commentable: @campaign)])
19
+ assign(:timeline, [FactoryGirl.build_stubbed(:comment, commentable: @campaign)])
20
20
  allow(view).to receive(:params) { { id: 123 } }
21
21
  end
22
22
 
@@ -8,7 +8,7 @@ require 'spec_helper'
8
8
  describe "/campaigns/update" do
9
9
  before do
10
10
  login_and_assign
11
- assign(:campaign, @campaign = FactoryGirl.create(:campaign, user: current_user))
11
+ assign(:campaign, @campaign = FactoryGirl.build_stubbed(:campaign, user: current_user))
12
12
  assign(:users, [current_user])
13
13
  assign(:status, Setting.campaign_status)
14
14
  assign(:campaign_status_total, Hash.new(1))
@@ -10,7 +10,7 @@ describe "/contacts/_new" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- @account = FactoryGirl.create(:account)
13
+ @account = FactoryGirl.build_stubbed(:account)
14
14
  assign(:contact, Contact.new)
15
15
  assign(:users, [current_user])
16
16
  assign(:account, @account)
@@ -14,7 +14,7 @@ describe "/contacts/create" do
14
14
 
15
15
  describe "create success" do
16
16
  before do
17
- assign(:contact, @contact = FactoryGirl.create(:contact))
17
+ assign(:contact, @contact = FactoryGirl.build_stubbed(:contact))
18
18
  assign(:contacts, [@contact].paginate)
19
19
  end
20
20
 
@@ -50,8 +50,8 @@ describe "/contacts/create" do
50
50
  describe "create failure" do
51
51
  it "create (failure): should re-render [create] template in :create_contact div" do
52
52
  assign(:contact, FactoryGirl.build(:contact, first_name: nil)) # make it invalid
53
- @account = FactoryGirl.create(:account)
54
- assign(:users, [FactoryGirl.create(:user)])
53
+ @account = FactoryGirl.build_stubbed(:account)
54
+ assign(:users, [FactoryGirl.build_stubbed(:user)])
55
55
  assign(:account, @account)
56
56
  assign(:accounts, [@account])
57
57
 
@@ -10,7 +10,7 @@ describe "/contacts/destroy" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- assign(:contact, @contact = FactoryGirl.create(:contact))
13
+ assign(:contact, @contact = FactoryGirl.build_stubbed(:contact))
14
14
  assign(:contacts, [@contact].paginate)
15
15
  end
16
16
 
@@ -10,9 +10,9 @@ describe "/contacts/edit" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- assign(:contact, @contact = FactoryGirl.create(:contact, user: current_user))
13
+ assign(:contact, @contact = FactoryGirl.build_stubbed(:contact, user: current_user))
14
14
  assign(:users, [current_user])
15
- assign(:account, @account = FactoryGirl.create(:account))
15
+ assign(:account, @account = FactoryGirl.build_stubbed(:account))
16
16
  assign(:accounts, [@account])
17
17
  end
18
18
 
@@ -33,7 +33,7 @@ describe "/contacts/edit" do
33
33
 
34
34
  it "edit: should hide previously open [Edit Contact] for and replace it with contact partial" do
35
35
  params[:cancel] = nil
36
- assign(:previous, previous = FactoryGirl.create(:contact, user: current_user))
36
+ assign(:previous, previous = FactoryGirl.build_stubbed(:contact, user: current_user))
37
37
 
38
38
  render
39
39
  expect(rendered).to include("$('#contact_#{previous.id}').replaceWith")
@@ -17,7 +17,7 @@ describe "/contacts/index" do
17
17
  end
18
18
 
19
19
  it "should render a list of contacts if it's not empty" do
20
- assign(:contacts, [FactoryGirl.create(:contact)].paginate)
20
+ assign(:contacts, [FactoryGirl.build_stubbed(:contact)].paginate)
21
21
 
22
22
  render
23
23
  expect(view).to render_template(partial: "_contact")
@@ -13,7 +13,7 @@ describe "/contacts/index" do
13
13
  end
14
14
 
15
15
  it "should render [contact] template with @contacts collection if there are contacts" do
16
- assign(:contacts, [FactoryGirl.create(:contact, id: 42)].paginate)
16
+ assign(:contacts, [FactoryGirl.build_stubbed(:contact, id: 42)].paginate)
17
17
 
18
18
  render template: 'contacts/index', formats: [:js]
19
19
 
@@ -10,7 +10,7 @@ describe "/contacts/new" do
10
10
 
11
11
  before do
12
12
  login_and_assign
13
- @account = FactoryGirl.create(:account)
13
+ @account = FactoryGirl.build_stubbed(:account)
14
14
  assign(:contact, Contact.new(user: current_user))
15
15
  assign(:users, [current_user])
16
16
  assign(:account, @account)
@@ -11,9 +11,9 @@ describe "/contacts/update" do
11
11
  before do
12
12
  login_and_assign
13
13
 
14
- assign(:contact, @contact = FactoryGirl.create(:contact, user: current_user))
14
+ assign(:contact, @contact = FactoryGirl.build_stubbed(:contact, user: current_user))
15
15
  assign(:users, [current_user])
16
- assign(:account, @account = FactoryGirl.create(:account))
16
+ assign(:account, @account = FactoryGirl.build_stubbed(:account))
17
17
  assign(:accounts, [@account])
18
18
  end
19
19