Sha256: a5696fbd8b78eac01e92f006237831472415107824f6e440d4b67155f4872a66

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe Decidim::Budgets::FilteredProjects do
  let(:organization) { create(:organization) }
  let(:participatory_process) { create(:participatory_process, organization: organization) }
  let(:feature) { create(:budget_feature, participatory_process: participatory_process) }
  let(:another_feature) { create(:budget_feature, participatory_process: participatory_process) }

  let(:projects) { create_list(:project, 3, feature: feature) }
  let(:old_projects) { create_list(:project, 3, feature: feature, created_at: 10.days.ago) }
  let(:another_projects) { create_list(:project, 3, feature: another_feature) }

  it "returns projects included in a collection of features" do
    expect(Decidim::Budgets::FilteredProjects.for([feature, another_feature])).to match_array projects.concat(old_projects, another_projects)
  end

  it "returns projects created in a date range" do
    expect(Decidim::Budgets::FilteredProjects.for([feature, another_feature], 2.weeks.ago, 1.week.ago)).to match_array old_projects
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-0.1.0 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb