Permalink
Browse files

Added package feature and scenarios.

This verifies the process of bundling extensions into
gems.
  • Loading branch information...
1 parent 0d068b1 commit 3223d338b233b40acb3d9bef8efbb613ec459441 @luislavena luislavena committed Nov 19, 2008
Showing with 41 additions and 0 deletions.
  1. +28 −0 features/package.feature
  2. +13 −0 features/step_definitions/gem.rb
View
@@ -0,0 +1,28 @@
+Feature: Distribute native extension with gems
+
+ In order to avoid compiler toolchain requirement during installation
+ As a Gem developer.
+ I want rake tasks generate platform specific gems for me
+
+ Scenario: generate pure ruby gem
+ Given a safe project directory
+ And a gem named 'my_project'
+ And a extension named 'extension_one'
+ And I've already successfully executed rake task 'compile'
+ And 'pkg' folder is deleted
+ When rake task 'gem' is invoked
+ Then rake task 'gem' succeeded
+ And 'pkg' folder is created
+ And ruby gem for 'my_project' version '0.1.0' do exist in 'pkg'
+
+ Scenario: generate native gem
+ Given a safe project directory
+ And a gem named 'my_project'
+ And a extension named 'extension_one'
+ And I've already successfully executed rake task 'compile'
+ And 'pkg' folder is deleted
+ When rake task 'native gem' is invoked
+ Then rake task 'native gem' succeeded
+ And 'pkg' folder is created
+ And ruby gem for 'my_project' version '0.1.0' do exist in 'pkg'
+ And binary gem for 'my_project' version '0.1.0' do exist in 'pkg'
@@ -0,0 +1,13 @@
+Given /^a gem named '(.*)'$/ do |gem_name|
+ generate_gem_task gem_name
+end
+
+Then /^(ruby|binary) gem for '(.*)' version '(.*)' do exist in '(.*)'$/ do |type, gem_name, version, folder|
+ if type == 'ruby' then
+ gem_file = "#{folder}/#{gem_name}-#{version}.gem"
+ else
+ platform = Gem::Platform.local.to_s
+ gem_file = "#{folder}/#{gem_name}-#{version}-#{platform}.gem"
+ end
+ File.exist?(gem_file).should be_true
+end

0 comments on commit 3223d33

Please sign in to comment.