Sha256: 1e2c99fa409b3dc0b9397b564c90d852d1dffa522a3c03675a3d961ff3058621
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' module Trajectory describe Idea do let(:idea) { Idea.new(id: 42, subject: 'foo') } it 'can be initialized with named parameters' do idea.id.should == 42 idea.subject.should == 'foo' end it 'requires an id attribute' do expect do Idea.new.id end.to raise_error(MissingAttributeError) end it 'is the same idea when ids are the same' do idea.should == Idea.new(id: 42, subject: 'bar') end context 'it has attributes accessors' do %w(id subject stories_count comments_count last_comment_user_name last_comment_created_at editable_by_current_user user_id subscribed_user_ids project_id).each do |attribute| it "'#{attribute}' accessor" do Idea.new.should respond_to(attribute.to_sym) end end end it 'delegates project fetching to data store' do DataStore.should_receive(:find_project_by_id) Idea.new.project end it 'delegates user fetching to data store' do project = double idea = Idea.new(user_id: 42) idea.stub(:project).and_return(project) DataStore.should_receive(:find_user_of_project_with_id).with(project, 42) idea.user end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trajectory-0.1.2 | spec/unit/domain/idea_spec.rb |
trajectory-0.1.1 | spec/unit/domain/idea_spec.rb |
trajectory-0.1.0 | spec/unit/domain/idea_spec.rb |