Skip to content

Commit

Permalink
Merge master and implement block functionality for multipart emails
Browse files Browse the repository at this point in the history
  • Loading branch information
wingrunr21 committed Jun 29, 2011
2 parents 3c787ad + a922b8e commit fdd127c
Show file tree
Hide file tree
Showing 112 changed files with 683 additions and 9,848 deletions.
12 changes: 12 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
appraise "3.0.3" do
gem "rails", "3.0.3"
gem "rake", "~> 0.8.7"
end

appraise "3.1.0.rc1" do
gem "rails", "3.1.0.rc1"
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
end
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source 'http://rubygems.org'

gemspec
gem 'rake', '~> 0.8.7'

9 changes: 7 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
require 'appraisal'

$LOAD_PATH.unshift("lib")
require 'shoulda/matchers/version'
Expand Down Expand Up @@ -41,10 +42,14 @@ desc "Clean files generated by rake tasks"
task :clobber => [:clobber_rdoc, :clobber_package]

Cucumber::Rake::Task.new do |t|
t.fork = true
t.fork = false
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
end

desc 'Default: run specs and cucumber features'
task :default => [:spec, :cucumber]
task :default => [:all]

desc 'Test the plugin under all supported Rails versions.'
task :all => ["appraisal:cleanup", "appraisal:install"] do |t|
exec('rake appraisal spec cucumber')
end
7 changes: 3 additions & 4 deletions features/rails_integration.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@disable-bundler
Feature: integrate with Rails

Background:
Expand All @@ -13,7 +12,7 @@ Feature: integrate with Rails
end
end
"""
When I successfully run "rake db:migrate --trace"
When I successfully run `bundle exec rake db:migrate --trace`
And I write to "app/models/user.rb" with:
"""
class User < ActiveRecord::Base
Expand Down Expand Up @@ -55,7 +54,7 @@ Feature: integrate with Rails
should assign_to(:example)
end
"""
When I successfully run "rake test TESTOPTS=-v --trace"
When I successfully run `bundle exec rake test TESTOPTS=-v --trace`
Then the output should contain "1 tests, 1 assertions, 0 failures, 0 errors"
And the output should contain "2 tests, 2 assertions, 0 failures, 0 errors"
And the output should contain "User should require name to be set"
Expand All @@ -82,7 +81,7 @@ Feature: integrate with Rails
it { should assign_to(:example) }
end
"""
When I successfully run "rake spec SPEC_OPTS=-fs --trace"
When I successfully run `bundle exec rake spec SPEC_OPTS=-fs --trace`
Then the output should contain "2 examples, 0 failures"
And the output should contain "should require name to be set"
And the output should contain "should assign @example"
66 changes: 51 additions & 15 deletions features/step_definitions/rails_steps.rb
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
APP_NAME = 'testapp'.freeze

BUNDLE_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE)
ORIGINAL_BUNDLE_VARS = Hash[ENV.select{ |key,value| BUNDLE_ENV_VARS.include?(key) }]

Before do
ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, ENV['BUNDLE_GEMFILE'])
end

After do
ORIGINAL_BUNDLE_VARS.each_pair do |key, value|
ENV[key] = value
end
end

When /^I generate a new rails application$/ do
steps %{
When I run "rails _3.0.3_ new #{APP_NAME}"
When I run `rails new #{APP_NAME}`
And I cd to "#{APP_NAME}"
And I write to "Gemfile" with:
"""
source "http://rubygems.org"
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
"""
And I successfully run "bundle install --local"
And I comment out the gem "turn" from the Gemfile
And I append gems from Appraisal Gemfile
And I reset Bundler environment variable
And I successfully run `bundle install --local`
}
end

When /^I configure the application to use "([^\"]+)" from this project$/ do |name|
append_to_gemfile "gem '#{name}', :path => '#{PROJECT_ROOT}'"
steps %{And I run "bundle install --local"}
steps %{And I run `bundle install --local`}
end

When /^I run the rspec generator$/ do
steps %{
When I successfully run "rails generate rspec:install"
When I successfully run `rails generate rspec:install`
}
end

When /^I configure the application to use rspec\-rails$/ do
append_to_gemfile "gem 'rspec-rails'"
steps %{And I run "bundle install --local"}
append_to_gemfile "gem 'rspec-rails', '~> 2.6.1.beta1'"
steps %{And I run `bundle install --local`}
end

When /^I configure the application to use shoulda-context$/ do
append_to_gemfile "gem 'shoulda-context', :git => 'git@github.com:thoughtbot/shoulda-context.git'"
steps %{And I run "bundle install --local"}
steps %{And I run `bundle install --local`}
end

When /^I configure a wildcard route$/ do
Expand All @@ -47,7 +57,25 @@
}
end

module AppendHelpers
When /^I append gems from Appraisal Gemfile$/ do
File.read(ENV['BUNDLE_GEMFILE']).split(/\n/).each do |line|
if line =~ /^gem "(?!rails|appraisal)/
append_to_gemfile line.strip
end
end
end

When /^I reset Bundler environment variable$/ do
BUNDLE_ENV_VARS.each do |key|
ENV[key] = nil
end
end

When /^I comment out the gem "([^"]*)" from the Gemfile$/ do |gemname|
comment_out_gem_in_gemfile gemname
end

module FileHelpers
def append_to(path, contents)
in_current_dir do
File.open(path, "a") do |file|
Expand All @@ -60,6 +88,14 @@ def append_to(path, contents)
def append_to_gemfile(contents)
append_to('Gemfile', contents)
end

def comment_out_gem_in_gemfile(gemname)
in_current_dir do
gemfile = File.read("Gemfile")
gemfile.sub!(/^(\s*)(gem\s*['"]#{gemname})/, "\\1# \\2")
File.open("Gemfile", 'w'){ |file| file.write(gemfile) }
end
end
end

World(AppendHelpers)
World(FileHelpers)
2 changes: 1 addition & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'aruba/cucumber'

Before do
@aruba_timeout_seconds = 15
@aruba_timeout_seconds = 30
end
8 changes: 8 additions & 0 deletions gemfiles/3.0.3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rails", "3.0.3"
gem "rake", "~> 0.8.7"

gemspec :path=>"../"
132 changes: 132 additions & 0 deletions gemfiles/3.0.3.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
PATH
remote: /home/mike/lib/shoulda-matchers
specs:
shoulda-matchers (1.0.0.beta3)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (= 3.0.3)
mail (~> 2.2.9)
actionpack (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.6)
tzinfo (~> 0.3.23)
activemodel (3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
appraisal (0.3.5)
aruba (~> 0.3.6)
bundler
rake
arel (2.0.10)
aruba (0.3.7)
childprocess (>= 0.1.9)
cucumber (>= 0.10.5)
rspec (>= 2.6.0)
builder (2.1.2)
childprocess (0.1.9)
ffi (~> 1.0.6)
columnize (0.3.3)
cucumber (0.10.7)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.4.0)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
ffi (1.0.9)
gherkin (2.4.1)
json (>= 1.4.6)
i18n (0.6.0)
json (1.5.3)
linecache (0.46)
rbx-require-relative (> 0.0.4)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mocha (0.9.12)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.3)
actionmailer (= 3.0.3)
actionpack (= 3.0.3)
activerecord (= 3.0.3)
activeresource (= 3.0.3)
activesupport (= 3.0.3)
bundler (~> 1.0)
railties (= 3.0.3)
railties (3.0.3)
actionpack (= 3.0.3)
activesupport (= 3.0.3)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rbx-require-relative (0.0.5)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
term-ansicolor (1.0.5)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.29)

PLATFORMS
ruby

DEPENDENCIES
appraisal (~> 0.3.4)
cucumber (~> 0.10.0)
mocha (~> 0.9.10)
rails (= 3.0.3)
rake (~> 0.8.7)
rspec-rails (~> 2.6.1.beta1)
ruby-debug (~> 0.10.4)
shoulda-matchers!
sqlite3-ruby (~> 1.3.2)
12 changes: 12 additions & 0 deletions gemfiles/3.1.0.rc1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "jquery-rails"
gem "uglifier"
gem "rails", "3.1.0.rc1"
gem "rake", "~> 0.8.7"
gem "coffee-script"
gem "sass"

gemspec :path=>"../"
Loading

0 comments on commit fdd127c

Please sign in to comment.