Sha256: 12de86abbe880dc46612b6c10835a53e59e1f494cd55b2c69356b8a8c35d74c6
Contents?: true
Size: 1.08 KB
Versions: 18
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require "spec_helper" shared_examples_for "authorable interface" do describe "author" do describe "when author is not present" do before do model.update(author: author) end it "does not include the author" do expect(response["author"]).to be_nil end end describe "with a regular user" do let(:author) { create(:user, organization: model.participatory_space.organization) } let(:query) { "{ author { name } }" } before do model.update(author: author, user_group: nil) end it "includes the user's ID" do expect(response["author"]["name"]).to eq(author.name) end end describe "with a user group" do let(:user_group) { create(:user_group, organization: model.participatory_space.organization) } let(:query) { "{ author { name } }" } before do model.update(user_group: user_group, author: nil) end it "includes the user's ID" do expect(response["author"]["name"]).to eq(user_group.name) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems