Commit iniziale di eminuxCRM: CRM Rails con pipeline, campagne email e Docker.
Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
require "test_helper"
|
||||
|
||||
class OpportunityTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@opp = opportunities(:deal)
|
||||
@user = users(:marco)
|
||||
Current.user = @user
|
||||
Current.project = projects(:matchlivetv)
|
||||
end
|
||||
|
||||
teardown do
|
||||
Current.user = nil
|
||||
Current.project = nil
|
||||
end
|
||||
|
||||
test "move to won sets won_at and activates customer" do
|
||||
@opp.move_to_stage!("won", user: @user)
|
||||
assert @opp.won?
|
||||
assert_not_nil @opp.won_at
|
||||
assert_equal "active_customer", @opp.organization.reload.status
|
||||
end
|
||||
|
||||
test "move to lost requires reason" do
|
||||
assert_raises(ActiveRecord::RecordInvalid) do
|
||||
@opp.move_to_stage!("lost", user: @user)
|
||||
end
|
||||
end
|
||||
|
||||
test "move to lost with reason" do
|
||||
@opp.move_to_stage!("lost", lost_reason: "price", user: @user)
|
||||
assert @opp.lost?
|
||||
assert_equal "price", @opp.lost_reason
|
||||
assert_not_nil @opp.lost_at
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user