aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/tom_tom_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/lib/tom_tom_spec.rb b/spec/lib/tom_tom_spec.rb
index 71584e242..4571609c3 100644
--- a/spec/lib/tom_tom_spec.rb
+++ b/spec/lib/tom_tom_spec.rb
@@ -1,15 +1,19 @@
RSpec.describe TomTom do
describe ".enabled?" do
it "returns true when API key is set" do
- TomTom.instance_variable_set(:@api_key, 'fake key')
-
+ dummy_key = ['a'..'z','A'..'Z',0..9].map(&:to_a).flatten.sample(32).join
+ allow(TomTom).to receive(:api_key).and_return dummy_key
expect(TomTom.enabled?).to be true
end
it "returns false without an API key" do
- TomTom.instance_variable_set(:@api_key, '')
+ allow(TomTom).to receive(:api_key).and_return ''
+ expect(TomTom.enabled?).to be_falsy
+ end
- expect(TomTom.enabled?).to be false
+ it "returns false when API key is malformed" do
+ allow(TomTom).to receive(:api_key).and_return 'it will not work'
+ expect(TomTom.enabled?).to be_falsy
end
end
end