-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔀 Merge pull request #2 from pboling/bug/67-upgrade-rspec
Upgrade RSpec to v3
- Loading branch information
Showing
8 changed files
with
87 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--format documentation | ||
--require spec_helper | ||
--color | ||
--order random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.configure do |config| | ||
# RSpec v3+ | ||
# Enable flags like --only-failures and --next-failure | ||
# config.example_status_persistence_file_path = '.rspec_status' | ||
|
||
# RSpec v3+ | ||
# Disable RSpec exposing methods globally on `Module` and `main` | ||
# config.disable_monkey_patching! | ||
|
||
config.expect_with :rspec do |c| | ||
c.syntax = :expect | ||
end | ||
|
||
config.expect_with :test_unit | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,33 @@ | ||
require 'rubygems' if RUBY_VERSION < '1.9.0' | ||
|
||
require File.dirname(__FILE__) + '/../lib/os.rb' # load before sane to avoid sane being able to requir the gemified version... | ||
require 'rspec' # rspec2 | ||
|
||
describe 'For Linux, (Ubuntu, Ubuntu 10.04 LTS) ' do | ||
before(:each) do | ||
ENV.should_receive(:[]).with('OS').any_number_of_times.and_return() | ||
allow(ENV).to receive(:[]).with('OS') | ||
## Having difficulties finding a stub for RUBY_PLATFORM | ||
# Looking into something like: http://stackoverflow.com/questions/1698335/can-i-use-rspec-mocks-to-stub-out-version-constants | ||
# For now, simply using RbConfig::CONFIG | ||
# Kernel.stub!(:const_get).with('RUBY_PLATFORM').and_return("i686-linux") | ||
RbConfig::CONFIG.stub!(:[]).with('host_os').and_return('linux_gnu') | ||
RbConfig::CONFIG.stub!(:[]).with('host_cpu').and_return('i686') | ||
allow(RbConfig::CONFIG).to receive(:[]).with('host_os').and_return('linux_gnu') | ||
allow(RbConfig::CONFIG).to receive(:[]).with('host_cpu').and_return('i686') | ||
end | ||
|
||
describe OS do | ||
subject { OS } # class, not instance | ||
|
||
it { should be_linux } | ||
it { should be_posix } | ||
it { is_expected.to be_linux } | ||
it { is_expected.to be_posix } | ||
|
||
it { should_not be_mac } | ||
it { should_not be_osx } | ||
it { should_not be_windows } | ||
it { is_expected.not_to be_mac } | ||
it { is_expected.not_to be_osx } | ||
it { is_expected.not_to be_windows } | ||
|
||
end | ||
|
||
describe OS::Underlying do | ||
subject { OS::Underlying } # class, not instance | ||
|
||
it { should be_linux } | ||
it { is_expected.to be_linux } | ||
|
||
it { should_not be_bsd } | ||
it { should_not be_windows } | ||
it { is_expected.not_to be_bsd } | ||
it { is_expected.not_to be_windows } | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,28 @@ | ||
require File.expand_path('spec_helper.rb', File.dirname(__FILE__)) | ||
|
||
describe 'For OSX (Snow Leopard, 10.6),' do | ||
before(:each) do | ||
ENV.stub!(:[]).with('OS').and_return(nil) | ||
allow(ENV).to receive(:[]).with('OS').and_return(nil) | ||
# Issues stubbing RUBY_PLATFORM, using RbConfig instead. | ||
# Kernel.stub!(:RUBY_PLATFORM => "x86_64-darwin10.6") | ||
RbConfig::CONFIG.stub!(:[]).with('host_os').and_return("darwin10.6.0") | ||
RbConfig::CONFIG.stub!(:[]).with('host_cpu').and_return('i386') | ||
allow(RbConfig::CONFIG).to receive(:[]).with('host_os').and_return("darwin10.6.0") | ||
allow(RbConfig::CONFIG).to receive(:[]).with('host_cpu').and_return('i386') | ||
end | ||
|
||
describe OS do | ||
subject { OS } # class, not instance | ||
|
||
it { should be_mac } | ||
it { should be_x } # OS.x? | ||
it { should be_osx } | ||
it { should be_posix } | ||
it { is_expected.to be_mac } | ||
it { is_expected.to be_x } # OS.x? | ||
it { is_expected.to be_osx } | ||
it { is_expected.to be_posix } | ||
|
||
it { should_not be_windows } | ||
it { is_expected.not_to be_windows } | ||
|
||
end | ||
|
||
describe OS::Underlying do | ||
subject { OS::Underlying } # class, not instance | ||
|
||
it { should be_bsd } | ||
it { should_not be_windows } | ||
it { is_expected.to be_bsd } | ||
it { is_expected.not_to be_windows } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
require 'rubygems' if RUBY_VERSION < '1.9.0' | ||
require File.expand_path('../lib/os.rb', File.dirname(__FILE__)) | ||
# Third Party Libraries | ||
require 'rspec' | ||
|
||
require 'rspec' # rspec2 | ||
require 'rspec/autorun' | ||
# This gem | ||
require 'os' | ||
|
||
RSpec.configure do |config| | ||
config.expect_with :rspec, :stdlib # enable `should` OR `assert` | ||
end | ||
# Library Configs | ||
|
||
# RSpec Configs | ||
require 'config/rspec/rspec_core' |