Skip to content

Commit

Permalink
override speakers method in conference_type
Browse files Browse the repository at this point in the history
  • Loading branch information
ElviaBth committed Jun 18, 2024
1 parent b7c3a9c commit 096607b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions decidim-conferences/lib/decidim/api/conference_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def hero_image
def banner_image
object.attached_uploader(:banner_image).path
end

def speakers
object.speakers.published
end
end
end
end
1 change: 1 addition & 0 deletions decidim-conferences/lib/decidim/conferences/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def call
end,
twitter_handle: ::Faker::Twitter.unique.screen_name,
personal_url: ::Faker::Internet.url,
published_at: Time.current,
conference:
)
end
Expand Down
10 changes: 10 additions & 0 deletions decidim-conferences/spec/types/conference_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module Conferences
include_context "with a graphql class type"

let(:model) { create(:conference) }
let!(:published_speaker) { create(:conference_speaker, :published, conference: model) }
let!(:unpublished_speaker) { create(:conference_speaker, conference: model) }

include_examples "attachable interface"
include_examples "categories container interface"
Expand Down Expand Up @@ -190,6 +192,14 @@ module Conferences
expect(response["registrationTerms"]["translation"]).to eq(model.registration_terms["en"])
end
end

describe "speakers" do
let(:query) { " { speakers { fullName } } " }

it "returns the list of published speakers" do
expect(response["speakers"].count).to eq(1)
end
end
end
end
end

0 comments on commit 096607b

Please sign in to comment.