require 'fwtoolkit/rake/tasks/test' require 'support/ctx_rake' require 'support/project_generator' require 'rake' require 'support/aruba-doubles-rspec' require 'support/double_helper' describe 'test' do let!(:project) { ProjectGenerator.new } let(:config) { project.config } let!(:cmd_double) { ArubaDoublesSupport.new } before :each do project.create_test_project(ProjectGenerator::PRJFILE_COMPLETE_CONFIG) Dir.chdir(project.project_folder) # cucumber/rake relies on the presence of bundler Gem::Specification.stub(:find_all_by_name).with('bundler').and_return(['bundler']) cmd_double.setup end after :each do cmd_double.teardown #@project_generator.delete_project end describe 'test:frank' do include_context 'rake' it 'runs the cucumber task' do FWToolkit::Rake::TestTask.new invoke_and_expect_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip" end it 'sets the right env vars for the Frank environment' do FWToolkit::Rake::TestTask.new cmd_double.double_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip" subject.invoke ENV['USE_SIM_LAUNCHER_SERVER'].should be_nil ENV['APP_BUNDLE_PATH'].should eq File.join(Dir.pwd, config[:frankified_app]) end end describe 'test:build' do include_context 'rake' it 'builds the frankified app' do FWToolkit::Rake::TestTask.new invoke_and_expect_cmd "frank build --workspace #{config[:xcode_workspace]} --scheme #{config[:xcode_scheme]}" end end describe 'test:ci:frank' do include_context 'rake' it 'runs the cucumber task (CI)' do FWToolkit::Rake::TestTask.new invoke_and_expect_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip --format pretty --format html --out '/tmp/frank_results.html' --format rerun --out '/tmp/frank_rerun.txt'" end it 'runs the cucumber task when a custom build_artifact env is specified (CI)' do FWToolkit::Rake::TestTask.new ENV['CC_BUILD_ARTIFACTS'] = '/myDir' invoke_and_expect_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip --format pretty --format html --out '/myDir/frank_results.html' --format rerun --out '/myDir/frank_rerun.txt'" end it 'sets the right env vars for the Frank environment (CI)' do FWToolkit::Rake::TestTask.new cmd_double.double_cmd "bundle exec cucumber #{config[:frank_root]}/Features --tags=~@wip --format pretty --format html --out '/tmp/frank_results.html' --format rerun --out '/tmp/frank_rerun.txt'" subject.invoke ENV['USE_SIM_LAUNCHER_SERVER'].should eq 'yes' ENV['APP_BUNDLE_PATH'].should eq File.join(Dir.pwd, config[:frankified_app]) end end end