Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Alchemy 6 support #38

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
alchemy_branch:
- 5.0-stable
- 5.1-stable
- 5.2-stable
- main
env:
ALCHEMY_BRANCH: ${{ matrix.alchemy_branch }}
Expand Down
2 changes: 0 additions & 2 deletions spec/models/alchemy/json_api/element_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

let!(:public_one) { FactoryBot.create(:alchemy_element, public: true) }
let!(:non_public) { FactoryBot.create(:alchemy_element, public: false) }
let!(:trashed) { FactoryBot.create(:alchemy_element, public: true).tap(&:trash!) }

it "returns public available elements" do
# expecting the ids here because the factorys class is not our decorator class
expect(available).to include(public_one.id)
expect(available).to_not include(non_public.id)
expect(available).to_not include(trashed.id)
end
end
end
Expand Down
24 changes: 0 additions & 24 deletions spec/models/alchemy/json_api/page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@
end
end

context "with trashed elements" do
let!(:trashed_element) { FactoryBot.create(:alchemy_element, page: page).tap(&:trash!) }

it "does not contain trashed elements" do
expect(all_element_ids).to_not include(trashed_element.id)
end
end

context "with hidden elements" do
let!(:hidden_element) { FactoryBot.create(:alchemy_element, page: page, public: false) }

Expand Down Expand Up @@ -136,14 +128,6 @@
end
end

context "with trashed elements" do
let!(:trashed_element) { FactoryBot.create(:alchemy_element, page: page).tap(&:trash!) }

it "does not contain trashed elements" do
expect(element_ids).to_not include(trashed_element.id)
end
end

context "with hidden elements" do
let(:hidden_element) { FactoryBot.create(:alchemy_element, page: page, public: false) }

Expand All @@ -170,14 +154,6 @@
expect(fixed_elements).to eq([element_3.id, element_1.id, element_2.id])
end

context "with trashed fixed elements" do
let!(:trashed_element) { FactoryBot.create(:alchemy_element, page: page, fixed: true).tap(&:trash!) }

it "does not contain trashed fixed elements" do
expect(fixed_elements).to_not include(trashed_element.id)
end
end

context "with hidden fixed elements" do
let!(:hidden_element) { FactoryBot.create(:alchemy_element, page: page, fixed: true, public: false) }

Expand Down
5 changes: 2 additions & 3 deletions spec/serializers/alchemy/json_api/page_serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@
let!(:element) { FactoryBot.create(:alchemy_element, page: alchemy_page) }
let!(:fixed_element) { FactoryBot.create(:alchemy_element, page: alchemy_page, fixed: true) }
let!(:non_public_element) { FactoryBot.create(:alchemy_element, page: alchemy_page, public: false) }
let!(:trashed_element) { FactoryBot.create(:alchemy_element, page: alchemy_page).tap(&:trash!) }

subject { serializer.serializable_hash[:data][:relationships] }

describe "elements" do
it "does not include trashed, fixed or hidden elements" do
it "does not include fixed or hidden elements" do
expect(subject[:elements]).to eq(
data: [
{ id: element.id.to_s, type: :element },
Expand All @@ -56,7 +55,7 @@
end

describe "fixed_elements" do
it "does not include trashed, non-fixed or hidden elements" do
it "does not include non-fixed or hidden elements" do
expect(subject[:fixed_elements]).to eq(
data: [
{ id: fixed_element.id.to_s, type: :element },
Expand Down