Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script that calls the tests:
- -----------------------------
- require 'rspec'
- ...
- RSpec.shared_context "shared env attributes", :a => :b do
- let(:shared_attr) { {'environment' => env_attr} }
- end
- result = RSpec::Core::Runner.run(existing_test_files)
- ...
- existing_test_files is an array of 2 files:
- testfile1:
- ------------------------------------------------------
- require 'serverspec'
- include Serverspec::Helper::Exec
- include Serverspec::Helper::DetectOS
- RSpec.configure do |config|
- config.color = true
- config.formatter = :documentation
- end
- describe 'recipe app::upgrade tests' do
- context file('/user/app') do
- it { should be_directory }
- it { should be_mode 755 }
- it { should be_owned_by 'user-app' }
- end
- end
- testfile2:
- ------------------------------------------------------
- contains the same like testfile1
- stdout -> testresults
- ----------------
- recipe app::upgrade tests
- recipe app::upgrade tests
- File "/user/app"
- File "/user/app"
- should be directory
- should be directory
- should be mode 755
- should be mode 755
- should be owned by "user-app"
- should be owned by "user-app"
- ...
- problem: the test are called n times. In this case 2 times. If I add a third testfile each test of each file is called 3 times.
- Hint: Before this problem I had to move RSpec.configure from the calling script to the testfiles, to see the testresults
Advertisement
Add Comment
Please, Sign In to add comment