Create new transaction log table to track user conversions
This commit is contained in:
9
test/fixtures/transaction_log_items.yml
vendored
Normal file
9
test/fixtures/transaction_log_items.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
category: MyString
|
||||
data: MyText
|
||||
|
||||
two:
|
||||
category: MyString
|
||||
data: MyText
|
||||
28
test/unit/transaction_log_item_test.rb
Normal file
28
test/unit/transaction_log_item_test.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TransactionLogItemTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@user = FactoryGirl.create(:user)
|
||||
end
|
||||
|
||||
context "Promoting a user" do
|
||||
should "create a new line item in the transaction log" do
|
||||
@user.level = User::Levels::GOLD
|
||||
assert_difference("TransactionLogItem.count", 1) do
|
||||
TransactionLogItem.record_account_upgrade(@user)
|
||||
end
|
||||
|
||||
item = TransactionLogItem.last
|
||||
assert_equal(@user.id, item.user_id)
|
||||
assert_equal("account_upgrade_basic_to_gold", item.category)
|
||||
end
|
||||
end
|
||||
|
||||
context "Viewing the account upgrade page" do
|
||||
should "create a new line item in the transaction log" do
|
||||
assert_difference("TransactionLogItem.count", 1) do
|
||||
TransactionLogItem.record_account_upgrade_view(@user, "xxx")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user