Skip to content

Commit

Permalink
fixed some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
23vbq committed Sep 15, 2024
1 parent 4d17188 commit 3e78951
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions todo_backend/spec/requests/todo_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
require 'rails_helper'

RSpec.describe "Todos", type: :request do
Group.create(name: "Default")
let(:group_id) { create(:group).id }

let!(:todos) { create_list(:to_do, 10) }
let(:todo_id) { todos.first.id.to_s }

# Create new todo
describe "POST /todo" do
let(:valid_attributes) {
{
group_id: 1,
group_id: group_id,
priority: Faker::Number.between(from: 1, to: 5),
date_planning: Faker::Time.between(from: DateTime.now - 10, to: DateTime.now + 10),
title: Faker::Lorem.sentence(word_count: 1, random_words_to_add: 4),
Expand All @@ -22,17 +23,16 @@
before { post '/todo', params: valid_attributes }

it "created has default values" do
p json
expect(json['status']).to eq(0)
expect(json['date_creation']).to eq(DateTime.now)
end

it "created has user defined values" do
expect(json['group_id']).to eq(valid_attributes['group_id'])
expect(json['priority']).to eq(valid_attributes['priority'])
expect(json['date_planning']).to eq(valid_attributes['date_planning'])
expect(json['title']).to eq(valid_attributes['title'])
expect(json['description']).to eq(valid_attributes['description'])
expect(json['group_id']).to eq(valid_attributes[:group_id])
expect(json['priority']).to eq(valid_attributes[:priority])
expect(json['date_planning']).to eq(valid_attributes[:date_planning])
expect(json['title']).to eq(valid_attributes[:title])
expect(json['description']).to eq(valid_attributes[:description])
end

it "changes count of todos" do
Expand Down

0 comments on commit 3e78951

Please sign in to comment.