1
0
mirror of https://github.com/bumi/openalias-ruby synced 2024-10-03 02:24:27 +00:00

Specs! \o/

This commit is contained in:
bumi 2018-11-01 02:38:53 +01:00
parent dbae3e1e87
commit 987ad03325
2 changed files with 18 additions and 3 deletions

View File

@ -6,4 +6,4 @@ Thermite::Tasks.new
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task :default => ['thermite:build', 'thermite:test', 'spec']

View File

@ -5,7 +5,22 @@ RSpec.describe Openalias do
expect(Openalias::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
it "provides accessors for the data" do
expect(Openalias.addresses('donate.getmonero.org')[0].recipient_name).to eql('Monero Development')
expect(Openalias.addresses('donate.getmonero.org')[0].address).to eql('44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A')
end
it "returns and crypto addresses array" do
expect(Openalias.addresses('donate.getmonero.org').class).to eql(Array)
expect(Openalias.addresses('donate.getmonero.org').length).to eql(2)
end
it "returns an empty array if no openalias data is found" do
expect(Openalias.addresses('wikipedia.org')).to eql([]) # I hope this one fails soon when wikipedia has some OpenAlias entries
end
it "returns an empty array for invalid domains" do
expect(Openalias.addresses('ihopethisdomainneverexists123invalid.com')).to eql([])
end
end