Skip to content

Commit 83a98cf

Browse files
committed
fix more specs
1 parent 741844d commit 83a98cf

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

openc3-cosmos-script-runner-api/spec/controllers/completed_script_controller_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
RSpec.describe CompletedScriptController, :type => :controller do
2626
describe "GET index" do
2727
before(:each) do
28+
mock_redis()
2829
# Simply stub out ScriptStatusModel to return an empty JSON structure
2930
allow(OpenC3::ScriptStatusModel).to receive(:all).and_return([])
3031
allow(OpenC3::ScriptStatusModel).to receive(:count).and_return(0)

openc3-cosmos-script-runner-api/spec/rails_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
# This file may also be used under the terms of a commercial license
2121
# if purchased from OpenC3, Inc.
2222

23+
require 'openc3/script/script'
24+
module OpenC3
25+
module Script
26+
def self.included(base)
27+
# Empty to override all the fancy stuff in script.rb
28+
end
29+
end
30+
end
31+
include OpenC3::Script
32+
2333
# This file is copied to spec/ when you run 'rails generate rspec:install'
2434
require 'spec_helper'
2535
ENV['CI'] ||= 'true'

openc3/spec/utilities/authentication_spec.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
module OpenC3
2323
describe OpenC3Authentication do
24+
before(:each) do
25+
mock_redis()
26+
end
27+
2428
describe "initialize" do
2529
it "raises an error if OPENC3_API_PASSWORD is not set" do
2630
old_password = ENV['OPENC3_API_PASSWORD']
@@ -30,17 +34,9 @@ module OpenC3
3034
end
3135

3236
it "initializes with OPENC3_API_PASSWORD" do
33-
ENV['OPENC3_API_PASSWORD'] = 'test_password'
34-
auth = OpenC3Authentication.new
35-
expect(auth.token).to eq('test_password')
36-
end
37-
end
38-
39-
describe "token" do
40-
it "returns the token from environment" do
41-
ENV['OPENC3_API_PASSWORD'] = 'my_token'
37+
ENV['OPENC3_API_PASSWORD'] = 'password'
4238
auth = OpenC3Authentication.new
43-
expect(auth.token).to eq('my_token')
39+
expect(auth.token).not_to be_nil # it should be some random string (session token)
4440
end
4541
end
4642
end

0 commit comments

Comments
 (0)