Sha256: 06c19b0658709c61ff938368dd412c3bc92be006e8137a1071b779a7fe0a68d4

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

require "ar_helper"
require "study_engine/result"
require "study_engine/assessment"
require "study_engine/update_assessments_form"

module StudyEngine
  describe UpdateAssessmentsForm do
    let(:study_id) { "FIX-ABC-1234" }

    subject do
      described_class.new(study_id)
    end

    it "knows about study id components" do
      aggregate_failures "study id components" do
        subject.study_id.should == StudyID.new("FIX-ABC-1234")
        subject.study_id_study.should == "FIX"
        subject.study_id_site.should == "ABC"
        subject.study_id_id.should == "1234"
      end
    end

    it "can update some asssessments' study ids" do
      baseline = Assessment.by_event("Baseline").create! study_id: "FIX-ABC-1234"
      six_month = Assessment.by_event("6 month").create! study_id: "FIX-ABC-1234"
      twelve_month = Assessment.by_event("12 month").create! study_id: "FIX-ABC-1234"

      subject.update_attributes! study_id_study: "OUT", study_id_site: "NEW", study_id_id: "6789"

      aggregate_failures "update assessments" do
        baseline.reload.study_id.should == StudyID.new("OUT-NEW-6789")
        six_month.reload.study_id.should == StudyID.new("OUT-NEW-6789")
        twelve_month.reload.study_id.should == StudyID.new("OUT-NEW-6789")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
study_engine-0.3.1 spec/models/study_engine/update_assessments_form_spec.rb
study_engine-0.3.0 spec/models/study_engine/update_assessments_form_spec.rb
study_engine-0.2.2 spec/models/study_engine/update_assessments_form_spec.rb
study_engine-0.2.1 spec/models/study_engine/update_assessments_form_spec.rb
study_engine-0.2.0 spec/models/study_engine/update_assessments_form_spec.rb
study_engine-0.1.1 spec/models/study_engine/update_assessments_form_spec.rb
study_engine-0.1.0 spec/models/study_engine/update_assessments_form_spec.rb
study_engine-0.0.2 spec/models/study_engine/update_assessments_form_spec.rb