Sha256: c79aad79feee11f98c0360b2850aeb5760c4e40593156f752c5edbc9a103ab18

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe Template::Model do
  let!(:test_class) do
    Class.new do
      extend Template::Model
    end
  end
  context 'class' do
    it 'should extend ClassMethods and MethodBuilder' do
      test_class.is_a?(Template::Model::ClassMethods).should == true
      test_class.is_a?(Helpers::MethodBuilder).should == true
    end
  end

  context 'instances' do
    it 'should have instance methods included' do
      test_class.ancestors.should include(Template::Model::InstanceMethods)
    end


    it 'should include httparty' do
      test_class.ancestors.should include(HTTParty)
    end

    it 'provides a method for customising the endpoint of all instances' do
      endpoint = 'endpoint'
      test_class.endpoint endpoint
      test_class.new.endpoint.should == endpoint
    end

    describe 'default status' do
      it 'sets the status of instances if set' do
        status = 404
        test_class.status status
        test_class.new.status.should == status
      end

      it 'status of instances retain the global default if status is not set at the class level' do
        test_class.new.status.should == 200
      end

    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mirage-3.0.0.alpha.4 spec/client/template/model_spec.rb