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.
- checksums.yaml +5 -5
- data/.travis.yml +15 -5
- data/{CHANGELOG → CHANGELOG.md} +9 -8
- data/Gemfile +1 -1
- data/Gemfile.lock +78 -70
- data/README.md +8 -10
- data/app/controllers/admin/users_controller.rb +6 -1
- data/app/controllers/application_controller.rb +2 -0
- data/app/controllers/users_controller.rb +1 -0
- data/app/helpers/tags_helper.rb +1 -1
- data/app/models/users/user.rb +10 -9
- data/config/initializers/paper_trail.rb +1 -0
- data/fat_free_crm.gemspec +4 -4
- data/lib/development_tasks/rspec.rake +2 -6
- data/lib/fat_free_crm/engine.rb +5 -0
- data/lib/fat_free_crm/version.rb +3 -3
- data/spec/factories/field_factories.rb +1 -1
- data/spec/factories/opportunity_factories.rb +1 -1
- data/spec/mailers/subscription_mailer_spec.rb +5 -3
- data/spec/mailers/user_mailer_spec.rb +6 -6
- data/spec/models/users/abilities/user_ability_spec.rb +3 -3
- data/spec/models/users/user_spec.rb +73 -62
- data/spec/support/auth_macros.rb +8 -1
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/create.js.haml_spec.rb +1 -1
- data/spec/views/accounts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/accounts/edit.js.haml_spec.rb +2 -2
- data/spec/views/accounts/index.haml_spec.rb +2 -2
- data/spec/views/accounts/index.js.haml_spec.rb +1 -1
- data/spec/views/accounts/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/create.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/destroy.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/edit.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/index.haml_spec.rb +1 -1
- data/spec/views/admin/users/index.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/suspend.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/update.js.haml_spec.rb +1 -1
- data/spec/views/application/auto_complete.haml_spec.rb +3 -3
- data/spec/views/campaigns/_edit.haml_spec.rb +1 -1
- data/spec/views/campaigns/create.js.haml_spec.rb +2 -2
- data/spec/views/campaigns/destroy.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/edit.js.haml_spec.rb +2 -2
- data/spec/views/campaigns/index.haml_spec.rb +1 -1
- data/spec/views/campaigns/index.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/show.haml_spec.rb +4 -4
- data/spec/views/campaigns/update.js.haml_spec.rb +1 -1
- data/spec/views/contacts/_new.haml_spec.rb +1 -1
- data/spec/views/contacts/create.js.haml_spec.rb +3 -3
- data/spec/views/contacts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/contacts/edit.js.haml_spec.rb +3 -3
- data/spec/views/contacts/index.haml_spec.rb +1 -1
- data/spec/views/contacts/index.js.html_spec.rb +1 -1
- data/spec/views/contacts/new.js.haml_spec.rb +1 -1
- data/spec/views/contacts/update.js.haml_spec.rb +2 -2
- data/spec/views/home/index.haml_spec.rb +1 -1
- data/spec/views/home/index.js.haml_spec.rb +2 -2
- data/spec/views/home/options.js.haml_spec.rb +2 -2
- data/spec/views/leads/_convert.haml_spec.rb +3 -3
- data/spec/views/leads/_edit.haml_spec.rb +2 -2
- data/spec/views/leads/_new.haml_spec.rb +1 -1
- data/spec/views/leads/_sidebar_show.haml_spec.rb +1 -1
- data/spec/views/leads/convert.js.haml_spec.rb +4 -4
- data/spec/views/leads/create.js.haml_spec.rb +3 -3
- data/spec/views/leads/destroy.js.haml_spec.rb +2 -2
- data/spec/views/leads/edit.js.haml_spec.rb +4 -4
- data/spec/views/leads/index.haml_spec.rb +1 -1
- data/spec/views/leads/index.js.haml_spec.rb +1 -1
- data/spec/views/leads/new.js.haml_spec.rb +1 -1
- data/spec/views/leads/promote.js.haml_spec.rb +7 -7
- data/spec/views/leads/reject.js.haml_spec.rb +2 -2
- data/spec/views/leads/show.haml_spec.rb +2 -2
- data/spec/views/leads/update.js.haml_spec.rb +4 -4
- data/spec/views/opportunities/_edit.haml_spec.rb +5 -5
- data/spec/views/opportunities/_new.haml_spec.rb +1 -1
- data/spec/views/opportunities/create.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/destroy.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/edit.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/index.haml_spec.rb +1 -1
- data/spec/views/opportunities/index.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/new.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/update.js.haml_spec.rb +4 -4
- data/spec/views/tasks/_edit.haml_spec.rb +1 -1
- data/spec/views/tasks/complete.js.haml_spec.rb +4 -4
- data/spec/views/tasks/create.js.haml_spec.rb +5 -5
- data/spec/views/tasks/destroy.js.haml_spec.rb +2 -2
- data/spec/views/tasks/index.haml_spec.rb +4 -4
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +2 -2
- data/spec/views/tasks/update.js.haml_spec.rb +18 -18
- data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
- metadata +17 -14
@@ -13,7 +13,7 @@ describe "/home/index" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should render list of activities if it's not empty" do
|
16
|
-
assign(:activities, [FactoryGirl.
|
16
|
+
assign(:activities, [FactoryGirl.build_stubbed(:version, event: "update", item: FactoryGirl.build_stubbed(:account))])
|
17
17
|
assign(:my_tasks, [])
|
18
18
|
assign(:my_opportunities, [])
|
19
19
|
assign(:my_accounts, [])
|
@@ -9,11 +9,11 @@ describe "/home/index" do
|
|
9
9
|
include HomeHelper
|
10
10
|
|
11
11
|
before do
|
12
|
-
login_and_assign
|
12
|
+
login_and_assign!
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should render [activity] template with @activities collection" do
|
16
|
-
assign(:activities, [FactoryGirl.
|
16
|
+
assign(:activities, [FactoryGirl.build_stubbed(:version, id: 42, event: "update", item: FactoryGirl.build_stubbed(:account), whodunnit: current_user.id.to_s)])
|
17
17
|
|
18
18
|
render template: 'home/index', formats: [:js]
|
19
19
|
|
@@ -17,7 +17,7 @@ describe "/home/options" do
|
|
17
17
|
assign(:user, "all_users")
|
18
18
|
assign(:action, "all_actions")
|
19
19
|
assign(:duration, "two_days")
|
20
|
-
assign(:all_users, [FactoryGirl.
|
20
|
+
assign(:all_users, [FactoryGirl.build_stubbed(:user)])
|
21
21
|
|
22
22
|
render
|
23
23
|
|
@@ -33,7 +33,7 @@ describe "/home/options" do
|
|
33
33
|
assign(:action, "all_actions")
|
34
34
|
assign(:user, "all_users")
|
35
35
|
assign(:duration, "two_days")
|
36
|
-
assign(:all_users, [FactoryGirl.
|
36
|
+
assign(:all_users, [FactoryGirl.build_stubbed(:user)])
|
37
37
|
|
38
38
|
render
|
39
39
|
|
@@ -10,12 +10,12 @@ describe "/leads/_convert" do
|
|
10
10
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
|
-
@account = FactoryGirl.
|
14
|
-
assign(:lead, FactoryGirl.
|
13
|
+
@account = FactoryGirl.build_stubbed(:account)
|
14
|
+
assign(:lead, FactoryGirl.build_stubbed(:lead))
|
15
15
|
assign(:users, [current_user])
|
16
16
|
assign(:account, @account)
|
17
17
|
assign(:accounts, [@account])
|
18
|
-
assign(:opportunity, FactoryGirl.
|
18
|
+
assign(:opportunity, FactoryGirl.build_stubbed(:opportunity))
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should render [convert lead] form" do
|
@@ -10,9 +10,9 @@ describe "/leads/_edit" do
|
|
10
10
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
|
-
assign(:lead, @lead = FactoryGirl.
|
13
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead))
|
14
14
|
assign(:users, [current_user])
|
15
|
-
assign(:campaign, @campaign = FactoryGirl.
|
15
|
+
assign(:campaign, @campaign = FactoryGirl.build_stubbed(:campaign))
|
16
16
|
assign(:campaigns, [@campaign])
|
17
17
|
end
|
18
18
|
|
@@ -12,7 +12,7 @@ describe "/leads/_new" do
|
|
12
12
|
login_and_assign
|
13
13
|
assign(:lead, FactoryGirl.build(:lead))
|
14
14
|
assign(:users, [current_user])
|
15
|
-
assign(:campaign, @campaign = FactoryGirl.
|
15
|
+
assign(:campaign, @campaign = FactoryGirl.build_stubbed(:campaign))
|
16
16
|
assign(:campaigns, [@campaign])
|
17
17
|
end
|
18
18
|
|
@@ -12,7 +12,7 @@ describe "/leads/_sidebar_show" do
|
|
12
12
|
login_and_assign
|
13
13
|
assign(:users, [current_user])
|
14
14
|
assign(:comment, Comment.new)
|
15
|
-
assign(:lead, FactoryGirl.
|
15
|
+
assign(:lead, FactoryGirl.build_stubbed(:lead,
|
16
16
|
blog: 'http://www.blogger.com/home',
|
17
17
|
linkedin: 'www.linkedin.com',
|
18
18
|
twitter: 'twitter.com/account',
|
@@ -11,11 +11,11 @@ describe "/leads/convert" do
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
13
|
|
14
|
-
assign(:lead, @lead = FactoryGirl.
|
14
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead, user: current_user))
|
15
15
|
assign(:users, [current_user])
|
16
|
-
assign(:account, @account = FactoryGirl.
|
16
|
+
assign(:account, @account = FactoryGirl.build_stubbed(:account))
|
17
17
|
assign(:accounts, [@account])
|
18
|
-
assign(:opportunity, FactoryGirl.
|
18
|
+
assign(:opportunity, FactoryGirl.build_stubbed(:opportunity))
|
19
19
|
end
|
20
20
|
|
21
21
|
it "cancel from lead index page: should replace [Convert Lead] form with lead partial" do
|
@@ -35,7 +35,7 @@ describe "/leads/convert" do
|
|
35
35
|
|
36
36
|
it "convert: should hide previously open [Convert Lead] and replace it with lead partial" do
|
37
37
|
params[:cancel] = nil
|
38
|
-
assign(:previous, previous = FactoryGirl.
|
38
|
+
assign(:previous, previous = FactoryGirl.build_stubbed(:lead, user: current_user))
|
39
39
|
|
40
40
|
render
|
41
41
|
expect(rendered).to include("$('#lead_#{previous.id}').replaceWith")
|
@@ -9,12 +9,12 @@ describe "/leads/create" do
|
|
9
9
|
before do
|
10
10
|
controller.controller_path = 'leads'
|
11
11
|
login_and_assign
|
12
|
-
assign(:campaigns, [FactoryGirl.
|
12
|
+
assign(:campaigns, [FactoryGirl.build_stubbed(:campaign)])
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "create success" do
|
16
16
|
before do
|
17
|
-
assign(:lead, @lead = FactoryGirl.
|
17
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead))
|
18
18
|
assign(:leads, [@lead].paginate)
|
19
19
|
assign(:lead_status_total, Hash.new(1))
|
20
20
|
end
|
@@ -57,7 +57,7 @@ describe "/leads/create" do
|
|
57
57
|
describe "create failure" do
|
58
58
|
it "should re-render [create] template in :create_lead div" do
|
59
59
|
assign(:lead, FactoryGirl.build(:lead, first_name: nil)) # make it invalid
|
60
|
-
assign(:users, [FactoryGirl.
|
60
|
+
assign(:users, [FactoryGirl.build_stubbed(:user)])
|
61
61
|
|
62
62
|
render
|
63
63
|
|
@@ -8,7 +8,7 @@ require 'spec_helper'
|
|
8
8
|
describe "/leads/destroy" do
|
9
9
|
before do
|
10
10
|
login_and_assign
|
11
|
-
assign(:lead, @lead = FactoryGirl.
|
11
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead))
|
12
12
|
assign(:lead_status_total, Hash.new(1))
|
13
13
|
end
|
14
14
|
|
@@ -36,7 +36,7 @@ describe "/leads/destroy" do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should update related asset sidebar when called from related asset" do
|
39
|
-
assign(:campaign, campaign = FactoryGirl.
|
39
|
+
assign(:campaign, campaign = FactoryGirl.build_stubbed(:campaign))
|
40
40
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
41
41
|
render
|
42
42
|
|
@@ -10,9 +10,9 @@ describe "/leads/edit" do
|
|
10
10
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
|
-
assign(:lead, @lead = FactoryGirl.
|
13
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead, status: "new", user: current_user))
|
14
14
|
assign(:users, [current_user])
|
15
|
-
assign(:campaigns, [FactoryGirl.
|
15
|
+
assign(:campaigns, [FactoryGirl.build_stubbed(:campaign)])
|
16
16
|
end
|
17
17
|
|
18
18
|
it "cancel from lead index page: should replace [Edit Lead] form with lead partial" do
|
@@ -32,7 +32,7 @@ describe "/leads/edit" do
|
|
32
32
|
|
33
33
|
it "edit: should hide previously open [Edit Lead] and replace it with lead partial" do
|
34
34
|
params[:cancel] = nil
|
35
|
-
assign(:previous, previous = FactoryGirl.
|
35
|
+
assign(:previous, previous = FactoryGirl.build_stubbed(:lead, user: current_user))
|
36
36
|
|
37
37
|
render
|
38
38
|
expect(rendered).to include("$('#lead_#{previous.id}').replaceWith('<li class=\\'highlight lead\\' id=\\'lead_#{previous.id}\\'")
|
@@ -66,7 +66,7 @@ describe "/leads/edit" do
|
|
66
66
|
|
67
67
|
it "edit from lead landing page: should not attempt to hide [Convert Lead] if the lead is already converted" do
|
68
68
|
params[:cancel] = "false"
|
69
|
-
assign(:lead, FactoryGirl.
|
69
|
+
assign(:lead, FactoryGirl.build_stubbed(:lead, status: "converted", user: current_user))
|
70
70
|
|
71
71
|
render
|
72
72
|
expect(rendered).not_to include("crm.hide_form('convert_lead'")
|
@@ -17,7 +17,7 @@ describe "/leads/index" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should render list of accounts if list of leads is not empty" do
|
20
|
-
assign(:leads, [FactoryGirl.
|
20
|
+
assign(:leads, [FactoryGirl.build_stubbed(:lead)].paginate(page: 1, per_page: 20))
|
21
21
|
|
22
22
|
render
|
23
23
|
expect(view).to render_template(partial: "_lead")
|
@@ -13,7 +13,7 @@ describe "/leads/index" do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should render [lead] template with @leads collection if there are leads" do
|
16
|
-
assign(:leads, [FactoryGirl.
|
16
|
+
assign(:leads, [FactoryGirl.build_stubbed(:lead, id: 42)].paginate(page: 1, per_page: 20))
|
17
17
|
|
18
18
|
render template: 'leads/index', formats: [:js]
|
19
19
|
|
@@ -10,7 +10,7 @@ describe "/leads/new" do
|
|
10
10
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
|
-
@campaign = FactoryGirl.
|
13
|
+
@campaign = FactoryGirl.build_stubbed(:campaign)
|
14
14
|
assign(:lead, Lead.new(user: current_user))
|
15
15
|
assign(:users, [current_user])
|
16
16
|
assign(:campaign, @campaign)
|
@@ -9,16 +9,16 @@ describe "/leads/promote" do
|
|
9
9
|
before do
|
10
10
|
login_and_assign
|
11
11
|
assign(:users, [current_user])
|
12
|
-
assign(:account, @account = FactoryGirl.
|
12
|
+
assign(:account, @account = FactoryGirl.build_stubbed(:account))
|
13
13
|
assign(:accounts, [@account])
|
14
|
-
assign(:contact, FactoryGirl.
|
15
|
-
assign(:opportunity, FactoryGirl.
|
14
|
+
assign(:contact, FactoryGirl.build_stubbed(:contact))
|
15
|
+
assign(:opportunity, FactoryGirl.build_stubbed(:opportunity))
|
16
16
|
assign(:lead_status_total, Hash.new(1))
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "no errors :" do
|
20
20
|
before do
|
21
|
-
assign(:lead, @lead = FactoryGirl.
|
21
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead, status: "converted", user: current_user, assignee: current_user))
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "from lead landing page -" do
|
@@ -64,9 +64,9 @@ describe "/leads/promote" do
|
|
64
64
|
describe "from related campaign page -" do
|
65
65
|
before do
|
66
66
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/123"
|
67
|
-
assign(:campaign, FactoryGirl.
|
67
|
+
assign(:campaign, FactoryGirl.build_stubbed(:campaign))
|
68
68
|
assign(:stage, Setting.unroll(:opportunity_stage))
|
69
|
-
assign(:opportunity, @opportunity = FactoryGirl.
|
69
|
+
assign(:opportunity, @opportunity = FactoryGirl.build_stubbed(:opportunity))
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should replace [Convert Lead] with lead partial and highlight it" do
|
@@ -93,7 +93,7 @@ describe "/leads/promote" do
|
|
93
93
|
|
94
94
|
describe "validation errors:" do
|
95
95
|
before do
|
96
|
-
assign(:lead, @lead = FactoryGirl.
|
96
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead, status: "new", user: current_user, assignee: current_user))
|
97
97
|
end
|
98
98
|
|
99
99
|
describe "from lead landing page -" do
|
@@ -8,7 +8,7 @@ require 'spec_helper'
|
|
8
8
|
describe "/leads/reject" do
|
9
9
|
before do
|
10
10
|
login_and_assign
|
11
|
-
assign(:lead, @lead = FactoryGirl.
|
11
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead, status: "new"))
|
12
12
|
assign(:lead_status_total, Hash.new(1))
|
13
13
|
end
|
14
14
|
|
@@ -35,7 +35,7 @@ describe "/leads/reject" do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should update campaign sidebar if called from campaign landing page" do
|
38
|
-
assign(:campaign, campaign = FactoryGirl.
|
38
|
+
assign(:campaign, campaign = FactoryGirl.build_stubbed(:campaign))
|
39
39
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
40
40
|
render
|
41
41
|
|
@@ -10,10 +10,10 @@ describe "/leads/show" do
|
|
10
10
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
|
-
assign(:lead, @lead = FactoryGirl.
|
13
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead, id: 42))
|
14
14
|
assign(:users, [current_user])
|
15
15
|
assign(:comment, Comment.new)
|
16
|
-
assign(:timeline, [FactoryGirl.
|
16
|
+
assign(:timeline, [FactoryGirl.build_stubbed(:comment, commentable: @lead)])
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should render lead landing page" do
|
@@ -8,9 +8,9 @@ require 'spec_helper'
|
|
8
8
|
describe "/leads/update" do
|
9
9
|
before do
|
10
10
|
login_and_assign
|
11
|
-
assign(:lead, @lead = FactoryGirl.
|
11
|
+
assign(:lead, @lead = FactoryGirl.build_stubbed(:lead, user: current_user, assignee: FactoryGirl.build_stubbed(:user)))
|
12
12
|
assign(:users, [current_user])
|
13
|
-
assign(:campaigns, [FactoryGirl.
|
13
|
+
assign(:campaigns, [FactoryGirl.build_stubbed(:campaign)])
|
14
14
|
assign(:lead_status_total, Hash.new(1))
|
15
15
|
end
|
16
16
|
|
@@ -56,7 +56,7 @@ describe "/leads/update" do
|
|
56
56
|
|
57
57
|
describe "on related asset page -" do
|
58
58
|
before do
|
59
|
-
assign(:campaign, FactoryGirl.
|
59
|
+
assign(:campaign, FactoryGirl.build_stubbed(:campaign))
|
60
60
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/123"
|
61
61
|
end
|
62
62
|
|
@@ -67,7 +67,7 @@ describe "/leads/update" do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should update campaign sidebar" do
|
70
|
-
assign(:campaign, campaign = FactoryGirl.
|
70
|
+
assign(:campaign, campaign = FactoryGirl.build_stubbed(:campaign))
|
71
71
|
render
|
72
72
|
|
73
73
|
expect(rendered).to include("sidebar")
|
@@ -10,14 +10,14 @@ describe "/opportunities/_edit" do
|
|
10
10
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
|
-
assign(:account, @account = FactoryGirl.
|
13
|
+
assign(:account, @account = FactoryGirl.build_stubbed(:account))
|
14
14
|
assign(:accounts, [@account])
|
15
15
|
assign(:stage, Setting.unroll(:opportunity_stage))
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should render [edit opportunity] form" do
|
19
19
|
assign(:users, [current_user])
|
20
|
-
assign(:opportunity, @opportunity = FactoryGirl.
|
20
|
+
assign(:opportunity, @opportunity = FactoryGirl.build_stubbed(:opportunity, campaign: @campaign = FactoryGirl.build_stubbed(:campaign)))
|
21
21
|
render
|
22
22
|
|
23
23
|
expect(rendered).to have_tag("form[class=edit_opportunity]") do
|
@@ -28,7 +28,7 @@ describe "/opportunities/_edit" do
|
|
28
28
|
|
29
29
|
it "should pick default assignee (Myself)" do
|
30
30
|
assign(:users, [current_user])
|
31
|
-
assign(:opportunity, FactoryGirl.
|
31
|
+
assign(:opportunity, FactoryGirl.build_stubbed(:opportunity, assignee: nil))
|
32
32
|
render
|
33
33
|
|
34
34
|
expect(rendered).to have_tag("select[id=opportunity_assigned_to]") do |options|
|
@@ -50,7 +50,7 @@ describe "/opportunities/_edit" do
|
|
50
50
|
|
51
51
|
it "should render background info field if settings require so" do
|
52
52
|
assign(:users, [current_user])
|
53
|
-
assign(:opportunity, FactoryGirl.
|
53
|
+
assign(:opportunity, FactoryGirl.build_stubbed(:opportunity))
|
54
54
|
Setting.background_info = [:opportunity]
|
55
55
|
|
56
56
|
render
|
@@ -59,7 +59,7 @@ describe "/opportunities/_edit" do
|
|
59
59
|
|
60
60
|
it "should not render background info field if settings do not require so" do
|
61
61
|
assign(:users, [current_user])
|
62
|
-
assign(:opportunity, FactoryGirl.
|
62
|
+
assign(:opportunity, FactoryGirl.build_stubbed(:opportunity))
|
63
63
|
Setting.background_info = []
|
64
64
|
|
65
65
|
render
|
@@ -11,7 +11,7 @@ describe "/opportunities/_new" do
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
13
|
assign(:opportunity, FactoryGirl.build(:opportunity))
|
14
|
-
@account = FactoryGirl.
|
14
|
+
@account = FactoryGirl.build_stubbed(:account)
|
15
15
|
assign(:account, @account)
|
16
16
|
assign(:accounts, [@account])
|
17
17
|
assign(:users, [current_user])
|
@@ -13,7 +13,7 @@ describe "/opportunities/create" do
|
|
13
13
|
|
14
14
|
describe "create success" do
|
15
15
|
before do
|
16
|
-
assign(:opportunity, @opportunity = FactoryGirl.
|
16
|
+
assign(:opportunity, @opportunity = FactoryGirl.build_stubbed(:opportunity))
|
17
17
|
assign(:opportunities, [@opportunities].paginate)
|
18
18
|
assign(:opportunity_stage_total, Hash.new(1))
|
19
19
|
end
|
@@ -71,8 +71,8 @@ describe "/opportunities/create" do
|
|
71
71
|
describe "create failure" do
|
72
72
|
it "should re-render [create] template in :create_opportunity div" do
|
73
73
|
assign(:opportunity, FactoryGirl.build(:opportunity, name: nil)) # make it invalid
|
74
|
-
@account = FactoryGirl.
|
75
|
-
assign(:users, [FactoryGirl.
|
74
|
+
@account = FactoryGirl.build_stubbed(:account)
|
75
|
+
assign(:users, [FactoryGirl.build_stubbed(:user)])
|
76
76
|
assign(:account, @account)
|
77
77
|
assign(:accounts, [@account])
|
78
78
|
|
@@ -8,7 +8,7 @@ require 'spec_helper'
|
|
8
8
|
describe "/opportunities/destroy" do
|
9
9
|
before do
|
10
10
|
login_and_assign
|
11
|
-
assign(:opportunity, @opportunity = FactoryGirl.
|
11
|
+
assign(:opportunity, @opportunity = FactoryGirl.build_stubbed(:opportunity))
|
12
12
|
assign(:stage, Setting.unroll(:opportunity_stage))
|
13
13
|
assign(:opportunity_stage_total, Hash.new(1))
|
14
14
|
end
|
@@ -37,7 +37,7 @@ describe "/opportunities/destroy" do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should update related account sidebar when called from related account" do
|
40
|
-
assign(:account, account = FactoryGirl.
|
40
|
+
assign(:account, account = FactoryGirl.build_stubbed(:account))
|
41
41
|
controller.request.env["HTTP_REFERER"] = "http://localhost/accounts/#{account.id}"
|
42
42
|
render
|
43
43
|
|
@@ -47,7 +47,7 @@ describe "/opportunities/destroy" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should update related campaign sidebar when called from related campaign" do
|
50
|
-
assign(:campaign, campaign = FactoryGirl.
|
50
|
+
assign(:campaign, campaign = FactoryGirl.build_stubbed(:campaign))
|
51
51
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
52
52
|
render
|
53
53
|
|
@@ -11,9 +11,9 @@ describe "/opportunities/edit" do
|
|
11
11
|
before do
|
12
12
|
login_and_assign
|
13
13
|
|
14
|
-
assign(:opportunity, @opportunity = FactoryGirl.
|
14
|
+
assign(:opportunity, @opportunity = FactoryGirl.build_stubbed(:opportunity, user: current_user))
|
15
15
|
assign(:users, [current_user])
|
16
|
-
assign(:account, @account = FactoryGirl.
|
16
|
+
assign(:account, @account = FactoryGirl.build_stubbed(:account))
|
17
17
|
assign(:accounts, [@account])
|
18
18
|
assign(:stage, Setting.unroll(:opportunity_stage))
|
19
19
|
end
|
@@ -35,7 +35,7 @@ describe "/opportunities/edit" do
|
|
35
35
|
|
36
36
|
it "edit: should hide previously open [Edit Opportunity] for and replace it with opportunity partial" do
|
37
37
|
params[:cancel] = nil
|
38
|
-
assign(:previous, previous = FactoryGirl.
|
38
|
+
assign(:previous, previous = FactoryGirl.build_stubbed(:opportunity, user: current_user))
|
39
39
|
|
40
40
|
render
|
41
41
|
expect(rendered).to include("$('#opportunity_#{previous.id}').replaceWith")
|
@@ -18,7 +18,7 @@ describe "/opportunities/index" do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should render list of accounts if list of opportunities is not empty" do
|
21
|
-
assign(:opportunities, [FactoryGirl.
|
21
|
+
assign(:opportunities, [FactoryGirl.build_stubbed(:opportunity)].paginate)
|
22
22
|
|
23
23
|
render
|
24
24
|
expect(view).to render_template(partial: "_opportunity")
|