Sha256: fab9ec1898c7c0cce1c093bea1961a813f5c62741786cbe8283b8bcc299a4071

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

class TestServiceClass < Trackerific::Service
  class << self
    def required_parameters
      [:required, :also_required]
    end
  end
end

describe Trackerific::Service do
  
  describe :required_parameters do
    specify { Trackerific::Service.required_parameters.should be_kind_of Array }
  end
  
  describe :service_name do
    specify { Trackerific::Service.service_name.should be_kind_of String }
  end
  
  context "with a new Trackerific::Service class that has required options" do
    
    context "has all the required options" do
      it "should be able to create a new instance" do
        t = TestServiceClass.new(:required => true, :also_required => :yup)
        t.should be_a TestServiceClass
      end
    end
    
    context "is missing some required options" do
      it "should raise an ArgumentError" do
        lambda { TestServiceClass.new() }.should raise_error(ArgumentError)
      end
    end
    
    context "has an invalid option" do
      it "should raise an ArgumentError" do
        lambda { TestServiceClass.new(:unknown => :argument ) }.should raise_error(ArgumentError)
      end
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trackerific-0.6.2 spec/lib/trackerific/service_spec.rb
trackerific-0.6.1 spec/lib/trackerific/service_spec.rb
trackerific-0.6.0 spec/lib/trackerific/service_spec.rb