Repository URL to install this package:
|
Version:
4.0.0.pre.3 ▾
|
require 'rails_helper'
RSpec.describe Core::Configuration do
let(:config) { described_class.new stripe_token: 'a', opencage_token: 'b' }
it 'has a full set of configured values' do
expect(config.stripe_token).to eq 'a'
expect(config.opencage_token).to eq 'b'
end
it 'has a string representation' do
expect(config.to_s).to be_a String
# looks for a pattern that looks like:
# #<Core::Configuration:70239258795920 stripe_token=a>
# #<Core::Configuration:70239258795920>
expect(config.to_s).to match(/#<[a-zA-Z]*::[a-zA-Z]*:[0-9]*\
(?=>?|\s[a-z_=]*\s?[a-z_=]*>)/)
end
it 'has a hash representation' do
hash = config.to_h
expect(hash).to be_a Hash
expect(hash[:stripe_token]).to eq 'a'
end
end