Sha256: 13be884259d648ae5cb91086d2444ebc94fc62fd6f83b31cbbb166137e0db6eb

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

require 'spec_helper'
require 'lib/auto_generate_test_class'
require 'lib/test_class'

describe AutoGenerateTestClass do
  it "should auto generate fields" do
    real = AutoGenerateTestClass.new({:foo => :bar})
    
    real.respond_to?(:foo).should == true
    real.respond_to?(:bar).should == false
  end
end

describe TestClass do
  it "should raise exception encountering a non existant field" do
    lambda { real = TestClass.new({:foo => :bar}) }.should raise_error 
  end
  
  # TODO move to own test
  it "should return :id as required symbol" do
    TestClass.required_symbols.should == [ :id ]
  end
  
  # TODO move to own test
  it "should raise on non-replaced mandatory field" do
    lambda { TestClass.where().replace_path }.should raise_error(Exception, "you didn't replace all fields in the api_path")
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api-query-provider-0.0.1 spec/autogeneration_spec.rb