Created
March 10, 2011 15:38
-
-
Save andreastt/864286 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'rubygems' | |
require 'rbconfig' | |
require 'rspec' | |
class PlatformDependentExample | |
def platform | |
case RbConfig::CONFIG['host_os'] | |
when /windows/ | |
:windows | |
when /linux/ | |
:linux | |
when /darwin/ | |
:macosx | |
when /solaris|bsd/ | |
:unix | |
end | |
end | |
def test | |
platform | |
end | |
end | |
RSpec.configuration.filter_run :os => :linux | |
describe PlatformDependentExample do | |
describe '#test' do | |
before :all do | |
@e = PlatformDependentExample.new | |
end | |
context 'Some subfeature that only exists on Linux', :os => :linux do | |
it 'returns :linux' do | |
@e.test.should == :linux | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment