Skip to content

Instantly share code, notes, and snippets.

@andreastt
Created March 10, 2011 15:19
Show Gist options
  • Save andreastt/864236 to your computer and use it in GitHub Desktop.
Save andreastt/864236 to your computer and use it in GitHub Desktop.
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
its(:test, :os => :windows) { should == :windows }
its(:test, :os => :linux) { should == :linux }
its(:test, :os => :macosx) { should == :macosx }
its(:test, :os => :unix) { should == :unix }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment