Sha256: 132179abc2b15774c67bd3d37529ff60de3acb01551088c6de27b0d99f7ff680

Contents?: true

Size: 682 Bytes

Versions: 3

Compression:

Stored size: 682 Bytes

Contents

require "spec_helper"

module Trajectory
  describe Ideas do
    it 'can be initialized from json array of components attributes' do
      project = double(:project, :id => 4567)
      json_ideas_collection = [{'id' => 1234, 'subject' => 'idea-subject'}, {'id' => 42, 'subject' => 'other-idea-subject'}]

      ideas = Ideas.from_json(project, json_ideas_collection)

      ideas.should be_kind_of(Ideas)
      ideas.first.id.should == 1234
      ideas.first.subject.should == 'idea-subject'

      ideas[1].id.should == 42
      ideas[1].subject.should == 'other-idea-subject'

      ideas.first.project_id.should == 4567
      ideas[1].project_id.should == 4567
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trajectory-0.1.2 spec/unit/domain/ideas_spec.rb
trajectory-0.1.1 spec/unit/domain/ideas_spec.rb
trajectory-0.1.0 spec/unit/domain/ideas_spec.rb