Skip to content

Commit

Permalink
Add failing 'spec suite' and 'spec bundle' tests for OSX rake templates
Browse files Browse the repository at this point in the history
- Update cucumber tests to cover these scenarios
- Tests failed for bundles in xcode5, this is now fixed

[#59629092]
  • Loading branch information
Jesse Bounds and Tim Jarratt authored and idoru committed Dec 11, 2013
1 parent 74d1d44 commit 4bceb0d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ module CedarTarget___PACKAGENAMEASIDENTIFIER___
system(cmd) or raise "******** Build failed ********"
end

def run_cmd_and_grep_for_failure(cmd)
puts "Executing #{cmd}"
puts result = %x[#{cmd} 2>&1]
if !result.index(/examples, 0 failures/)
exit(1)
end
end

def with_env_vars(env_vars)
old_values = {}
env_vars.each do |key,new_value|
Expand Down Expand Up @@ -67,6 +75,12 @@ end
desc "Build and run ___PACKAGENAMEASIDENTIFIER___ OCUnit logic specs"
task :___PACKAGENAMEASIDENTIFIER___ => :clean____PACKAGENAMEASIDENTIFIER___ do
CedarTarget___PACKAGENAMEASIDENTIFIER___.with_env_vars("CEDAR_REPORTER_CLASS" => "CDRColorizedReporter") do
CedarTarget___PACKAGENAMEASIDENTIFIER___.system_or_exit "pushd #{CedarTarget___PACKAGENAMEASIDENTIFIER___::PROJECT_ROOT} ; xcodebuild -target #{CedarTarget___PACKAGENAMEASIDENTIFIER___::SPECS_TARGET_NAME} -configuration #{CedarTarget___PACKAGENAMEASIDENTIFIER___::CONFIGURATION} -arch x86_64 build TEST_AFTER_BUILD=YES SYMROOT='#{CedarTarget___PACKAGENAMEASIDENTIFIER___::BUILD_DIR}' ; popd", CedarTarget___PACKAGENAMEASIDENTIFIER___.output_file("___PACKAGENAME___")
build_and_test_command = <<END_SHELL_CMD
xcodebuild -target #{CedarTarget___PACKAGENAMEASIDENTIFIER___::SPECS_TARGET_NAME} -configuration #{CedarTarget___PACKAGENAMEASIDENTIFIER___::CONFIGURATION} -arch x86_64 build SYMROOT='#{CedarTarget___PACKAGENAMEASIDENTIFIER___::BUILD_DIR}' ;
xcodebuild -scheme #{CedarTarget___PACKAGENAMEASIDENTIFIER___::SPECS_TARGET_NAME} -configuration Debug -arch x86_64 test SYMROOT='#{CedarTarget___PACKAGENAMEASIDENTIFIER___::BUILD_DIR}'
END_SHELL_CMD
Dir.chdir(CedarTarget___PACKAGENAMEASIDENTIFIER___::PROJECT_ROOT) do
CedarTarget___PACKAGENAMEASIDENTIFIER___.run_cmd_and_grep_for_failure build_and_test_command
end
end
end
13 changes: 13 additions & 0 deletions features/osx_templates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,17 @@ Feature:
When I add an OS X Spec suite target
Then the `rake Specs` should work

Scenario: Failing Spec suite tests
Given an Xcode OS X project

When I add an OS X Spec suite target
And I add a failing test
Then running the specs from the rake task should fail

Scenario: Failing Spec bundle tests
Given an Xcode OS X project

When I add an OS X Spec bundle target
And I add a failing test
Then running the specs from the rake task should fail

12 changes: 12 additions & 0 deletions features/scenario_steps/osx_templates_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
File.exist?("template-project/Specs").should be_true
end

When(/^I add a failing test$/) do
`cp features/support/templates/FailingSpec.mm template-project/Specs/ExampleSpec.mm`
end

Then(/^the `rake Specs` should work$/) do
Dir.chdir('template-project/Specs') do
output = `rake Specs 2> /dev/null`
Expand All @@ -27,3 +31,11 @@
$?.exitstatus.should == 0
end
end

Then(/^running the specs from the rake task should fail$/) do
Dir.chdir('template-project/Specs') do
`rake Specs 2> /dev/null`
$?.exitstatus.should_not eq(0)
end
end

0 comments on commit 4bceb0d

Please sign in to comment.