Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to RSpec 2.x #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
source :rubygems

gemspec

group :test do
gem "rspec", :require => "spec"
gem "watchr"
end


6 changes: 2 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'rake'
require 'spec/rake/spectask'
require 'rspec/core/rake_task'

Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList['spec']
end
RSpec::Core::RakeTask.new(:spec)

task :default => :spec
5 changes: 5 additions & 0 deletions codersdojo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ Gem::Specification.new do |s|
s.test_files = Dir['spec/*']
s.executables = ['codersdojo']
s.required_ruby_version = '>= 1.8.6'

s.add_dependency('json', '>= 1.4.6')
s.add_dependency('rest-client', '>= 1.6.1')
s.add_dependency('term-ansicolor', '>= 1.0.5')
s.add_dependency('shell-utils', '= 0.1.1')
s.add_dependency('flote', '= 0.0.2')

s.add_development_dependency 'rake', '~> 10.0.0'
s.add_development_dependency "rspec", '~> 2.0'
s.add_development_dependency 'watchr'
end
2 changes: 1 addition & 1 deletion spec/unit/record/state_recorder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def regex_matcher regex
@process_mock = mock.as_null_object
@session_id_generator_mock = mock.as_null_object
@meta_config_file_mock = mock.as_null_object
@meta_config_file_mock.should_receive(:success_detection).any_number_of_times
@meta_config_file_mock.stub(:success_detection).and_return(false)
@state_recorder = StateRecorder.new @shell_mock, @session_id_generator_mock, @meta_config_file_mock
@state_recorder.session_id = "session_id"
@state_recorder.step = 0
Expand Down
19 changes: 12 additions & 7 deletions spec/unit/run/scheduler_interrupt_listener_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,32 @@
require 'run/scheduler_interrupt_listener'

describe SchedulerInterruptListener do
CURRENT_PROCESS = 0

before :each do
@view_mock = mock
@scheduler = Scheduler.new mock.as_null_object
@view_mock = mock('view')
runner = mock.as_null_object
@scheduler = Scheduler.new runner
@scheduler.interrupt_listener = SchedulerInterruptListener.new @view_mock, []
end

it "should have no last action initially" do
@scheduler.interrupt_listener.last_action_was_exit?.should == false
@scheduler.interrupt_listener.last_action_was_resume?.should == false
@scheduler.interrupt_listener.should_not be_last_action_was_exit
@scheduler.interrupt_listener.should_not be_last_action_was_resume
end

# fails on MRI 1.9.3p327
# working on MRI 1.8.x?
it "should exit on Ctrl-C and 'e' (exit)" do
@view_mock.should_receive :show_kata_exit_message
@view_mock.should_receive(:read_user_input).and_return "e"
@view_mock.should_receive :show_kata_upload_hint

Thread.new { @scheduler.start }
Process.kill "INT", 0
@scheduler.interrupt_listener.last_action_was_exit?.should == true
end
# Kills my whole X session when debugging it in RubyMine
Process.kill "INT", CURRENT_PROCESS
@scheduler.interrupt_listener.should be_last_action_was_exit
end

it "should execute command when the user pressed Ctrl-C and the command-key of the command" do
@command_a_mock = mock
Expand Down