tab/spec/controllers/transactions_controller_spec.rb

22 lines
492 B
Ruby
Raw Normal View History

2015-09-08 15:25:54 +02:00
require 'rails_helper'
RSpec.describe TransactionsController, type: :controller do
2015-09-09 14:37:40 +02:00
describe "creating transaction" do
before :each do
@debtor = create(:user)
@creditor = create(:user)
sign_in @debtor
end
2015-09-08 15:25:54 +02:00
2015-09-09 14:37:40 +02:00
it "should create a valid transaction" do
expect do
put :create, { transaction: {
creditor: @creditor.name,
amount: 20,
message: "hoi"
}}
end.to change {Transaction.count}.by(1)
end
end
2015-09-08 15:25:54 +02:00
end