mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-19 05:21:01 +02:00
30 lines
738 B
Ruby
30 lines
738 B
Ruby
require 'spec_helper'
|
|
|
|
describe LoginToken do
|
|
describe "#active, #inactive" do
|
|
let(:active) { 3 }
|
|
let(:inactive) { 5 }
|
|
|
|
before do
|
|
active.times do |n|
|
|
create(:login_token, expired_at: (n + 1).day.from_now)
|
|
end
|
|
inactive.times do |n|
|
|
create(:login_token, expired_at: (n + 1).day.ago)
|
|
end
|
|
end
|
|
|
|
describe "#active" do
|
|
subject { LoginToken.active }
|
|
it { subject.count.should == active }
|
|
it { subject.all?{|t| t.expired_at > Time.now}.should be_truthy }
|
|
end
|
|
|
|
describe "#inactive" do
|
|
subject { LoginToken.inactive }
|
|
it { subject.count.should == inactive }
|
|
it { subject.all?{|t| t.expired_at <= Time.now}.should be_truthy }
|
|
end
|
|
end
|
|
end
|