Sha256: d00dca6b2e4c8693f6e36e546d1e4ac8840a66cf63fdb62c832201a4c5def6f7
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
require 'spec_helper' module Omnitest class Psychic RSpec.describe Script do before(:each) do write_file 'sample.rb', <<-eos puts 'hello' puts '{basic_token}' puts '{{mustache_token}}' puts ENV['ENV_VAR'] # --flag opts = {} # Pretend we parsed opts puts opts[:flag] eos end subject { Psychic.new(cwd: current_dir).script('sample') } describe '#tokens' do it 'is empty if the there is no detection_strategy' do subject.opts[:detection_strategy] = nil expect(subject.tokens).to be_empty end it 'finds the basic_token if the execution strategy is tokens' do subject.opts[:detection_strategy] = 'tokens' expect(subject.tokens).to eq(['basic_token']) end end describe '#execution_strategy' do it 'is a DefaultStrategy if the mode is not set' do expect(subject.execution_strategy).to be_an_instance_of Execution::DefaultStrategy end it 'is an EnvStrategy if the mode is env' do subject.opts[:execution_strategy] = 'environment_variables' expect(subject.execution_strategy).to be_an_instance_of Execution::EnvStrategy end it 'is a FlagStrategy if the mode is flags' do subject.opts[:execution_strategy] = 'flags' expect(subject.execution_strategy).to be_an_instance_of Execution::FlagStrategy end it 'is a TokenStrategy if the mode is tokens' do subject.opts[:execution_strategy] = 'tokens' expect(subject.execution_strategy).to be_an_instance_of Execution::TokenStrategy end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omnitest-psychic-0.0.9 | spec/omnitest/psychic/script_spec.rb |