-
-
-
-
-
+
+
+
+ total amount
-
-
-
<%= t.name %>
-
$ <%= t.amount %>
-
<%= t.created_at %>
-
- <%= link_to "edit", edit_transaction_path(t), :class => "btn btn-primary edit_btn" %>
-
- <%= link_to "delete", transaction_path(t), :class => "btn btn-danger delete_grp_btn", data: {confirm: "Are you sure?"}, :method => :delete %>
-
+
+ $ <%= @total %>
-
-<% end %>
-
-
-
-
-
-
-<%= link_to "Add new", new_transaction_path , :class => "btn btn-success new_trans" %>
+
+ <% @other_transaction_sorted.each do |t| %>
+
+
+
+
+
+
+
+
<%= t.name %>
+
$ <%= t.amount %>
+
<%= t.created_at %>
+ <%= link_to "edit", edit_transaction_path(t), :class => "btn btn-primary edit_btn" %>
+ <%= link_to "delete", transaction_path(t), :class => "btn btn-danger delete_grp_btn", data: {confirm: "Are you sure?"}, :method => :delete %>
+
+
+
+
+ <% end %>
+
+
+
+ <%= link_to "Add new", new_transaction_path , :class => "btn btn-success new_trans" %>
-
-
-
-
diff --git a/app/views/transactions/new.html.erb b/app/views/transactions/new.html.erb
index 99c57a0..9e0680d 100644
--- a/app/views/transactions/new.html.erb
+++ b/app/views/transactions/new.html.erb
@@ -1,4 +1,4 @@
-
new transaction
-<%= render 'form', group: @transaction %>
-
\ No newline at end of file
+
new transaction
+ <%= render 'form', group: @transaction %>
+
diff --git a/bin/rails b/bin/rails
index 7a8ff81..3504c3f 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
begin
load File.expand_path('spring', __dir__)
rescue LoadError => e
diff --git a/bin/rake b/bin/rake
index 0ba8c48..1fe6cf0 100755
--- a/bin/rake
+++ b/bin/rake
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
begin
load File.expand_path('spring', __dir__)
rescue LoadError => e
diff --git a/bin/setup b/bin/setup
index 5853b5e..ac9f624 100755
--- a/bin/setup
+++ b/bin/setup
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
+
require 'fileutils'
# path to your application root.
diff --git a/bin/spring b/bin/spring
index d89ee49..1c6eabf 100755
--- a/bin/spring
+++ b/bin/spring
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 4d82ff6..ef17cb8 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,13 +1,13 @@
Rails.application.configure do
config.after_initialize do
- Bullet.enable = true
- Bullet.alert = true
- Bullet.bullet_logger = true
- Bullet.console = true
+ Bullet.enable = true
+ Bullet.alert = true
+ Bullet.bullet_logger = true
+ Bullet.console = true
# Bullet.growl = true
- Bullet.rails_logger = true
- Bullet.add_footer = true
- end # Settings specified here will take precedence over those in config/application.rb.
+ Bullet.rails_logger = true
+ Bullet.add_footer = true
+ end # Settings specified here will take precedence over those in config/application.rb.
# devise configuration
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
diff --git a/db/migrate/20200622082541_add_column_group_id_to_transactions.rb b/db/migrate/20200622082541_add_column_group_id_to_transactions.rb
index efa3e81..6634492 100644
--- a/db/migrate/20200622082541_add_column_group_id_to_transactions.rb
+++ b/db/migrate/20200622082541_add_column_group_id_to_transactions.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddColumnGroupIdToTransactions < ActiveRecord::Migration[6.0]
def change
add_column :transactions, :group_id, :integer
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 16dfffa..a8463d1 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -1,24 +1,26 @@
+# rubocop:disable Lint/UselessAssignment
+# frozen_string_literal: true
+
require 'rails_helper'
RSpec.describe Group, type: :model do
+ test_user = User.create!(name: 'peter robert', email: 'b@example.com', password: 'hsjoarty067')
+ test_group = Group.create!(name: 'test_group', icon: 'https://testicons.com/testicon.png', user_id: test_user.id)
+
+ it 'should fail to create a group without name' do
+ ev = Group.create(icon: 'https://testicons.com/testicon.png')
+ expect(ev.persisted?).to eql(false)
+ end
- test_user = User.create!(name: 'peter robert', email: 'b@example.com', password: 'hsjoarty067')
- test_group = Group.create!(name: 'test_group', icon: 'https://testicons.com/testicon.png', user_id:test_user.id)
-
+ it 'should fail to create a group user' do
+ ev = Group.create(name: 'test_group', icon: 'https://testicons.com/testicon.png')
+ expect(ev.persisted?).to eql(false)
+ end
- it 'should fail to create a group without name' do
- ev = Group.create(icon: 'https://testicons.com/testicon.png')
- expect(ev.persisted?).to eql(false)
- end
+ it 'should create group' do
+ ev = Group.create(name: 'test_group', icon: 'https://testicons.com/testicon.png', user_id: test_user.id)
+ expect(ev.persisted?).to eql(true)
+ end
+end
- it 'should fail to create a group user' do
- ev = Group.create(name: 'test_group',icon: 'https://testicons.com/testicon.png')
- expect(ev.persisted?).to eql(false)
- end
-
- it 'should create group' do
- ev = Group.create(name: 'test_group',icon: 'https://testicons.com/testicon.png', user_id:test_user.id)
- expect(ev.persisted?).to eql(true)
- end
-
-end
\ No newline at end of file
+# rubocop:enable Lint/UselessAssignment
diff --git a/spec/models/transaction_spec.rb b/spec/models/transaction_spec.rb
index 4594f6e..0da11c8 100644
--- a/spec/models/transaction_spec.rb
+++ b/spec/models/transaction_spec.rb
@@ -1,31 +1,33 @@
+# rubocop:disable Style/FrozenStringLiteralComment
+# rubocop:disable Lint/UselessAssignment
+
require 'rails_helper'
RSpec.describe Transaction, type: :model do
+ test_user = User.create!(name: 'peter robert', email: 'pan@example.com', password: 'hsjoarty067')
+ test_group = test_user.groups.create!(name: 'test_group', icon: 'https://testicons.com/testicon.png')
+ test_transaction = Transaction.create!(name: 'test_transaction', amount: 100, user_id: test_user.id, group_id: test_group.id)
- test_user = User.create!(name: 'peter robert', email: 'pan@example.com', password: 'hsjoarty067')
- test_group = test_user.groups.create!(name: 'test_group', icon: 'https://testicons.com/testicon.png')
- test_transaction = Transaction.create!(name: 'test_transaction', amount: 100, user_id: test_user.id, group_id: test_group.id)
-
-
- it 'should fail to create a transaction without amount' do
- ev = Transaction.create(name: 'test event')
- expect(ev.persisted?).to eql(false)
- end
+ it 'should fail to create a transaction without amount' do
+ ev = Transaction.create(name: 'test event')
+ expect(ev.persisted?).to eql(false)
+ end
- it 'should fail to create a transaction without name' do
- ev = Transaction.create(amount: 200)
- expect(ev.persisted?).to eql(false)
- end
+ it 'should fail to create a transaction without name' do
+ ev = Transaction.create(amount: 200)
+ expect(ev.persisted?).to eql(false)
+ end
- it 'should fail to create a transaction without user' do
- ev = Transaction.create(name: 'test event', amount: 100, group_id: test_group.id )
- expect(ev.persisted?).to eql(false)
- end
+ it 'should fail to create a transaction without user' do
+ ev = Transaction.create(name: 'test event', amount: 100, group_id: test_group.id)
+ expect(ev.persisted?).to eql(false)
+ end
- it 'should be saved with all users' do
- ev = Transaction.create(name: 'test event', amount: 100, user_id: test_user.id, group_id: test_group.id )
- expect(ev.persisted?).to eql(true)
- end
+ it 'should be saved with all users' do
+ ev = Transaction.create(name: 'test event', amount: 100, user_id: test_user.id, group_id: test_group.id)
+ expect(ev.persisted?).to eql(true)
+ end
+end
-
-end
\ No newline at end of file
+# rubocop:enable Style/FrozenStringLiteralComment
+# rubocop:enable Lint/UselessAssignment
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 43b101c..791b9db 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,24 +1,26 @@
+# rubocop:disable Style/FrozenStringLiteralComment
+# rubocop:disable Lint/UselessAssignment
+
require 'rails_helper'
RSpec.describe User, type: :model do
+ test_user = User.create!(name: 'peter robert', email: 'h@example.com', password: 'hsjoarty067')
- test_user = User.create!(name: 'peter robert', email: 'h@example.com', password: 'hsjoarty067')
-
- it 'should fail to create account without name' do
- ev = User.create(email: 'b@example.com', password: 'hsjoarty067')
- expect(ev.persisted?).to eql(false)
- end
+ it 'should fail to create account without name' do
+ ev = User.create(email: 'b@example.com', password: 'hsjoarty067')
+ expect(ev.persisted?).to eql(false)
+ end
- it 'should fail to create account without email' do
- ev = User.create(name: 'peter robert', password: 'hsjoarty067')
- expect(ev.persisted?).to eql(false)
- end
-
- it 'should fail to create account without password' do
- ev = User.create(name: 'peter robert', email: 'e@example.com')
- expect(ev.persisted?).to eql(false)
- end
+ it 'should fail to create account without email' do
+ ev = User.create(name: 'peter robert', password: 'hsjoarty067')
+ expect(ev.persisted?).to eql(false)
+ end
+ it 'should fail to create account without password' do
+ ev = User.create(name: 'peter robert', email: 'e@example.com')
+ expect(ev.persisted?).to eql(false)
+ end
+end
-
-end
\ No newline at end of file
+# rubocop:enable Style/FrozenStringLiteralComment
+# rubocop:enable Lint/UselessAssignment
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 00345af..7f6f773 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -1,9 +1,11 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
+# frozen_string_literal: true
+
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
-abort("The Rails environment is running in production mode!") if Rails.env.production?
+abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ce33d66..15a3872 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -44,53 +44,51 @@
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups
-# The settings below are suggested to provide a good initial experience
-# with RSpec, but feel free to customize to your heart's content.
-=begin
- # This allows you to limit a spec run to individual examples or groups
- # you care about by tagging them with `:focus` metadata. When nothing
- # is tagged with `:focus`, all examples get run. RSpec also provides
- # aliases for `it`, `describe`, and `context` that include `:focus`
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
- config.filter_run_when_matching :focus
-
- # Allows RSpec to persist some state between runs in order to support
- # the `--only-failures` and `--next-failure` CLI options. We recommend
- # you configure your source control system to ignore this file.
- config.example_status_persistence_file_path = "spec/examples.txt"
-
- # Limits the available syntax to the non-monkey patched syntax that is
- # recommended. For more details, see:
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
- config.disable_monkey_patching!
-
- # Many RSpec users commonly either run the entire suite or an individual
- # file, and it's useful to allow more verbose output when running an
- # individual spec file.
- if config.files_to_run.one?
- # Use the documentation formatter for detailed output,
- # unless a formatter has already been configured
- # (e.g. via a command-line flag).
- config.default_formatter = "doc"
- end
-
- # Print the 10 slowest examples and example groups at the
- # end of the spec run, to help surface which specs are running
- # particularly slow.
- config.profile_examples = 10
-
- # Run specs in random order to surface order dependencies. If you find an
- # order dependency and want to debug it, you can fix the order by providing
- # the seed, which is printed after each run.
- # --seed 1234
- config.order = :random
-
- # Seed global randomization in this process using the `--seed` CLI option.
- # Setting this allows you to use `--seed` to deterministically reproduce
- # test failures related to randomization by passing the same `--seed` value
- # as the one that triggered the failure.
- Kernel.srand config.seed
-=end
+ # The settings below are suggested to provide a good initial experience
+ # with RSpec, but feel free to customize to your heart's content.
+ # # This allows you to limit a spec run to individual examples or groups
+ # # you care about by tagging them with `:focus` metadata. When nothing
+ # # is tagged with `:focus`, all examples get run. RSpec also provides
+ # # aliases for `it`, `describe`, and `context` that include `:focus`
+ # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ # config.filter_run_when_matching :focus
+ #
+ # # Allows RSpec to persist some state between runs in order to support
+ # # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # # you configure your source control system to ignore this file.
+ # config.example_status_persistence_file_path = "spec/examples.txt"
+ #
+ # # Limits the available syntax to the non-monkey patched syntax that is
+ # # recommended. For more details, see:
+ # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
+ # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
+ # config.disable_monkey_patching!
+ #
+ # # Many RSpec users commonly either run the entire suite or an individual
+ # # file, and it's useful to allow more verbose output when running an
+ # # individual spec file.
+ # if config.files_to_run.one?
+ # # Use the documentation formatter for detailed output,
+ # # unless a formatter has already been configured
+ # # (e.g. via a command-line flag).
+ # config.default_formatter = "doc"
+ # end
+ #
+ # # Print the 10 slowest examples and example groups at the
+ # # end of the spec run, to help surface which specs are running
+ # # particularly slow.
+ # config.profile_examples = 10
+ #
+ # # Run specs in random order to surface order dependencies. If you find an
+ # # order dependency and want to debug it, you can fix the order by providing
+ # # the seed, which is printed after each run.
+ # # --seed 1234
+ # config.order = :random
+ #
+ # # Seed global randomization in this process using the `--seed` CLI option.
+ # # Setting this allows you to use `--seed` to deterministically reproduce
+ # # test failures related to randomization by passing the same `--seed` value
+ # # as the one that triggered the failure.
+ # Kernel.srand config.seed
end
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb
index 79e6011..eaddb46 100644
--- a/spec/support/database_cleaner.rb
+++ b/spec/support/database_cleaner.rb
@@ -1,17 +1,21 @@
+# rubocop:disable Style/FrozenStringLiteralComment
+
RSpec.configure do |config|
- config.before(:suite) do
- DatabaseCleaner.clean_with :truncation, except: %w[ar_internal_metadata]
- end
-
- config.before(:each) do
- DatabaseCleaner.strategy = :transaction
- end
-
- config.before(:each) do
- DatabaseCleaner.start
- end
-
- config.after(:each) do
- DatabaseCleaner.clean
- end
- end
\ No newline at end of file
+ config.before(:suite) do
+ DatabaseCleaner.clean_with :truncation, except: %w[ar_internal_metadata]
+ end
+
+ config.before(:each) do
+ DatabaseCleaner.strategy = :transaction
+ end
+
+ config.before(:each) do
+ DatabaseCleaner.start
+ end
+
+ config.after(:each) do
+ DatabaseCleaner.clean
+ end
+end
+
+# rubocop:enable Style/FrozenStringLiteralComment
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
index 23701b4..652febb 100644
--- a/test/application_system_test_case.rb
+++ b/test/application_system_test_case.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
diff --git a/test/channels/application_cable/connection_test.rb b/test/channels/application_cable/connection_test.rb
index d05dbd2..c293805 100644
--- a/test/channels/application_cable/connection_test.rb
+++ b/test/channels/application_cable/connection_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
diff --git a/test/controllers/groups_controller_test.rb b/test/controllers/groups_controller_test.rb
index 23aba76..5ab1617 100644
--- a/test/controllers/groups_controller_test.rb
+++ b/test/controllers/groups_controller_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class GroupsControllerTest < ActionDispatch::IntegrationTest
diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb
index 76b4b38..ce5cdc2 100644
--- a/test/controllers/static_pages_controller_test.rb
+++ b/test/controllers/static_pages_controller_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
diff --git a/test/controllers/transactions_controller_test.rb b/test/controllers/transactions_controller_test.rb
index a4189f0..751e4c9 100644
--- a/test/controllers/transactions_controller_test.rb
+++ b/test/controllers/transactions_controller_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class TransactionsControllerTest < ActionDispatch::IntegrationTest
diff --git a/test/models/group_test.rb b/test/models/group_test.rb
index 778eb0c..ae91507 100644
--- a/test/models/group_test.rb
+++ b/test/models/group_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class GroupTest < ActiveSupport::TestCase
diff --git a/test/models/transaction_test.rb b/test/models/transaction_test.rb
index f2b87fe..9ec6f03 100644
--- a/test/models/transaction_test.rb
+++ b/test/models/transaction_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class TransactionTest < ActiveSupport::TestCase
diff --git a/test/models/user_test.rb b/test/models/user_test.rb
index 82f61e0..5cc44ed 100644
--- a/test/models/user_test.rb
+++ b/test/models/user_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class UserTest < ActiveSupport::TestCase
diff --git a/test/test_helper.rb b/test/test_helper.rb
index d5300f8..8aad663 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'