Merge branch 'master' of github.com:ZeusWPI/Tab into api

This commit is contained in:
redfast00 2019-04-10 16:15:11 +02:00
commit 4099d07394
No known key found for this signature in database
GPG Key ID: 5946E0E34FD0553C
6 changed files with 18 additions and 9 deletions

View File

@ -84,6 +84,7 @@ end
group :test do
gem 'coveralls', require: false
gem 'rails-controller-testing', require: false
end
group :production do
@ -98,3 +99,4 @@ gem 'airbrake'
gem 'bootstrap-sass', '~> 3.3.5'
gem 'react-rails', '~> 1.10.0'
gem 'rolify'
gem 'rails-controller-testing'

View File

@ -212,6 +212,10 @@ GEM
bundler (>= 1.3.0)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
actionview (>= 5.0.1.x)
activesupport (>= 5.0.1.x)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
@ -349,6 +353,7 @@ DEPENDENCIES
omniauth-oauth2 (~> 1.3.1)
purecss-rails
rails (= 5.2.0)
rails-controller-testing
react-rails (~> 1.10.0)
rolify
rspec-rails

View File

@ -8,12 +8,12 @@ describe TransactionsController, type: :controller do
context "with valid attributes" do
before :each do
@attributes = { transaction: {
@attributes = { params: { transaction: {
debtor: @debtor.name,
creditor: @creditor.name,
cents: 70,
message: "hoi"
} }
} }}
end
it "should create a new transaction" do
@ -46,12 +46,12 @@ describe TransactionsController, type: :controller do
context "with float euros" do
it "should set correct amount" do
post :create, transaction: {
post :create, params: { transaction: {
debtor: @debtor.name,
creditor: @creditor.name,
euros: 10.5,
message: "Omdat je een leuke jongen bent!"
}
}}
expect(Transaction.last.amount).to eq(1050)
end
end
@ -59,7 +59,7 @@ describe TransactionsController, type: :controller do
context "with negative amount" do
it "should be refused" do
expect do
post :create, transaction: attributes_for(:transaction, cents: -20)
post :create, params: {transaction: attributes_for(:transaction, cents: -20)}
end.not_to change { Transaction.count }
end
end
@ -67,12 +67,12 @@ describe TransactionsController, type: :controller do
context "for other user" do
it "should be refused" do
expect do
post :create, transaction: {
post :create, params:{ transaction: {
debtor: @creditor.name,
creditor: @debtor.name,
euros: 10000000,
message: "DIT IS OVERVAL"
}
}}
end.not_to change { Transaction.count }
end
end

View File

@ -6,7 +6,7 @@ describe UsersController, type: :controller do
describe "GET show" do
before :each do
get :show, id: @user
get :show, params: {id: @user}
end
it "should be successful" do

View File

@ -3,8 +3,8 @@ ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
require 'spec_helper'
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in

View File

@ -1,4 +1,6 @@
# Coveralls integrations
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'coveralls'
Coveralls.wear!('rails')