Skip to content

Commit

Permalink
update Rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
alainravet committed Oct 22, 2015
1 parent 8bb5777 commit 25778ab
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion private_please.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
gem.add_dependency 'cattr_reader_preloaded'

gem.add_development_dependency 'rake' # to run 'All specs' in Rubymine
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'rspec', '>=3.3'
gem.add_development_dependency 'guard-rspec'
gem.add_development_dependency 'rb-fsevent'
end
52 changes: 26 additions & 26 deletions spec/01_tracking_candidate_methods/load_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ def gem?(requiree)


example '.standard_lib? detects if a string matches a standard library' do
std_lib?('csv' ).should be_true
std_lib?('csv.rb' ).should be_true
std_lib?('bigdecimal' ).should be_true
std_lib?('bigdecimal/util' ).should be_true
std_lib?('bigdecimal/util.rb' ).should be_true

std_lib?('rspec' ).should be_false
std_lib?('private_please' ).should be_false
std_lib?('/an/abs/path/csv' ).should be_false
std_lib?('../csv' ).should be_false
std_lib?('lib/../csv' ).should be_false
std_lib?('csv' ).should be_truthy
std_lib?('csv.rb' ).should be_truthy
std_lib?('bigdecimal' ).should be_truthy
std_lib?('bigdecimal/util' ).should be_truthy
std_lib?('bigdecimal/util.rb' ).should be_truthy

std_lib?('rspec' ).should be_falsey
std_lib?('private_please' ).should be_falsey
std_lib?('/an/abs/path/csv' ).should be_falsey
std_lib?('../csv' ).should be_falsey
std_lib?('lib/../csv' ).should be_falsey
end

example '.gem? detects if a string matches a gem' do
gem?('csv' ).should be_false
gem?('csv.rb' ).should be_false
gem?('bigdecimal' ).should be_false
gem?('bigdecimal/util' ).should be_false
gem?('bigdecimal/util.rb' ).should be_false

gem?('rspec' ).should be_true
gem?('rspec/core/rake_task').should be_true
gem?('rspec/autorun' ).should be_true
gem?('coderay' ).should be_true
gem?('lib/../rspec' ).should be_true # same as gem?('rspec')

gem?('/an/abs/path/rspec' ).should be_false
gem?('../rspec' ).should be_false
gem?('rspec/../lib/foo' ).should be_false
gem?('csv' ).should be_falsey
gem?('csv.rb' ).should be_falsey
gem?('bigdecimal' ).should be_falsey
gem?('bigdecimal/util' ).should be_falsey
gem?('bigdecimal/util.rb' ).should be_falsey

gem?('rspec' ).should be_truthy
gem?('rspec/core/rake_task').should be_truthy
gem?('rspec/autorun' ).should be_truthy
gem?('coderay' ).should be_truthy
gem?('lib/../rspec' ).should be_truthy # same as gem?('rspec')

gem?('/an/abs/path/rspec' ).should be_falsey
gem?('../rspec' ).should be_falsey
gem?('rspec/../lib/foo' ).should be_falsey
end

end
8 changes: 3 additions & 5 deletions spec/06_at_exit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

it 'prints the PP simpletext report to $stdout (when not in test mode)' do
$private_please_tests_are_running = false
PrivatePlease::Reporter::SimpleText.stub(:new => stub(:text => '<the-report-text>'))
$stdout.
should_receive(:puts).
with('<the-report-text>')
allow(PrivatePlease::Reporter::SimpleText).to receive_messages(new: double(text: '<the-report-text>'))
expect($stdout).to receive(:puts).with('<the-report-text>')
begin
PrivatePlease.at_exit
ensure
$private_please_tests_are_running = true
end
end

end
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.reset_before_new_test
end

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.expect_with(:rspec) { |c| c.syntax = [:expect, :should] }
config.run_all_when_everything_filtered = true
config.filter_run :focus

Expand Down
6 changes: 3 additions & 3 deletions spec/units/candidates_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
example 'storing the 1st instance method candidate stores it so that it can be retrieved' do
candidates_store.store(object_to_s)

candidates_store.stored?(object_to_s).should be_true
candidates_store.stored?(object_to_s).should be_truthy
candidates_store.instance_methods.should == {'Object' => mnames_for('to_s')}
candidates_store.class_methods .should be_empty
end

example 'storing the 1st class method candidate stores it so that it can be retrieved' do
candidates_store.store(object_new)

candidates_store.stored?(object_new).should be_true
candidates_store.stored?(object_new).should be_truthy
candidates_store.instance_methods.should be_empty
candidates_store.class_methods .should == {'Object' => mnames_for('new')}
end
Expand All @@ -39,7 +39,7 @@
candidates_store.store(object_to_s)
candidates_store.store(object_hash)

candidates_store.stored?(object_hash).should be_true
candidates_store.stored?(object_hash).should be_truthy
candidates_store.instance_methods.should == {'Object' => mnames_for(%w(hash to_s))}
candidates_store.class_methods .should be_empty
end
Expand Down

0 comments on commit 25778ab

Please sign in to comment.