This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2018-11-29 13:24:37 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-11-30 07:00:03 +00:00
|
|
|
RSpec.describe TelegramBot do
|
2018-11-29 13:24:37 +00:00
|
|
|
subject { create :telegram_bot }
|
|
|
|
|
|
|
|
it { is_expected.to validate_presence_of :secret }
|
2018-11-29 14:08:23 +00:00
|
|
|
it { is_expected.to validate_presence_of :api_token }
|
2018-12-07 00:41:07 +00:00
|
|
|
|
2018-12-07 18:03:01 +00:00
|
|
|
pending '#client'
|
|
|
|
|
2018-12-07 00:41:07 +00:00
|
|
|
describe '#username' do
|
|
|
|
def allow_value(*)
|
|
|
|
super.for :username
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to allow_value nil }
|
|
|
|
|
|
|
|
it { is_expected.not_to allow_value '' }
|
|
|
|
it { is_expected.not_to allow_value ' ' }
|
|
|
|
it { is_expected.not_to allow_value ' ' * rand(2..10) }
|
|
|
|
|
|
|
|
it { is_expected.to allow_value Faker::Internet.username nil, %w[_] }
|
|
|
|
it { is_expected.to allow_value 'foo123_456_BAR' }
|
|
|
|
|
|
|
|
it { is_expected.not_to allow_value Faker::Internet.email }
|
|
|
|
it { is_expected.not_to allow_value Faker::PhoneNumber.phone_number }
|
|
|
|
end
|
2018-11-29 13:24:37 +00:00
|
|
|
end
|