Sha256: 3dd87b62ae0169c9ca97f35426cdbb6c960749cab97f7140ad816ce0b57581c2

Contents?: true

Size: 862 Bytes

Versions: 11

Compression:

Stored size: 862 Bytes

Contents

shared_examples_for "defining a model callback" do

  describe "for a" do
    
    describe "around_api_response" do
      
      it "skips rendering if not yielded" do
        @luke.skip_api_response = true
        @luke.as_api_response(:name_only).keys.should include(:skipped)
      end
      
      it "renders if yielded" do
        @luke.as_api_response(:name_only).keys.should_not include(:skipped)
      end
    
    end
    
    describe "before_api_response" do 
      
      it "is called properly" do
        @luke.as_api_response(:name_only)
        @luke.before_api_response_called?.should eql(true)
      end
      
    end
    
    describe "after_api_response" do 
      
      it "is called properly" do
        @luke.as_api_response(:name_only)
        @luke.after_api_response_called?.should eql(true)
      end
      
    end
    
  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
acts_as_api-0.4.4 spec/support/model_examples/callbacks.rb
acts_as_api-0.4.3 spec/support/model_examples/callbacks.rb
acts_as_api_sequel-0.0.1 spec/support/model_examples/callbacks.rb
acts_as_api-0.4.2 spec/support/model_examples/callbacks.rb
acts_as_api-0.4.1 spec/support/model_examples/callbacks.rb
acts_as_api-0.4 spec/support/model_examples/callbacks.rb
acts_as_api-0.3.11 spec/support/model_examples/callbacks.rb
acts_as_api-0.3.10 spec/support/model_examples/callbacks.rb
acts_as_api-0.3.9 spec/support/model_examples/callbacks.rb
acts_as_api-0.3.8 spec/support/model_examples/callbacks.rb
acts_as_api-0.3.7 spec/support/model_examples/callbacks.rb