Skip to content

Commit

Permalink
Merge pull request #3 from AntonioHincapie/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
AntonioHincapie authored Oct 8, 2022
2 parents ef6105d + 2b86c95 commit c7faf01
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 78 deletions.
15 changes: 15 additions & 0 deletions spec/features/categories_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rails_helper'

RSpec.describe 'Categories', type: :system do
describe 'category#index page:' do
it 'Should render home page' do
visit('http://localhost:3000/categories')
expect(page).to have_content('Money Tracker')
end

it 'Should render list of movements' do
visit('http://localhost:3000/categories/1')
expect(page).to have_content('Log')
end
end
end
29 changes: 29 additions & 0 deletions spec/features/splash_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'rails_helper'

RSpec.describe 'Splash', type: :feature do
describe 'Splash#index page:' do
before(:each) do
visit root_path
end

it 'Should show the page header' do
expect(page).to have_current_path root_path
end

context 'When click on Log in button' do
it 'Should show the page header' do
first(:link_or_button, 'Log In').click

expect(page).to have_current_path new_user_session_path
end
end

context 'When click on Sign up button' do
it 'Should show the page header' do
first(:link_or_button, 'Sign Up').click

expect(page).to have_current_path new_user_registration_path
end
end
end
end
15 changes: 0 additions & 15 deletions spec/helpers/categories_helper_spec.rb

This file was deleted.

15 changes: 0 additions & 15 deletions spec/helpers/movements_helper_spec.rb

This file was deleted.

15 changes: 0 additions & 15 deletions spec/helpers/splash_helper_spec.rb

This file was deleted.

21 changes: 20 additions & 1 deletion spec/models/category_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
require 'rails_helper'

RSpec.describe Category, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
before do
@user = User.create(name: 'Antonio', email: 'antonio@mail.com')
@user.password = 'pass1234'
@user.password_confirmation = 'pass1234'
@category = Category.create(name: 'Cash', icon: 'icon', user_id: @user.id)
end

context 'When testing Category class' do
it 'Should have a name' do
expect(@category.name).to eq('Cash')
end

it 'Should have a icon' do
expect(@category.icon).to eq('icon')
end

it 'Should have an author' do
expect(@category.user_id).to eq(@user.id)
end
end
end
19 changes: 18 additions & 1 deletion spec/models/clasification_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
require 'rails_helper'

RSpec.describe Clasification, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
before do
@user = User.create(name: 'Antonio', email: 'antonio@mail.com')
@user.password = 'pass1234'
@user.password_confirmation = 'pass1234'
@category = Category.create(name: 'Cash', icon: 'icon', user_id: @user.id)
@movement = Movement.create(name: 'Uber', amount: 15.67, user_id: @user.id)
@clasification = Clasification.create(movement_id: @movement.id, category_id: @category.id)
end

context 'When testing Movement class' do
it 'Should have a movement related' do
expect(@clasification.movement_id).to eq(@movement.id)
end

it 'Should have a category related' do
expect(@clasification.category_id).to eq(@category.id)
end
end
end
21 changes: 20 additions & 1 deletion spec/models/movement_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
require 'rails_helper'

RSpec.describe Movement, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
before do
@user = User.create(name: 'Antonio', email: 'antonio@mail.com')
@user.password = 'pass1234'
@user.password_confirmation = 'pass1234'
@movement = Movement.create(name: 'Uber', amount: 15.67, user_id: @user.id)
end

context 'When testing Movement class' do
it 'Should have a name' do
expect(@movement.name).to eq('Uber')
end

it 'Should have a amount' do
expect(@movement.amount).to eq(15.67)
end

it 'Should have an author' do
expect(@movement.user_id).to eq(@user.id)
end
end
end
16 changes: 15 additions & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
require 'rails_helper'

RSpec.describe User, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
before do
@user = User.create(name: 'Antonio', email: 'antonio@mail.com')
@user.password = 'pass1234'
@user.password_confirmation = 'pass1234'
end

context 'When testing User class' do
it 'Should have a name' do
expect(@user.name).to eq('Antonio')
end

it 'Should have a email' do
expect(@user.email).to eq('antonio@mail.com')
end
end
end
7 changes: 0 additions & 7 deletions spec/requests/categories_spec.rb

This file was deleted.

7 changes: 0 additions & 7 deletions spec/requests/movements_spec.rb

This file was deleted.

10 changes: 0 additions & 10 deletions spec/requests/splash_spec.rb

This file was deleted.

5 changes: 0 additions & 5 deletions spec/views/splash/index.html.erb_spec.rb

This file was deleted.

0 comments on commit c7faf01

Please sign in to comment.