Skip to content

Commit

Permalink
add tests for before_env callback
Browse files Browse the repository at this point in the history
  • Loading branch information
jacaetevha committed Oct 4, 2010
1 parent 63e522c commit 1890e75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/infinity_test/application.rb
Expand Up @@ -97,7 +97,7 @@ def notification_framework
end

def run_before_environment_callback!
before_environment_callback.call(self)
before_environment_callback.call(self) if before_environment_callback
end

def run!(commands)
Expand Down
1 change: 0 additions & 1 deletion lib/infinity_test/continuous_testing.rb
Expand Up @@ -9,7 +9,6 @@ def initialize(options)
# Start the Continuous Testing Server and begin to audit the files for changes
#
def start!
puts %Q{#{__FILE__} - start!: #{caller.join("\n")}}
@application.run_before_environment_callback!
@global_commands = @application.construct_commands
run!(@global_commands)
Expand Down
15 changes: 14 additions & 1 deletion spec/infinity_test/application_spec.rb
Expand Up @@ -19,7 +19,20 @@ module InfinityTest
it "should return the rubies in the config" do
application_with(:rubies => ['1.9.2']).rubies.should == '1.9.2'
end


it "should return the before_env callback" do
app = application_with(:test_framework => :rspec)
proc = Proc.new { |application| application.test_framework.test_pattern = 'foo'; application.library_directory_pattern = 'bar' }
app.config.before_env(&proc)
app.before_environment_callback.should equal proc
app.test_framework.test_pattern.should_not == 'foo'
app.library_directory_pattern.should_not == 'bar'

app.run_before_environment_callback!
app.test_framework.test_pattern.should == 'foo'
app.library_directory_pattern.should == 'bar'
end

it "should return the before callback" do
app = application_with(:test_framework => :rspec)
proc = Proc.new { 'To Infinity and beyond!' }
Expand Down

0 comments on commit 1890e75

Please sign in to comment.