Sha256: cf3629d5f40655f1045f3d2cd9d86d761098ee7ff243a0983732aa6dfd64b788

Contents?: true

Size: 908 Bytes

Versions: 47

Compression:

Stored size: 908 Bytes

Contents

require 'spec_helper'

describe Limit do
  subject { Factory(:limit) }

  it { should belong_to(:plan) }
  it { should validate_presence_of(:name) }
  it { should validate_presence_of(:value) }
end

describe Limit, "various kinds" do
  let!(:users) { Factory(:limit, :name => "users", :value => 1) }
  let!(:ssl) { Factory(:limit, :name => "ssl", :value => 0, :value_type => :boolean) }
  let!(:lighthouse) { Factory(:limit, :name => "lighthouse", :value => 1, :value_type => :boolean) }

  it "gives the numbered limits" do
    Limit.numbered.should == [users]
  end

  it "gives the boolean limits" do
    Limit.boolean.should == [ssl, lighthouse]
  end

  it "gives the limits by name" do
    Limit.named(:users).should == users
  end

  it "reports true for booleans with 1" do
    lighthouse.allowed?.should be
  end

  it "reports false for booleans with 0" do
    ssl.allowed?.should_not be
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
saucy-0.2.28.1 spec/models/limit_spec.rb
saucy-0.3.1 spec/models/limit_spec.rb
saucy-0.3.0 spec/models/limit_spec.rb
saucy-0.2.45 spec/models/limit_spec.rb
saucy-0.2.44 spec/models/limit_spec.rb
saucy-0.2.43 spec/models/limit_spec.rb
saucy-0.2.42 spec/models/limit_spec.rb
saucy-0.2.41 spec/models/limit_spec.rb
saucy-0.2.40 spec/models/limit_spec.rb
saucy-0.2.39 spec/models/limit_spec.rb
saucy-0.2.38 spec/models/limit_spec.rb
saucy-0.2.36 spec/models/limit_spec.rb
saucy-0.2.35 spec/models/limit_spec.rb
saucy-0.2.34 spec/models/limit_spec.rb
saucy-0.2.33 spec/models/limit_spec.rb
saucy-0.2.32 spec/models/limit_spec.rb
saucy-0.2.31 spec/models/limit_spec.rb
saucy-0.2.30 spec/models/limit_spec.rb
saucy-0.2.29 spec/models/limit_spec.rb
saucy-0.2.28 spec/models/limit_spec.rb