Skip to content

Cant access messaging functionality to test before login works #51

@emtalen

Description

@emtalen

Problem

We are trying to test the functionality of sending a message and we are using the Factorybot but the bot can't log in and then we do not know how to have access to the message functionality.
Should we change direction and figure out what the problem with logging in is, or is there another way to get around it?

Background

We split up to two teams were one team is working on the signup and we were suppose to create the factorybot and log in to test the messages functions.

Story

Please add a story if applicable

As a User,
In order to send an email
I would like to be able to create it

Spec

We have modified the spec to first see that the login was successful as we expected.

feature 'User can' do
        before do
            visit user_session_path
            fill_in "user_email", with: "name@mail.com"
            fill_in "user_password", with: "12345678"
            click_on "Log in"
        end
        
    it 'create an email' do
        expect(page).to have_content "Hello Name"
        # click_on 'Inbox'
        # click_on 'Compose'
        # # choose '#'
        # fill_in 'Subject', with: 'Hello'
        # fill_in 'Message', with: 'Test Message'
        # click_on "Send Message"

    end 
end

Implementation code

#spec/factories/user_bot.rb
FactoryBot.define do
    factory :user do
        name { "Name" }
        email { "name@mail.com" }
        password { "12345678" }
    end
end


#spec/model/user_spec.rb
require 'rails_helper'

RSpec.describe User, type: :model do
    describe 'DB table' do
        it { is_expected.to have_db_column :name }
    end

    describe 'Validations' do
        it { is_expected.to validate_presence_of :name }
    end

    describe 'Factory' do
        it 'should have valid Factory' do
            expect(FactoryBot.create(:user)).to be_valid
        end
    end
end

Screenshots

How did you try to solve the problem?

Write the steps you took to try to fix the problem here

Markdown guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions