Sha256: c21ed4cef169f19bfc174cc44aaf6202f3096c43fc059d67476b2fbfdc3ac7f0

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.

require File.dirname(__FILE__) + '/spec_helper.rb'
require 'amee/rails'
require 'active_record'

describe AMEE::Rails do

  class AMEETest < ActiveRecord::Base
    include AMEE::Rails
  end

  it "should add the has_amee_profile method to a class which includes it" do
    AMEETest.respond_to?(:has_amee_profile).should be_true
  end
  
  describe "using has_amee_profile" do

    class HasProfileTest < AMEETest
      has_amee_profile
    end

    before(:each) do
      @test = disconnected HasProfileTest
    end
    
    it "should have an amee_connection function" do
      @test.klass.method_defined?(:amee_connection).should be_true
    end

    it "should have an amee_create function" do
      @test.klass.method_defined?(:amee_create).should be_true
    end

    it "should have save_with_amee and save_without_amee functions" do
      @test.klass.method_defined?(:save_with_amee).should be_true
      @test.klass.method_defined?(:save_without_amee).should be_true
    end

    it "should have an amee_save function" do
      @test.klass.method_defined?(:amee_save).should be_true
    end

    it "should have an amee_destroy function" do
      @test.klass.method_defined?(:amee_destroy).should be_true
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
amee-3.2.1 spec/rails_spec.rb
amee-3.2.0 spec/rails_spec.rb
amee-3.1.2 spec/rails_spec.rb
amee-3.1.1 spec/rails_spec.rb
amee-3.0.1 spec/rails_spec.rb