Skip to content

Commit a7aac46

Browse files
committed
fix rspec errors
1 parent b9115b4 commit a7aac46

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

app/models/better_together/navigation_item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def url
125125
elsif route_name.present? # If the route_name is present, use the dynamic route
126126
retrieve_route(route_name)
127127
else
128-
read_attribute(:url) # or super
128+
read_attribute(:url) or _url
129129
end
130130
end
131131

spec/factories/better_together/navigation_areas.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class: 'BetterTogether::NavigationArea',
88
aliases: %i[navigation_area] do
99
id { SecureRandom.uuid }
10-
name { Faker::Commerce.department(max: 1) } # Ensure uniqueness
10+
name { Faker::Lorem.unique.sentence } # Ensure uniqueness
1111
identifier { name.parameterize }
1212
style { Faker::Lorem.word }
1313
visible { Faker::Boolean.boolean }

spec/factories/better_together/pages.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@
1212
content { Faker::Lorem.paragraph }
1313
meta_description { Faker::Lorem.sentence }
1414
keywords { Faker::Lorem.words(number: 4).join(', ') }
15-
published { Faker::Boolean.boolean }
1615
published_at { Faker::Date.backward(days: 30) }
1716
privacy { BetterTogether::Page::PRIVACY_LEVELS.keys.sample.to_s }
18-
layout { Faker::Lorem.word }
19-
template { Faker::Lorem.word }
20-
language { 'en' }
2117
protected { Faker::Boolean.boolean }
2218
end
2319
end

spec/models/better_together/content/rich_text_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'rails_helper'
44

55
module BetterTogether
6-
RSpec.describe Content::Block::RichText, type: :model do
6+
RSpec.describe Content::RichText, type: :model do
77
pending "add some examples to (or delete) #{__FILE__}"
88
end
99
end

spec/models/better_together/page_spec.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ module BetterTogether
1717
describe 'ActiveModel validations' do
1818
it { is_expected.to validate_presence_of(:title) }
1919
it { is_expected.to validate_presence_of(:privacy) }
20-
it { is_expected.to validate_presence_of(:language) }
2120
end
2221

2322
describe 'Attributes' do
@@ -26,20 +25,18 @@ module BetterTogether
2625
it { is_expected.to respond_to(:content) }
2726
it { is_expected.to respond_to(:meta_description) }
2827
it { is_expected.to respond_to(:keywords) }
29-
it { is_expected.to respond_to(:published) }
3028
it { is_expected.to respond_to(:published_at) }
3129
it { is_expected.to respond_to(:privacy) }
3230
it { is_expected.to respond_to(:layout) }
3331
it { is_expected.to respond_to(:template) }
34-
it { is_expected.to respond_to(:language) }
3532
it { is_expected.to respond_to(:protected) }
3633
end
3734

3835
describe 'Scopes' do
3936
describe '.published' do
4037
it 'returns only published pages' do
4138
published_page_count = Page.published.count
42-
create(:better_together_page, published: false)
39+
create(:better_together_page, published_at: nil)
4340
expect(Page.published.count).to eq(published_page_count)
4441
end
4542
end
@@ -62,12 +59,12 @@ module BetterTogether
6259
describe 'Methods' do
6360
describe '#published?' do
6461
it 'returns true if the page is published' do
65-
page.published = true
62+
page.published_at = Time.now - 2.days
6663
expect(page.published?).to be true
6764
end
6865

6966
it 'returns false if the page is not published' do
70-
page.published = false
67+
page.published_at = nil
7168
expect(page.published?).to be false
7269
end
7370
end

0 commit comments

Comments
 (0)