mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2025-04-20 07:11:33 +02:00
Rubocop autocorrect specs
This commit is contained in:
parent
247f4b85b7
commit
5c2e1bfe1e
13 changed files with 279 additions and 269 deletions
|
@ -1,22 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Paper do
|
||||
context "Validations" do
|
||||
context 'Validations' do
|
||||
it { should validate_presence_of(:name) }
|
||||
it { should validate_length_of(:name).is_at_most(1000) }
|
||||
|
||||
it { should validate_length_of(:name).is_at_most(1000) }
|
||||
|
||||
it { should validate_presence_of(:url) }
|
||||
it { should validate_length_of(:url).is_at_most(1000) }
|
||||
|
||||
context "URL uniqueness" do
|
||||
|
||||
context 'URL uniqueness' do
|
||||
subject { FactoryBot.build(:paper) }
|
||||
it { should validate_uniqueness_of(:url) }
|
||||
end
|
||||
|
||||
it "validate url format sane" do
|
||||
expected_error = "ist keine gültige URL"
|
||||
paper = FactoryBot.build(:paper, url: "wtf")
|
||||
expect(paper).not_to be_valid, "Expected paper to not be valid with invalid URL"
|
||||
|
||||
it 'validate url format sane' do
|
||||
expected_error = 'ist keine gültige URL'
|
||||
paper = FactoryBot.build(:paper, url: 'wtf')
|
||||
expect(paper).not_to be_valid, 'Expected paper to not be valid with invalid URL'
|
||||
expect(paper.errors[:url]).not_to be_empty
|
||||
expect(paper.errors[:url]).to include(expected_error), "Expected #{paper.errors[:url]} to include \"#{expected_error}\""
|
||||
end
|
||||
|
@ -36,11 +38,11 @@ RSpec.describe Paper do
|
|||
it { should validate_presence_of(:paper_type) }
|
||||
it { should validate_length_of(:paper_type).is_at_most(50) }
|
||||
|
||||
context "published_at" do
|
||||
context 'published_at' do
|
||||
it { should validate_presence_of(:published_at) }
|
||||
it "validate date is parseable" do
|
||||
expected_error = "ist kein gültiges Datum"
|
||||
paper = FactoryBot.build(:paper, published_at: "fubar")
|
||||
it 'validate date is parseable' do
|
||||
expected_error = 'ist kein gültiges Datum'
|
||||
paper = FactoryBot.build(:paper, published_at: 'fubar')
|
||||
expect(paper).not_to be_valid
|
||||
expect(paper.errors[:published_at]).not_to be_empty
|
||||
expect(paper.errors[:published_at]).to include(expected_error), "Expected #{paper.errors[:published_at]} to include \"#{expected_error}\""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue