Sha256: 0a8a68999551a34882513d6f42570f7bdafbb064a2efe66eced661e3168352c2

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

require 'spec_helper'

module Trajectory
  describe User do
    let(:idea) { User.new(id: 42, name: 'foo') }

    it 'can be initialized with named parameters' do
      idea.id.should == 42
    end

    it 'requires an id attribute' do
      expect do
        User.new.id
      end.to raise_error(MissingAttributeError)
    end

    it 'is the same idea when ids are the same' do
      idea.should == User.new(id: 42, name: 'bar')
    end

    context 'it has attributes accessors' do
      %w(id name updated_at created_at gravatar_url email).each do |attribute|
        it "'#{attribute}' accessor" do
          User.new.should respond_to(attribute.to_sym)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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