fat_free_crm 0.17.3 → 0.18.0
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 +4 -4
- data/.dockerignore +11 -0
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +30 -8
- data/.travis.yml +14 -9
- data/CHANGELOG.md +43 -7
- data/CONTRIBUTORS.md +95 -53
- data/Gemfile +11 -7
- data/Gemfile.lock +83 -83
- data/README.md +7 -4
- data/app/assets/javascripts/crm.js.coffee +3 -3
- data/app/assets/javascripts/crm_select2.js.coffee +15 -14
- data/app/controllers/admin/field_groups_controller.rb +8 -1
- data/app/controllers/admin/fields_controller.rb +4 -4
- data/app/controllers/admin/groups_controller.rb +1 -1
- data/app/controllers/admin/tags_controller.rb +1 -1
- data/app/controllers/application_controller.rb +11 -0
- data/app/controllers/authentications_controller.rb +1 -1
- data/app/controllers/comments_controller.rb +15 -7
- data/app/controllers/entities/campaigns_controller.rb +7 -2
- data/app/controllers/entities/leads_controller.rb +9 -2
- data/app/controllers/entities/opportunities_controller.rb +13 -2
- data/app/controllers/entities_controller.rb +10 -5
- data/app/controllers/lists_controller.rb +5 -1
- data/app/controllers/tasks_controller.rb +15 -1
- data/app/helpers/accounts_helper.rb +1 -1
- data/app/helpers/application_helper.rb +2 -2
- data/app/helpers/leads_helper.rb +1 -1
- data/app/helpers/opportunities_helper.rb +56 -3
- data/app/helpers/tags_helper.rb +1 -1
- data/app/models/entities/lead.rb +0 -7
- data/app/models/entities/opportunity.rb +3 -2
- data/app/models/observers/opportunity_observer.rb +4 -4
- data/app/models/users/ability.rb +3 -4
- data/app/views/campaigns/_metrics.html.haml +3 -3
- data/app/views/home/_opportunity.html.haml +4 -19
- data/app/views/opportunities/_index_long.html.haml +1 -24
- data/app/views/opportunities/_sidebar_show.html.haml +3 -3
- data/app/views/opportunities/_top_section.html.haml +1 -1
- data/db/schema.rb +0 -3
- data/fat_free_crm.gemspec +1 -1
- data/lib/fat_free_crm/core_ext/string.rb +1 -1
- data/lib/fat_free_crm/engine.rb +2 -2
- data/lib/fat_free_crm/fields.rb +1 -1
- data/lib/fat_free_crm/permissions.rb +0 -14
- data/lib/fat_free_crm/version.rb +2 -2
- data/lib/tasks/ffcrm/setup.rake +4 -4
- data/spec/controllers/admin/users_controller_spec.rb +27 -27
- data/spec/controllers/authentications_controller_spec.rb +7 -7
- data/spec/controllers/comments_controller_spec.rb +13 -13
- data/spec/controllers/emails_controller_spec.rb +2 -2
- data/spec/controllers/entities/accounts_controller_spec.rb +56 -56
- data/spec/controllers/entities/campaigns_controller_spec.rb +66 -66
- data/spec/controllers/entities/contacts_controller_spec.rb +67 -67
- data/spec/controllers/entities/leads_controller_spec.rb +125 -125
- data/spec/controllers/entities/opportunities_controller_spec.rb +100 -100
- data/spec/controllers/home_controller_spec.rb +26 -26
- data/spec/controllers/passwords_controller_spec.rb +1 -1
- data/spec/controllers/tasks_controller_spec.rb +37 -37
- data/spec/controllers/users_controller_spec.rb +18 -18
- data/spec/factories/account_factories.rb +8 -8
- data/spec/factories/campaign_factories.rb +5 -5
- data/spec/factories/contact_factories.rb +10 -10
- data/spec/factories/field_factories.rb +7 -7
- data/spec/factories/lead_factories.rb +8 -8
- data/spec/factories/list_factories.rb +1 -1
- data/spec/factories/opportunity_factories.rb +6 -6
- data/spec/factories/sequences.rb +1 -1
- data/spec/factories/setting_factories.rb +3 -3
- data/spec/factories/shared_factories.rb +14 -14
- data/spec/factories/subscription_factories.rb +1 -1
- data/spec/factories/tag_factories.rb +1 -1
- data/spec/factories/task_factories.rb +4 -4
- data/spec/factories/user_factories.rb +13 -13
- data/spec/features/accounts_spec.rb +17 -4
- data/spec/features/admin/groups_spec.rb +1 -1
- data/spec/features/admin/users_spec.rb +1 -1
- data/spec/features/campaigns_spec.rb +4 -4
- data/spec/features/contacts_spec.rb +10 -4
- data/spec/features/dashboard_spec.rb +7 -7
- data/spec/features/leads_spec.rb +4 -4
- data/spec/features/opportunities_overview_spec.rb +15 -15
- data/spec/features/opportunities_spec.rb +34 -8
- data/spec/features/support/autocomlete_helper.rb +17 -0
- data/spec/features/support/browser.rb +3 -8
- data/spec/features/support/helpers.rb +1 -1
- data/spec/features/tasks_spec.rb +4 -4
- data/spec/helpers/admin/field_groups_helper_spec.rb +1 -1
- data/spec/helpers/application_helper_spec.rb +1 -1
- data/spec/helpers/tasks_helper_spec.rb +1 -1
- data/spec/helpers/users_helper_spec.rb +3 -3
- data/spec/lib/comment_extensions_spec.rb +1 -1
- data/spec/lib/mail_processor/base_spec.rb +3 -3
- data/spec/lib/mail_processor/comment_replies_spec.rb +3 -3
- data/spec/lib/mail_processor/dropbox_spec.rb +16 -16
- data/spec/lib/permissions_spec.rb +7 -25
- data/spec/mailers/user_mailer_spec.rb +7 -7
- data/spec/models/entities/account_spec.rb +31 -32
- data/spec/models/entities/campaign_spec.rb +18 -25
- data/spec/models/entities/contact_spec.rb +18 -21
- data/spec/models/entities/lead_spec.rb +9 -11
- data/spec/models/entities/opportunity_spec.rb +45 -45
- data/spec/models/fields/custom_field_spec.rb +17 -17
- data/spec/models/list_spec.rb +2 -2
- data/spec/models/observers/entity_observer_spec.rb +6 -6
- data/spec/models/polymorphic/address_spec.rb +1 -1
- data/spec/models/polymorphic/avatar_spec.rb +5 -5
- data/spec/models/polymorphic/comment_spec.rb +5 -5
- data/spec/models/polymorphic/task_spec.rb +65 -58
- data/spec/models/polymorphic/version_spec.rb +26 -26
- data/spec/models/setting_spec.rb +2 -2
- data/spec/models/users/preference_spec.rb +6 -6
- data/spec/models/users/user_spec.rb +26 -26
- data/spec/shared/models.rb +22 -22
- data/spec/spec_helper.rb +2 -2
- data/spec/support/auth_macros.rb +1 -1
- data/spec/support/macros.rb +3 -3
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/create.js.haml_spec.rb +2 -2
- 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/show.haml_spec.rb +4 -4
- 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/destroy.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 +2 -2
- data/spec/views/admin/users/destroy.js.haml_spec.rb +2 -2
- 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 +3 -3
- 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/_edit.haml_spec.rb +7 -7
- data/spec/views/contacts/_new.haml_spec.rb +1 -1
- data/spec/views/contacts/create.js.haml_spec.rb +4 -4
- 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/show.haml_spec.rb +3 -3
- 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 +1 -1
- 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 +2 -2
- data/spec/views/leads/_sidebar_show.haml_spec.rb +5 -5
- data/spec/views/leads/convert.js.haml_spec.rb +4 -4
- data/spec/views/leads/create.js.haml_spec.rb +5 -5
- 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 +7 -7
- data/spec/views/opportunities/_new.haml_spec.rb +2 -2
- data/spec/views/opportunities/create.js.haml_spec.rb +6 -6
- 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/show.haml_spec.rb +3 -3
- 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 +6 -6
- 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/new.js.haml_spec.rb +1 -1
- 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 +5 -3
@@ -12,12 +12,12 @@ describe "/contacts/show" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
@contact =
|
16
|
-
|
15
|
+
@contact = create(:contact, id: 42,
|
16
|
+
opportunities: [create(:opportunity)])
|
17
17
|
assign(:contact, @contact)
|
18
18
|
assign(:users, [current_user])
|
19
19
|
assign(:comment, Comment.new)
|
20
|
-
assign(:timeline, [
|
20
|
+
assign(:timeline, [create(:comment, commentable: @contact)])
|
21
21
|
|
22
22
|
# controller#controller_name and controller#action_name are not set in view specs
|
23
23
|
allow(view).to receive(:template_for_current_view).and_return(nil)
|
@@ -13,9 +13,9 @@ describe "/contacts/update" do
|
|
13
13
|
before do
|
14
14
|
login
|
15
15
|
|
16
|
-
assign(:contact, @contact =
|
16
|
+
assign(:contact, @contact = build_stubbed(:contact, user: current_user))
|
17
17
|
assign(:users, [current_user])
|
18
|
-
assign(:account, @account =
|
18
|
+
assign(:account, @account = build_stubbed(:account))
|
19
19
|
assign(:accounts, [@account])
|
20
20
|
end
|
21
21
|
|
@@ -15,7 +15,7 @@ describe "/home/index" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should render list of activities if it's not empty" do
|
18
|
-
assign(:activities, [
|
18
|
+
assign(:activities, [build_stubbed(:version, event: "update", item: build_stubbed(:account))])
|
19
19
|
assign(:my_tasks, [])
|
20
20
|
assign(:my_opportunities, [])
|
21
21
|
assign(:my_accounts, [])
|
@@ -15,7 +15,7 @@ describe "/home/index" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should render [activity] template with @activities collection" do
|
18
|
-
assign(:activities, [
|
18
|
+
assign(:activities, [build_stubbed(:version, id: 42, event: "update", item: build_stubbed(:account), whodunnit: current_user.id.to_s)])
|
19
19
|
|
20
20
|
render template: 'home/index', formats: [:js]
|
21
21
|
|
@@ -19,7 +19,7 @@ describe "/home/options" do
|
|
19
19
|
assign(:user, "all_users")
|
20
20
|
assign(:action, "all_actions")
|
21
21
|
assign(:duration, "two_days")
|
22
|
-
assign(:all_users, [
|
22
|
+
assign(:all_users, [build_stubbed(:user)])
|
23
23
|
|
24
24
|
render
|
25
25
|
|
@@ -35,7 +35,7 @@ describe "/home/options" do
|
|
35
35
|
assign(:action, "all_actions")
|
36
36
|
assign(:user, "all_users")
|
37
37
|
assign(:duration, "two_days")
|
38
|
-
assign(:all_users, [
|
38
|
+
assign(:all_users, [build_stubbed(:user)])
|
39
39
|
|
40
40
|
render
|
41
41
|
|
@@ -12,12 +12,12 @@ describe "/leads/_convert" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
@account =
|
16
|
-
assign(:lead,
|
15
|
+
@account = build_stubbed(:account)
|
16
|
+
assign(:lead, build_stubbed(:lead))
|
17
17
|
assign(:users, [current_user])
|
18
18
|
assign(:account, @account)
|
19
19
|
assign(:accounts, [@account])
|
20
|
-
assign(:opportunity,
|
20
|
+
assign(:opportunity, build_stubbed(:opportunity))
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should render [convert lead] form" do
|
@@ -12,9 +12,9 @@ describe "/leads/_edit" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
assign(:lead, @lead =
|
15
|
+
assign(:lead, @lead = build_stubbed(:lead))
|
16
16
|
assign(:users, [current_user])
|
17
|
-
assign(:campaign, @campaign =
|
17
|
+
assign(:campaign, @campaign = build_stubbed(:campaign))
|
18
18
|
assign(:campaigns, [@campaign])
|
19
19
|
end
|
20
20
|
|
@@ -12,9 +12,9 @@ describe "/leads/_new" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
assign(:lead,
|
15
|
+
assign(:lead, build(:lead))
|
16
16
|
assign(:users, [current_user])
|
17
|
-
assign(:campaign, @campaign =
|
17
|
+
assign(:campaign, @campaign = build_stubbed(:campaign))
|
18
18
|
assign(:campaigns, [@campaign])
|
19
19
|
end
|
20
20
|
|
@@ -14,11 +14,11 @@ describe "/leads/_sidebar_show" do
|
|
14
14
|
login
|
15
15
|
assign(:users, [current_user])
|
16
16
|
assign(:comment, Comment.new)
|
17
|
-
assign(:lead,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
assign(:lead, build_stubbed(:lead,
|
18
|
+
blog: 'http://www.blogger.com/home',
|
19
|
+
linkedin: 'www.linkedin.com',
|
20
|
+
twitter: 'twitter.com/account',
|
21
|
+
facebook: ''))
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should render working web presence links whether a protocol is provided or not" do
|
@@ -13,11 +13,11 @@ describe "/leads/convert" do
|
|
13
13
|
before do
|
14
14
|
login
|
15
15
|
|
16
|
-
assign(:lead, @lead =
|
16
|
+
assign(:lead, @lead = build_stubbed(:lead, user: current_user))
|
17
17
|
assign(:users, [current_user])
|
18
|
-
assign(:account, @account =
|
18
|
+
assign(:account, @account = build_stubbed(:account))
|
19
19
|
assign(:accounts, [@account])
|
20
|
-
assign(:opportunity,
|
20
|
+
assign(:opportunity, build_stubbed(:opportunity))
|
21
21
|
end
|
22
22
|
|
23
23
|
it "cancel from lead index page: should replace [Convert Lead] form with lead partial" do
|
@@ -37,7 +37,7 @@ describe "/leads/convert" do
|
|
37
37
|
|
38
38
|
it "convert: should hide previously open [Convert Lead] and replace it with lead partial" do
|
39
39
|
params[:cancel] = nil
|
40
|
-
assign(:previous, previous =
|
40
|
+
assign(:previous, previous = build_stubbed(:lead, user: current_user))
|
41
41
|
|
42
42
|
render
|
43
43
|
expect(rendered).to include("$('#lead_#{previous.id}').replaceWith")
|
@@ -11,12 +11,12 @@ describe "/leads/create" do
|
|
11
11
|
before do
|
12
12
|
controller.controller_path = 'leads'
|
13
13
|
login
|
14
|
-
assign(:campaigns, [
|
14
|
+
assign(:campaigns, [build_stubbed(:campaign)])
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "create success" do
|
18
18
|
before do
|
19
|
-
assign(:lead, @lead =
|
19
|
+
assign(:lead, @lead = build_stubbed(:lead))
|
20
20
|
assign(:leads, [@lead].paginate)
|
21
21
|
assign(:lead_status_total, Hash.new(1))
|
22
22
|
end
|
@@ -46,7 +46,7 @@ describe "/leads/create" do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should update related asset sidebar from related asset" do
|
49
|
-
assign(:campaign, campaign =
|
49
|
+
assign(:campaign, campaign = create(:campaign))
|
50
50
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
51
51
|
render
|
52
52
|
|
@@ -58,8 +58,8 @@ describe "/leads/create" do
|
|
58
58
|
|
59
59
|
describe "create failure" do
|
60
60
|
it "should re-render [create] template in :create_lead div" do
|
61
|
-
assign(:lead,
|
62
|
-
assign(:users, [
|
61
|
+
assign(:lead, build(:lead, first_name: nil)) # make it invalid
|
62
|
+
assign(:users, [build_stubbed(:user)])
|
63
63
|
|
64
64
|
render
|
65
65
|
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
describe "/leads/destroy" do
|
11
11
|
before do
|
12
12
|
login
|
13
|
-
assign(:lead, @lead =
|
13
|
+
assign(:lead, @lead = build_stubbed(:lead))
|
14
14
|
assign(:lead_status_total, Hash.new(1))
|
15
15
|
end
|
16
16
|
|
@@ -38,7 +38,7 @@ describe "/leads/destroy" do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should update related asset sidebar when called from related asset" do
|
41
|
-
assign(:campaign, campaign =
|
41
|
+
assign(:campaign, campaign = build_stubbed(:campaign))
|
42
42
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
43
43
|
render
|
44
44
|
|
@@ -12,9 +12,9 @@ describe "/leads/edit" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
assign(:lead, @lead =
|
15
|
+
assign(:lead, @lead = build_stubbed(:lead, status: "new", user: current_user))
|
16
16
|
assign(:users, [current_user])
|
17
|
-
assign(:campaigns, [
|
17
|
+
assign(:campaigns, [build_stubbed(:campaign)])
|
18
18
|
end
|
19
19
|
|
20
20
|
it "cancel from lead index page: should replace [Edit Lead] form with lead partial" do
|
@@ -34,7 +34,7 @@ describe "/leads/edit" do
|
|
34
34
|
|
35
35
|
it "edit: should hide previously open [Edit Lead] and replace it with lead partial" do
|
36
36
|
params[:cancel] = nil
|
37
|
-
assign(:previous, previous =
|
37
|
+
assign(:previous, previous = build_stubbed(:lead, user: current_user))
|
38
38
|
|
39
39
|
render
|
40
40
|
expect(rendered).to include("$('#lead_#{previous.id}').replaceWith('<li class=\\'highlight lead\\' id=\\'lead_#{previous.id}\\'")
|
@@ -68,7 +68,7 @@ describe "/leads/edit" do
|
|
68
68
|
|
69
69
|
it "edit from lead landing page: should not attempt to hide [Convert Lead] if the lead is already converted" do
|
70
70
|
params[:cancel] = "false"
|
71
|
-
assign(:lead,
|
71
|
+
assign(:lead, build_stubbed(:lead, status: "converted", user: current_user))
|
72
72
|
|
73
73
|
render
|
74
74
|
expect(rendered).not_to include("crm.hide_form('convert_lead'")
|
@@ -19,7 +19,7 @@ describe "/leads/index" do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should render list of accounts if list of leads is not empty" do
|
22
|
-
assign(:leads, [
|
22
|
+
assign(:leads, [build_stubbed(:lead)].paginate(page: 1, per_page: 20))
|
23
23
|
|
24
24
|
render
|
25
25
|
expect(view).to render_template(partial: "_lead")
|
@@ -15,7 +15,7 @@ describe "/leads/index" do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should render [lead] template with @leads collection if there are leads" do
|
18
|
-
assign(:leads, [
|
18
|
+
assign(:leads, [build_stubbed(:lead, id: 42)].paginate(page: 1, per_page: 20))
|
19
19
|
|
20
20
|
render template: 'leads/index', formats: [:js]
|
21
21
|
|
@@ -11,16 +11,16 @@ describe "/leads/promote" do
|
|
11
11
|
before do
|
12
12
|
login
|
13
13
|
assign(:users, [current_user])
|
14
|
-
assign(:account, @account =
|
14
|
+
assign(:account, @account = build_stubbed(:account))
|
15
15
|
assign(:accounts, [@account])
|
16
|
-
assign(:contact,
|
17
|
-
assign(:opportunity,
|
16
|
+
assign(:contact, build_stubbed(:contact))
|
17
|
+
assign(:opportunity, build_stubbed(:opportunity))
|
18
18
|
assign(:lead_status_total, Hash.new(1))
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "no errors :" do
|
22
22
|
before do
|
23
|
-
assign(:lead, @lead =
|
23
|
+
assign(:lead, @lead = build_stubbed(:lead, status: "converted", user: current_user, assignee: current_user))
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "from lead landing page -" do
|
@@ -66,9 +66,9 @@ describe "/leads/promote" do
|
|
66
66
|
describe "from related campaign page -" do
|
67
67
|
before do
|
68
68
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/123"
|
69
|
-
assign(:campaign,
|
69
|
+
assign(:campaign, build_stubbed(:campaign))
|
70
70
|
assign(:stage, Setting.unroll(:opportunity_stage))
|
71
|
-
assign(:opportunity, @opportunity =
|
71
|
+
assign(:opportunity, @opportunity = build_stubbed(:opportunity))
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should replace [Convert Lead] with lead partial and highlight it" do
|
@@ -95,7 +95,7 @@ describe "/leads/promote" do
|
|
95
95
|
|
96
96
|
describe "validation errors:" do
|
97
97
|
before do
|
98
|
-
assign(:lead, @lead =
|
98
|
+
assign(:lead, @lead = build_stubbed(:lead, status: "new", user: current_user, assignee: current_user))
|
99
99
|
end
|
100
100
|
|
101
101
|
describe "from lead landing page -" do
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
describe "/leads/reject" do
|
11
11
|
before do
|
12
12
|
login
|
13
|
-
assign(:lead, @lead =
|
13
|
+
assign(:lead, @lead = build_stubbed(:lead, status: "new"))
|
14
14
|
assign(:lead_status_total, Hash.new(1))
|
15
15
|
end
|
16
16
|
|
@@ -37,7 +37,7 @@ describe "/leads/reject" do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should update campaign sidebar if called from campaign landing page" do
|
40
|
-
assign(:campaign, campaign =
|
40
|
+
assign(:campaign, campaign = build_stubbed(:campaign))
|
41
41
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
42
42
|
render
|
43
43
|
|
@@ -12,10 +12,10 @@ describe "/leads/show" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
assign(:lead, @lead =
|
15
|
+
assign(:lead, @lead = build_stubbed(:lead, id: 42))
|
16
16
|
assign(:users, [current_user])
|
17
17
|
assign(:comment, Comment.new)
|
18
|
-
assign(:timeline, [
|
18
|
+
assign(:timeline, [build_stubbed(:comment, commentable: @lead)])
|
19
19
|
|
20
20
|
# controller#controller_name and controller#action_name are not set in view specs
|
21
21
|
allow(view).to receive(:template_for_current_view).and_return(nil)
|
@@ -10,9 +10,9 @@ require 'spec_helper'
|
|
10
10
|
describe "/leads/update" do
|
11
11
|
before do
|
12
12
|
login
|
13
|
-
assign(:lead, @lead =
|
13
|
+
assign(:lead, @lead = build_stubbed(:lead, user: current_user, assignee: build_stubbed(:user)))
|
14
14
|
assign(:users, [current_user])
|
15
|
-
assign(:campaigns, [
|
15
|
+
assign(:campaigns, [build_stubbed(:campaign)])
|
16
16
|
assign(:lead_status_total, Hash.new(1))
|
17
17
|
end
|
18
18
|
|
@@ -58,7 +58,7 @@ describe "/leads/update" do
|
|
58
58
|
|
59
59
|
describe "on related asset page -" do
|
60
60
|
before do
|
61
|
-
assign(:campaign,
|
61
|
+
assign(:campaign, build_stubbed(:campaign))
|
62
62
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/123"
|
63
63
|
end
|
64
64
|
|
@@ -69,7 +69,7 @@ describe "/leads/update" do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should update campaign sidebar" do
|
72
|
-
assign(:campaign,
|
72
|
+
assign(:campaign, build_stubbed(:campaign))
|
73
73
|
render
|
74
74
|
|
75
75
|
expect(rendered).to include("sidebar")
|
@@ -12,14 +12,14 @@ describe "/opportunities/_edit" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
assign(:account, @account =
|
15
|
+
assign(:account, @account = build_stubbed(:account))
|
16
16
|
assign(:accounts, [@account])
|
17
17
|
assign(:stage, Setting.unroll(:opportunity_stage))
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should render [edit opportunity] form" do
|
21
21
|
assign(:users, [current_user])
|
22
|
-
assign(:opportunity, @opportunity =
|
22
|
+
assign(:opportunity, @opportunity = build_stubbed(:opportunity, campaign: @campaign = build_stubbed(:campaign)))
|
23
23
|
render
|
24
24
|
|
25
25
|
expect(rendered).to have_tag("form[class=edit_opportunity]") do
|
@@ -30,7 +30,7 @@ describe "/opportunities/_edit" do
|
|
30
30
|
|
31
31
|
it "should pick default assignee (Myself)" do
|
32
32
|
assign(:users, [current_user])
|
33
|
-
assign(:opportunity,
|
33
|
+
assign(:opportunity, build_stubbed(:opportunity, assignee: nil))
|
34
34
|
render
|
35
35
|
|
36
36
|
expect(rendered).to have_tag("select[id=opportunity_assigned_to]") do |options|
|
@@ -39,9 +39,9 @@ describe "/opportunities/_edit" do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should show correct assignee" do
|
42
|
-
@user =
|
42
|
+
@user = create(:user)
|
43
43
|
assign(:users, [current_user, @user])
|
44
|
-
assign(:opportunity,
|
44
|
+
assign(:opportunity, create(:opportunity, assignee: @user))
|
45
45
|
render
|
46
46
|
|
47
47
|
expect(rendered).to have_tag("select[id=opportunity_assigned_to]") do |_options|
|
@@ -52,7 +52,7 @@ describe "/opportunities/_edit" do
|
|
52
52
|
|
53
53
|
it "should render background info field if settings require so" do
|
54
54
|
assign(:users, [current_user])
|
55
|
-
assign(:opportunity,
|
55
|
+
assign(:opportunity, build_stubbed(:opportunity))
|
56
56
|
Setting.background_info = [:opportunity]
|
57
57
|
|
58
58
|
render
|
@@ -61,7 +61,7 @@ describe "/opportunities/_edit" do
|
|
61
61
|
|
62
62
|
it "should not render background info field if settings do not require so" do
|
63
63
|
assign(:users, [current_user])
|
64
|
-
assign(:opportunity,
|
64
|
+
assign(:opportunity, build_stubbed(:opportunity))
|
65
65
|
Setting.background_info = []
|
66
66
|
|
67
67
|
render
|
@@ -12,8 +12,8 @@ describe "/opportunities/_new" do
|
|
12
12
|
|
13
13
|
before do
|
14
14
|
login
|
15
|
-
assign(:opportunity,
|
16
|
-
@account =
|
15
|
+
assign(:opportunity, build(:opportunity))
|
16
|
+
@account = build_stubbed(:account)
|
17
17
|
assign(:account, @account)
|
18
18
|
assign(:accounts, [@account])
|
19
19
|
assign(:users, [current_user])
|
@@ -15,7 +15,7 @@ describe "/opportunities/create" do
|
|
15
15
|
|
16
16
|
describe "create success" do
|
17
17
|
before do
|
18
|
-
assign(:opportunity, @opportunity =
|
18
|
+
assign(:opportunity, @opportunity = build_stubbed(:opportunity))
|
19
19
|
assign(:opportunities, [@opportunities].paginate)
|
20
20
|
assign(:opportunity_stage_total, Hash.new(1))
|
21
21
|
end
|
@@ -44,7 +44,7 @@ describe "/opportunities/create" do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should update related account sidebar when called from related account" do
|
47
|
-
assign(:account, account =
|
47
|
+
assign(:account, account = create(:account))
|
48
48
|
controller.request.env["HTTP_REFERER"] = "http://localhost/accounts/#{account.id}"
|
49
49
|
render
|
50
50
|
|
@@ -53,7 +53,7 @@ describe "/opportunities/create" do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should update related campaign sidebar when called from related campaign" do
|
56
|
-
assign(:campaign, campaign =
|
56
|
+
assign(:campaign, campaign = create(:campaign))
|
57
57
|
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
58
58
|
render
|
59
59
|
|
@@ -72,9 +72,9 @@ describe "/opportunities/create" do
|
|
72
72
|
|
73
73
|
describe "create failure" do
|
74
74
|
it "should re-render [create] template in :create_opportunity div" do
|
75
|
-
assign(:opportunity,
|
76
|
-
@account =
|
77
|
-
assign(:users, [
|
75
|
+
assign(:opportunity, build(:opportunity, name: nil)) # make it invalid
|
76
|
+
@account = build_stubbed(:account)
|
77
|
+
assign(:users, [build_stubbed(:user)])
|
78
78
|
assign(:account, @account)
|
79
79
|
assign(:accounts, [@account])
|
80
80
|
|