diff --git a/config/initializers/rpush.rb b/config/initializers/rpush.rb index 15e89cc..8c805ed 100644 --- a/config/initializers/rpush.rb +++ b/config/initializers/rpush.rb @@ -134,10 +134,14 @@ Rpush.reflect do |on| # end end -if defined?(Rails) - ActiveSupport.on_load(:after_initialize) do - Rpush.embed - end -else - Rpush.embed +# Dirty hack to prevent rpush from running in db:create +# plsfix +if ActiveRecord::Base.connection.table_exists? 'rpush_apps' + if defined?(Rails) + ActiveSupport.on_load(:after_initialize) do + Rpush.embed + end + else + Rpush.embed + end end diff --git a/spec/controllers/transactions_controller_spec.rb b/spec/controllers/transactions_controller_spec.rb index 3c30281..e7427ab 100644 --- a/spec/controllers/transactions_controller_spec.rb +++ b/spec/controllers/transactions_controller_spec.rb @@ -64,13 +64,27 @@ describe TransactionsController, type: :controller do 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 it "should be refused" do expect do post :create, params:{ transaction: { debtor: @creditor.name, creditor: @debtor.name, - euros: 10000000, + euros: 10, message: "DIT IS OVERVAL" }} end.not_to change { Transaction.count }