Add test for too much money
This commit is contained in:
parent
7ccc2e5057
commit
be466bb4bb
2 changed files with 25 additions and 7 deletions
|
@ -134,6 +134,9 @@ Rpush.reflect do |on|
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Dirty hack to prevent rpush from running in db:create
|
||||||
|
# plsfix
|
||||||
|
if ActiveRecord::Base.connection.table_exists? 'rpush_apps'
|
||||||
if defined?(Rails)
|
if defined?(Rails)
|
||||||
ActiveSupport.on_load(:after_initialize) do
|
ActiveSupport.on_load(:after_initialize) do
|
||||||
Rpush.embed
|
Rpush.embed
|
||||||
|
@ -141,3 +144,4 @@ if defined?(Rails)
|
||||||
else
|
else
|
||||||
Rpush.embed
|
Rpush.embed
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -64,13 +64,27 @@ describe TransactionsController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with way to much money" do
|
||||||
|
it "should be refused" do
|
||||||
|
expect do
|
||||||
|
post :create, params:{ transaction: {
|
||||||
|
debtor: @debtor.name,
|
||||||
|
creditor: @creditor.name,
|
||||||
|
euros: 100000000000000,
|
||||||
|
message: "VEEL GELD"
|
||||||
|
}}
|
||||||
|
end.not_to change { Transaction.count }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
context "for other user" do
|
context "for other user" do
|
||||||
it "should be refused" do
|
it "should be refused" do
|
||||||
expect do
|
expect do
|
||||||
post :create, params:{ transaction: {
|
post :create, params:{ transaction: {
|
||||||
debtor: @creditor.name,
|
debtor: @creditor.name,
|
||||||
creditor: @debtor.name,
|
creditor: @debtor.name,
|
||||||
euros: 10000000,
|
euros: 10,
|
||||||
message: "DIT IS OVERVAL"
|
message: "DIT IS OVERVAL"
|
||||||
}}
|
}}
|
||||||
end.not_to change { Transaction.count }
|
end.not_to change { Transaction.count }
|
||||||
|
|
Loading…
Reference in a new issue