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

Performance tests #1419

Merged
merged 5 commits into from Sep 17, 2013
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions padrino-helpers/test/test_output_helpers.rb
Expand Up @@ -79,8 +79,8 @@ def app

should "work for slim templates" do
visit '/slim/capture_concat'
# TODO Get Slim concat working
# assert_have_selector 'p', :content => "Concat Line 3", :count => 1
#TODO Get Slim concat working
assert_have_selector 'p', :content => "Concat Line 3", :count => 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Travis failed this test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someway this stash slipped into my commits, sorry for that. I forgot to run rake test on my machine before creating this pull request.

end
end

Expand Down
4 changes: 2 additions & 2 deletions padrino-performance/lib/padrino-performance/os.rb
Expand Up @@ -4,11 +4,11 @@ module Performance
# Source: http://stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on
module OS
def self.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RbConfig::CONFIG['target_os']) != nil
end

def self.mac?
(/darwin/ =~ RUBY_PLATFORM) != nil
(/darwin/ =~ RbConfig::CONFIG['target_os']) != nil
end

def self.unix?
Expand Down
12 changes: 12 additions & 0 deletions padrino-performance/test/helper.rb
@@ -0,0 +1,12 @@
require File.expand_path('../../../load_paths', __FILE__)
require File.join(File.dirname(__FILE__), '..', '..', 'padrino-core', 'test', 'mini_shoulda')

require 'padrino-core'
require 'padrino-performance'
require 'rack'
require 'rack/test'

class MiniTest::Spec
include Rack::Test::Methods
end

61 changes: 61 additions & 0 deletions padrino-performance/test/test_os.rb
@@ -0,0 +1,61 @@
require File.expand_path(File.dirname(__FILE__) + '/helper')

describe "Padrino Performance OS Module" do
WINDOWS_RELATED_SYSTEMS = %w(cygwin mswin mingw bccwin wince emx)

context "#windows?" do
should "return false if OS is now windows" do
RbConfig::CONFIG['target_os'] = "linux"
refute(Padrino::Performance::OS.windows?, "No non windows system given")
end

should "return true if we have some windows instance" do
WINDOWS_RELATED_SYSTEMS.each do |system|
RbConfig::CONFIG['target_os'] = system
assert(Padrino::Performance::OS.windows?, "#{system} is no windows related operation system.")
end
end
end

context "#mac?" do
should "return true if we have darwin running" do
RbConfig::CONFIG['target_os'] = 'darwin'
assert(Padrino::Performance::OS.mac?, "We have no Mac related system running")
end

should "return false if we have linux running" do
RbConfig::CONFIG['target_os'] = 'linux'
refute(Padrino::Performance::OS.mac?, "We have no Mac related system running")
end
end

context "#unix?" do
should "return true if OS is not windows" do
RbConfig::CONFIG['target_os'] = 'linux'
assert(Padrino::Performance::OS.unix?, "We have no windows related system running")
end

should "return false if OS is windows" do
WINDOWS_RELATED_SYSTEMS.each do |system|
RbConfig::CONFIG['target_os'] = system
refute(Padrino::Performance::OS.unix?, "#{system} is windows related operation system.")
end
end
end

context "#linux?" do
should "return true if we have no Windows or Mac related OS" do
RbConfig::CONFIG['target_os'] = 'linux'
assert(Padrino::Performance::OS.linux?, 'We have either Mac or Windows operation system.')
end

should "return false if we have a Windows or Mac related OS" do
RbConfig::CONFIG['target_os'] = 'mingw'
refute(Padrino::Performance::OS.linux?, 'We a Windows related operation system.')

RbConfig::CONFIG['target_os'] = 'darwin'
refute(Padrino::Performance::OS.linux?, 'We a darwin operation system.')
end
end

end
5 changes: 5 additions & 0 deletions padrino-performance/test/test_padrino_performance.rb
@@ -0,0 +1,5 @@
require File.expand_path(File.dirname(__FILE__) + '/helper')

describe "Padrino Performance" do

end