shoulda-context-1.2.0/0000755000004100000410000000000012316470655014674 5ustar www-datawww-datashoulda-context-1.2.0/Rakefile0000644000004100000410000000072212316470655016342 0ustar www-datawww-datarequire 'bundler/setup' require 'bundler/gem_tasks' require 'rake/testtask' require 'appraisal' $LOAD_PATH.unshift("lib") load 'tasks/shoulda.rake' Rake::TestTask.new do |t| t.libs << 'lib' << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = false end desc 'Test the plugin under all supported Rails versions.' task :all => ['appraisal:cleanup', 'appraisal:install'] do exec('rake appraisal test') end desc 'Default: run tests' task :default => [:all] shoulda-context-1.2.0/bin/0000755000004100000410000000000012316470655015444 5ustar www-datawww-datashoulda-context-1.2.0/bin/convert_to_should_syntax0000755000004100000410000000250512316470655022542 0ustar www-datawww-data#!/usr/bin/env ruby require 'fileutils' require 'tmpdir' TMP = Dir::tmpdir def usage(msg = nil) puts "Error: #{msg}" if msg puts if msg puts "Usage: #{File.basename(__FILE__)} normal_test_file.rb" puts puts "Will convert an existing test file with names like " puts puts " def test_should_do_stuff" puts " ..." puts " end" puts puts "to one using the new syntax: " puts puts " should \"be super cool\" do" puts " ..." puts " end" puts puts "A copy of the old file will be left under #{TMP} in case\nthis script just seriously screws up" puts exit (msg ? 2 : 0) end usage("Wrong number of arguments.") unless ARGV.size == 1 usage("Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to a writeable directory.") unless File.directory?(TMP) && File.writable?(TMP) file = ARGV.shift tmpfile = File.join(TMP, File.basename(file)) usage("File '#{file}' doesn't exist") unless File.exists?(file) FileUtils.cp(file, tmpfile) contents = File.read(tmpfile) contents.gsub!(/def test_should_(\S+)/) {|line| "should \"#{$1.tr('_', ' ')}\" do"} contents.gsub!(/def test_(\S+)/) {|line| "should \"RENAME ME: test #{$1.tr('_', ' ')}\" do"} File.open(file, 'w') { |f| f.write(contents) } puts "File '#{file}' has been converted to 'should' syntax. Old version has been stored in '#{tmpfile}'" shoulda-context-1.2.0/Gemfile0000644000004100000410000000004612316470655016167 0ustar www-datawww-datasource 'http://rubygems.org' gemspec shoulda-context-1.2.0/MIT-LICENSE0000644000004100000410000000211612316470655016330 0ustar www-datawww-dataCopyright (c) 2006-2013, Tammer Saleh, thoughtbot, inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. shoulda-context-1.2.0/.ruby-version0000644000004100000410000000001312316470655017333 0ustar www-datawww-data2.0.0-p247 shoulda-context-1.2.0/.travis.yml0000644000004100000410000000003112316470655016777 0ustar www-datawww-datarvm: - 1.9.3 - 2.0.0 shoulda-context-1.2.0/lib/0000755000004100000410000000000012316470655015442 5ustar www-datawww-datashoulda-context-1.2.0/lib/shoulda-context.rb0000644000004100000410000000003212316470655021103 0ustar www-datawww-datarequire "shoulda/context" shoulda-context-1.2.0/lib/shoulda/0000755000004100000410000000000012316470655017101 5ustar www-datawww-datashoulda-context-1.2.0/lib/shoulda/context/0000755000004100000410000000000012316470655020565 5ustar www-datawww-datashoulda-context-1.2.0/lib/shoulda/context/autoload_macros.rb0000644000004100000410000000361012316470655024266 0ustar www-datawww-datamodule Shoulda # :nodoc: # Call autoload_macros when you want to load test macros automatically in a non-Rails # project (it's done automatically for Rails projects). # You don't need to specify ROOT/test/shoulda_macros explicitly. Your custom macros # are loaded automatically when you call autoload_macros. # # The first argument is the path to you application's root directory. # All following arguments are directories relative to your root, which contain # shoulda_macros subdirectories. These directories support the same kinds of globs as the # Dir class. # # Basic usage (from a test_helper): # Shoulda.autoload_macros(File.dirname(__FILE__) + '/..') # will load everything in # - your_app/test/shoulda_macros # # To load vendored macros as well: # Shoulda.autoload_macros(APP_ROOT, 'vendor/*') # will load everything in # - APP_ROOT/vendor/*/shoulda_macros # - APP_ROOT/test/shoulda_macros # # To load macros in an app with a vendor directory laid out like Rails': # Shoulda.autoload_macros(APP_ROOT, 'vendor/{plugins,gems}/*') # or # Shoulda.autoload_macros(APP_ROOT, 'vendor/plugins/*', 'vendor/gems/*') # will load everything in # - APP_ROOT/vendor/plugins/*/shoulda_macros # - APP_ROOT/vendor/gems/*/shoulda_macros # - APP_ROOT/test/shoulda_macros # # If you prefer to stick testing dependencies away from your production dependencies: # Shoulda.autoload_macros(APP_ROOT, 'vendor/*', 'test/vendor/*') # will load everything in # - APP_ROOT/vendor/*/shoulda_macros # - APP_ROOT/test/vendor/*/shoulda_macros # - APP_ROOT/test/shoulda_macros def self.autoload_macros(root, *dirs) dirs << File.join('test') complete_dirs = dirs.map{|d| File.join(root, d, 'shoulda_macros')} all_files = complete_dirs.inject([]){ |files, dir| files + Dir[File.join(dir, '*.rb')] } all_files.each do |file| require file end end end shoulda-context-1.2.0/lib/shoulda/context/context.rb0000644000004100000410000003551412316470655022606 0ustar www-datawww-datamodule Shoulda module Context class << self def contexts # :nodoc: @contexts ||= [] end attr_writer :contexts def current_context # :nodoc: self.contexts.last end def add_context(context) # :nodoc: self.contexts.push(context) end def remove_context # :nodoc: self.contexts.pop end end module ClassMethods # == Should statements # # Should statements are just syntactic sugar over normal Test::Unit test # methods. A should block contains all the normal code and assertions # you're used to seeing, with the added benefit that they can be wrapped # inside context blocks (see below). # # === Example: # # class UserTest < Test::Unit::TestCase # # def setup # @user = User.new("John", "Doe") # end # # should "return its full name" # assert_equal 'John Doe', @user.full_name # end # # end # # ...will produce the following test: # * "test: User should return its full name. " # # Note: The part before should in the test name is gleamed from the name of the Test::Unit class. # # Should statements can also take a Proc as a :before option. This proc runs after any # parent context's setups but before the current context's setup. # # === Example: # # context "Some context" do # setup { puts("I run after the :before proc") } # # should "run a :before proc", :before => lambda { puts("I run before the setup") } do # assert true # end # end # # Should statements can also wrap matchers, making virtually any matcher # usable in a macro style. The matcher's description is used to generate a # test name and failure message, and the test will pass if the matcher # matches the subject. # # === Example: # # should validate_presence_of(:first_name).with_message(/gotta be there/) # def should(name_or_matcher, options = {}, &blk) if Shoulda::Context.current_context Shoulda::Context.current_context.should(name_or_matcher, options, &blk) else context_name = self.name.gsub(/Test/, "") if self.name context = Shoulda::Context::Context.new(context_name, self) do should(name_or_matcher, options, &blk) end context.build end end # Allows negative tests using matchers. The matcher's description is used # to generate a test name and negative failure message, and the test will # pass unless the matcher matches the subject. # # === Example: # # should_not set_the_flash def should_not(matcher) if Shoulda::Context.current_context Shoulda::Context.current_context.should_not(matcher) else context_name = self.name.gsub(/Test/, "") if self.name context = Shoulda::Context::Context.new(context_name, self) do should_not(matcher) end context.build end end # == Before statements # # Before statements are should statements that run before the current # context's setup. These are especially useful when setting expectations. # # === Example: # # class UserControllerTest < Test::Unit::TestCase # context "the index action" do # setup do # @users = [Factory(:user)] # User.stubs(:find).returns(@users) # end # # context "on GET" do # setup { get :index } # # should respond_with(:success) # # # runs before "get :index" # before_should "find all users" do # User.expects(:find).with(:all).returns(@users) # end # end # end # end def before_should(name, &blk) should(name, :before => blk) { assert true } end # Just like should, but never runs, and instead prints an 'X' in the Test::Unit output. def should_eventually(name, options = {}, &blk) context_name = self.name.gsub(/Test/, "") context = Shoulda::Context::Context.new(context_name, self) do should_eventually(name, &blk) end context.build end # == Contexts # # A context block groups should statements under a common set of setup/teardown methods. # Context blocks can be arbitrarily nested, and can do wonders for improving the maintainability # and readability of your test code. # # A context block can contain setup, should, should_eventually, and teardown blocks. # # class UserTest < Test::Unit::TestCase # context "A User instance" do # setup do # @user = User.find(:first) # end # # should "return its full name" # assert_equal 'John Doe', @user.full_name # end # end # end # # This code will produce the method "test: A User instance should return its full name. ". # # Contexts may be nested. Nested contexts run their setup blocks from out to in before each # should statement. They then run their teardown blocks from in to out after each should statement. # # class UserTest < Test::Unit::TestCase # context "A User instance" do # setup do # @user = User.find(:first) # end # # should "return its full name" # assert_equal 'John Doe', @user.full_name # end # # context "with a profile" do # setup do # @user.profile = Profile.find(:first) # end # # should "return true when sent :has_profile?" # assert @user.has_profile? # end # end # end # end # # This code will produce the following methods # * "test: A User instance should return its full name. " # * "test: A User instance with a profile should return true when sent :has_profile?. " # # Just like should statements, a context block can exist next to normal def test_the_old_way; end # tests. This means you do not have to fully commit to the context/should syntax in a test file. def context(name, &blk) if Shoulda::Context.current_context Shoulda::Context.current_context.context(name, &blk) else context = Shoulda::Context::Context.new(name, self, &blk) context.build end end # Returns the class being tested, as determined by the test class name. # # class UserTest; described_type; end # # => User def described_type @described_type ||= self.name. gsub(/Test$/, ''). split('::'). inject(Object) { |parent, local_name| parent.const_get(local_name) } end # Sets the return value of the subject instance method: # # class UserTest < Test::Unit::TestCase # subject { User.first } # # # uses the existing user # should validate_uniqueness_of(:email) # end def subject(&block) @subject_block = block end def subject_block # :nodoc: @subject_block ||= nil end end module InstanceMethods # Returns an instance of the class under test. # # class UserTest # should "be a user" do # assert_kind_of User, subject # passes # end # end # # The subject can be explicitly set using the subject class method: # # class UserTest # subject { User.first } # should "be an existing user" do # assert !subject.new_record? # uses the first user # end # end # # The subject is used by all macros that require an instance of the class # being tested. def subject @shoulda_subject ||= construct_subject end def subject_block # :nodoc: (@shoulda_context && @shoulda_context.subject_block) || self.class.subject_block end def get_instance_of(object_or_klass) # :nodoc: if object_or_klass.is_a?(Class) object_or_klass.new else object_or_klass end end def instance_variable_name_for(klass) # :nodoc: klass.to_s.split('::').last.underscore end private def construct_subject if subject_block instance_eval(&subject_block) else get_instance_of(self.class.described_type) end end end class Context # :nodoc: attr_accessor :name # my name attr_accessor :parent # may be another context, or the original test::unit class. attr_accessor :subcontexts # array of contexts nested under myself attr_accessor :setup_blocks # blocks given via setup methods attr_accessor :teardown_blocks # blocks given via teardown methods attr_accessor :shoulds # array of hashes representing the should statements attr_accessor :should_eventuallys # array of hashes representing the should eventually statements # accessor with cache def subject_block return @subject_block if @subject_block parent.subject_block end attr_writer :subject_block def initialize(name, parent, &blk) Shoulda::Context.add_context(self) self.name = name self.parent = parent self.setup_blocks = [] self.teardown_blocks = [] self.shoulds = [] self.should_eventuallys = [] self.subcontexts = [] self.subject_block = nil if block_given? merge_block(&blk) else merge_block { warn " * WARNING: Block missing for context '#{full_name}'" } end Shoulda::Context.remove_context end def merge_block(&blk) if self.respond_to?(:instance_exec) self.instance_exec(&blk) else # deprecated in Rails 4.x blk.bind(self).call end end def context(name, &blk) self.subcontexts << Context.new(name, self, &blk) end def setup(&blk) self.setup_blocks << blk end def teardown(&blk) self.teardown_blocks << blk end def should(name_or_matcher, options = {}, &blk) if name_or_matcher.respond_to?(:description) && name_or_matcher.respond_to?(:matches?) name = name_or_matcher.description blk = lambda { assert_accepts name_or_matcher, subject } else name = name_or_matcher end if blk self.shoulds << { :name => name, :before => options[:before], :block => blk } else self.should_eventuallys << { :name => name } end end def should_not(matcher) name = matcher.description blk = lambda { assert_rejects matcher, subject } self.shoulds << { :name => "not #{name}", :block => blk } end def should_eventually(name, &blk) self.should_eventuallys << { :name => name, :block => blk } end def subject(&block) self.subject_block = block end def full_name parent_name = parent.full_name if am_subcontext? return [parent_name, name].join(" ").strip end def am_subcontext? parent.is_a?(self.class) # my parent is the same class as myself. end def test_unit_class am_subcontext? ? parent.test_unit_class : parent end def test_methods @test_methods ||= Hash.new { |h,k| h[k] = Hash[k.instance_methods.map { |n| [n, true] }] } end def create_test_from_should_hash(should) test_name = [test_name_prefix, full_name, "should", "#{should[:name]}. "].flatten.join(' ').to_sym if test_methods[test_unit_class][test_name.to_s] then raise DuplicateTestError, "'#{test_name}' is defined more than once." end test_methods[test_unit_class][test_name.to_s] = true context = self test_unit_class.send(:define_method, test_name) do @shoulda_context = context begin context.run_parent_setup_blocks(self) if should[:before] if self.respond_to?(:instance_exec) self.instance_exec(&should[:before]) else # deprecated in Rails 4.x should[:before].bind(self).call end end context.run_current_setup_blocks(self) if self.respond_to?(:instance_exec) self.instance_exec(&should[:block]) else # deprecated in Rails 4.x should[:block].bind(self).call end ensure context.run_all_teardown_blocks(self) end end end def run_all_setup_blocks(binding) run_parent_setup_blocks(binding) run_current_setup_blocks(binding) end def run_parent_setup_blocks(binding) self.parent.run_all_setup_blocks(binding) if am_subcontext? end def run_current_setup_blocks(binding) setup_blocks.each do |setup_block| if binding.respond_to?(:instance_exec) binding.instance_exec(&setup_block) else # deprecated in Rails 4.x setup_block.bind(binding).call end end end def run_all_teardown_blocks(binding) teardown_blocks.reverse.each do |teardown_block| if binding.respond_to?(:instance_exec) binding.instance_exec(&teardown_block) else # deprecated in Rails 4.x teardown_block.bind(binding).call end end self.parent.run_all_teardown_blocks(binding) if am_subcontext? end def print_should_eventuallys should_eventuallys.each do |should| test_name = [full_name, "should", "#{should[:name]}. "].flatten.join(' ') puts " * DEFERRED: " + test_name end end def build shoulds.each do |should| create_test_from_should_hash(should) end subcontexts.each { |context| context.build } print_should_eventuallys end def test_name_prefix if defined?(Minitest) || defined?(MiniTest) 'test_:' else 'test:' end end def method_missing(method, *args, &blk) test_unit_class.send(method, *args, &blk) end end end end class DuplicateTestError < RuntimeError; end shoulda-context-1.2.0/lib/shoulda/context/version.rb0000644000004100000410000000010712316470655022575 0ustar www-datawww-datamodule Shoulda module Context VERSION = '1.2.0'.freeze end end shoulda-context-1.2.0/lib/shoulda/context/proc_extensions.rb0000644000004100000410000000056512316470655024342 0ustar www-datawww-data# Stolen straight from ActiveSupport class Proc #:nodoc: def bind(object) block, time = self, Time.now (class << object; self end).class_eval do method_name = "__bind_#{time.to_i}_#{time.usec}" define_method(method_name, &block) method = instance_method(method_name) remove_method(method_name) method end.bind(object) end end shoulda-context-1.2.0/lib/shoulda/context/tasks/0000755000004100000410000000000012316470655021712 5ustar www-datawww-datashoulda-context-1.2.0/lib/shoulda/context/tasks/yaml_to_shoulda.rake0000644000004100000410000000161312316470655025742 0ustar www-datawww-datanamespace :shoulda do # From http://blog.internautdesign.com/2007/11/2/a-yaml_to_shoulda-rake-task # David.Lowenfels@gmail.com desc "Converts a YAML file (FILE=./path/to/yaml) into a Shoulda skeleton" task :from_yaml do require 'yaml' def yaml_to_context(hash, indent = 0) indent1 = ' ' * indent indent2 = ' ' * (indent + 1) hash.each_pair do |context, shoulds| puts indent1 + "context \"#{context}\" do" puts shoulds.each do |should| yaml_to_context( should, indent + 1 ) and next if should.is_a?( Hash ) puts indent2 + "should_eventually \"" + should.gsub(/^should +/,'') + "\" do" puts indent2 + "end" puts end puts indent1 + "end" end end puts("Please pass in a FILE argument.") and exit unless ENV['FILE'] yaml_to_context( YAML.load_file( ENV['FILE'] ) ) end end shoulda-context-1.2.0/lib/shoulda/context/tasks/list_tests.rake0000644000004100000410000000150412316470655024753 0ustar www-datawww-datanamespace :shoulda do desc "List the names of the test methods in a specification like format" task :list do $LOAD_PATH.unshift("test") require 'test/unit' require 'rubygems' require 'active_support' # bug in test unit. Set to true to stop from running. Test::Unit.run = true test_files = Dir.glob(File.join('test', '**', '*_test.rb')) test_files.each do |file| load file klass = File.basename(file, '.rb').classify unless Object.const_defined?(klass.to_s) puts "Skipping #{klass} because it doesn't map to a Class" next end klass = klass.constantize puts klass.name.gsub('Test', '') test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort test_methods.each {|m| puts " " + m } end end end shoulda-context-1.2.0/lib/shoulda/context/test_framework_detection.rb0000644000004100000410000000152512316470655026207 0ustar www-datawww-datamodule Shoulda module Context module TestFrameworkDetection def self.possible_test_frameworks [ -> { ActiveSupport::TestCase }, -> { Minitest::Test }, -> { MiniTest::Unit::TestCase }, -> { Test::Unit::TestCase } ] end def self.resolve_framework(future_framework) future_framework.call rescue NameError nil end def self.detected_test_framework_test_cases possible_test_frameworks. map { |future_framework| resolve_framework(future_framework) }. compact end def self.test_framework_test_cases @_test_framework_test_case ||= detected_test_framework_test_cases end end def self.test_framework_test_cases TestFrameworkDetection.test_framework_test_cases end end end shoulda-context-1.2.0/lib/shoulda/context/assertions.rb0000644000004100000410000000762312316470655023314 0ustar www-datawww-datamodule Shoulda # :nodoc: module Context module Assertions # Asserts that two arrays contain the same elements, the same number of times. Essentially ==, but unordered. # # assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes def assert_same_elements(a1, a2, msg = nil) [:select, :inject, :size].each do |m| [a1, a2].each {|a| assert_respond_to(a, m, "Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.") } end assert a1h = a1.inject({}) { |h,e| h[e] ||= a1.select { |i| i == e }.size; h } assert a2h = a2.inject({}) { |h,e| h[e] ||= a2.select { |i| i == e }.size; h } assert_equal(a1h, a2h, msg) end # Asserts that the given collection contains item x. If x is a regular expression, ensure that # at least one element from the collection matches x. +extra_msg+ is appended to the error message if the assertion fails. # # assert_contains(['a', '1'], /\d/) => passes # assert_contains(['a', '1'], 'a') => passes # assert_contains(['a', '1'], /not there/) => fails def assert_contains(collection, x, extra_msg = "") collection = Array(collection) msg = "#{x.inspect} not found in #{collection.to_a.inspect} #{extra_msg}" case x when Regexp assert(collection.detect { |e| e =~ x }, msg) else assert(collection.include?(x), msg) end end # Asserts that the given collection does not contain item x. If x is a regular expression, ensure that # none of the elements from the collection match x. def assert_does_not_contain(collection, x, extra_msg = "") collection = Array(collection) msg = "#{x.inspect} found in #{collection.to_a.inspect} " + extra_msg case x when Regexp assert(!collection.detect { |e| e =~ x }, msg) else assert(!collection.include?(x), msg) end end # Asserts that the given matcher returns true when +target+ is passed to #matches? def assert_accepts(matcher, target, options = {}) if matcher.respond_to?(:in_context) matcher.in_context(self) end if matcher.matches?(target) safe_assert_block { true } if options[:message] message = matcher.respond_to?(:failure_message_for_should_not) ? matcher.failure_message_for_should_not : matcher.negative_failure_message assert_match options[:message], message end else message = matcher.respond_to?(:failure_message_for_should) ? matcher.failure_message_for_should : matcher.failure_message safe_assert_block(message) { false } end end # Asserts that the given matcher returns true when +target+ is passed to #does_not_match? # or false when +target+ is passed to #matches? if #does_not_match? is not implemented def assert_rejects(matcher, target, options = {}) if matcher.respond_to?(:in_context) matcher.in_context(self) end not_match = matcher.respond_to?(:does_not_match?) ? matcher.does_not_match?(target) : !matcher.matches?(target) if not_match safe_assert_block { true } if options[:message] message = matcher.respond_to?(:failure_message_for_should) ? matcher.failure_message_for_should : matcher.failure_message assert_match options[:message], message end else message = matcher.respond_to?(:failure_message_for_should_not) ? matcher.failure_message_for_should_not : matcher.negative_failure_message safe_assert_block(message) { false } end end def safe_assert_block(message = "assert_block failed.", &block) if respond_to?(:assert_block) assert_block message, &block else assert yield, message end end end end end shoulda-context-1.2.0/lib/shoulda/context/tasks.rb0000644000004100000410000000012312316470655022233 0ustar www-datawww-dataDir[File.join(File.dirname(__FILE__), 'tasks', '*.rake')].each do |f| load f end shoulda-context-1.2.0/lib/shoulda/context.rb0000644000004100000410000000113312316470655021110 0ustar www-datawww-datarequire 'shoulda/context/test_framework_detection' require 'shoulda/context/version' require 'shoulda/context/proc_extensions' require 'shoulda/context/assertions' require 'shoulda/context/context' require 'shoulda/context/autoload_macros' module ShouldaContextLoadable def self.included(base) base.class_eval do include Shoulda::Context::Assertions include Shoulda::Context::InstanceMethods end base.extend(Shoulda::Context::ClassMethods) end end Shoulda::Context.test_framework_test_cases.each do |test_case| test_case.class_eval { include ShouldaContextLoadable } end shoulda-context-1.2.0/gemfiles/0000755000004100000410000000000012316470655016467 5ustar www-datawww-datashoulda-context-1.2.0/gemfiles/rails_4_1.gemfile0000644000004100000410000000031012316470655021570 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "rails", :github=>"rails/rails", :branch=>"4-1-stable" gem "jquery-rails" gem "sass-rails" gem "sqlite3" gemspec :path=>"../"shoulda-context-1.2.0/gemfiles/rails_3_1.gemfile.lock0000644000004100000410000000456612316470655022537 0ustar www-datawww-dataPATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: actionmailer (3.1.12) actionpack (= 3.1.12) mail (~> 2.4.4) actionpack (3.1.12) activemodel (= 3.1.12) activesupport (= 3.1.12) builder (~> 3.0.0) erubis (~> 2.7.0) i18n (~> 0.6) rack (~> 1.3.6) rack-cache (~> 1.2) rack-mount (~> 0.8.2) rack-test (~> 0.6.1) sprockets (~> 2.0.4) activemodel (3.1.12) activesupport (= 3.1.12) builder (~> 3.0.0) i18n (~> 0.6) activerecord (3.1.12) activemodel (= 3.1.12) activesupport (= 3.1.12) arel (~> 2.2.3) tzinfo (~> 0.3.29) activeresource (3.1.12) activemodel (= 3.1.12) activesupport (= 3.1.12) activesupport (3.1.12) multi_json (~> 1.0) appraisal (0.5.2) bundler rake arel (2.2.3) builder (3.0.4) erubis (2.7.0) hike (1.2.3) i18n (0.6.9) jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) mocha (0.9.12) multi_json (1.9.2) polyglot (0.3.4) rack (1.3.10) rack-cache (1.2) rack (>= 0.4) rack-mount (0.8.3) rack (>= 1.0.0) rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) rails (3.1.12) actionmailer (= 3.1.12) actionpack (= 3.1.12) activerecord (= 3.1.12) activeresource (= 3.1.12) activesupport (= 3.1.12) bundler (~> 1.0) railties (= 3.1.12) railties (3.1.12) actionpack (= 3.1.12) activesupport (= 3.1.12) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) rake (10.2.1) rdoc (3.12.2) json (~> 1.4) sass (3.3.4) sass-rails (3.1.0) actionpack (~> 3.1.0) railties (~> 3.1.0) sass (>= 3.1.4) sprockets (2.0.4) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.9) test-unit (2.1.2) thor (0.14.6) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) jquery-rails mocha (~> 0.9.10) rails (~> 3.1.0) rake sass-rails shoulda-context! sqlite3 test-unit (~> 2.1.0) shoulda-context-1.2.0/gemfiles/minitest_4_x.gemfile0000644000004100000410000000016412316470655022430 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "minitest", "~> 4.0" gemspec :path=>"../"shoulda-context-1.2.0/gemfiles/test_unit.gemfile.lock0000644000004100000410000000403012316470655022763 0ustar www-datawww-dataPATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: actionmailer (4.0.3) actionpack (= 4.0.3) mail (~> 2.5.4) actionpack (4.0.3) activesupport (= 4.0.3) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) activemodel (4.0.3) activesupport (= 4.0.3) builder (~> 3.1.0) activerecord (4.0.3) activemodel (= 4.0.3) activerecord-deprecated_finders (~> 1.0.2) activesupport (= 4.0.3) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) activesupport (4.0.3) i18n (~> 0.6, >= 0.6.4) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) appraisal (0.5.2) bundler rake arel (4.0.2) atomic (1.1.16) builder (3.1.4) erubis (2.7.0) hike (1.2.3) i18n (0.6.9) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) minitest (4.7.5) mocha (0.9.12) multi_json (1.9.2) polyglot (0.3.4) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) rails (4.0.3) actionmailer (= 4.0.3) actionpack (= 4.0.3) activerecord (= 4.0.3) activesupport (= 4.0.3) bundler (>= 1.3.0, < 2.0) railties (= 4.0.3) sprockets-rails (~> 2.0.0) railties (4.0.3) actionpack (= 4.0.3) activesupport (= 4.0.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.2.1) sprockets (2.12.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sprockets-rails (2.0.1) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) test-unit (2.5.5) thor (0.19.1) thread_safe (0.3.1) atomic (>= 1.1.7, < 2) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) mocha (~> 0.9.10) rails (>= 3.0) rake shoulda-context! test-unit shoulda-context-1.2.0/gemfiles/rails_3_0.gemfile.lock0000644000004100000410000000367312316470655022534 0ustar www-datawww-dataPATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: abstract (1.0.0) actionmailer (3.0.20) actionpack (= 3.0.20) mail (~> 2.2.19) actionpack (3.0.20) activemodel (= 3.0.20) activesupport (= 3.0.20) builder (~> 2.1.2) erubis (~> 2.6.6) i18n (~> 0.5.0) rack (~> 1.2.5) rack-mount (~> 0.6.14) rack-test (~> 0.5.7) tzinfo (~> 0.3.23) activemodel (3.0.20) activesupport (= 3.0.20) builder (~> 2.1.2) i18n (~> 0.5.0) activerecord (3.0.20) activemodel (= 3.0.20) activesupport (= 3.0.20) arel (~> 2.0.10) tzinfo (~> 0.3.23) activeresource (3.0.20) activemodel (= 3.0.20) activesupport (= 3.0.20) activesupport (3.0.20) appraisal (0.5.2) bundler rake arel (2.0.10) builder (2.1.2) erubis (2.6.6) abstract (>= 1.0.0) i18n (0.5.3) json (1.8.1) mail (2.2.20) activesupport (>= 2.3.6) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) mocha (0.9.12) polyglot (0.3.4) rack (1.2.8) rack-mount (0.6.14) rack (>= 1.0.0) rack-test (0.5.7) rack (>= 1.0) rails (3.0.20) actionmailer (= 3.0.20) actionpack (= 3.0.20) activerecord (= 3.0.20) activeresource (= 3.0.20) activesupport (= 3.0.20) bundler (~> 1.0) railties (= 3.0.20) railties (3.0.20) actionpack (= 3.0.20) activesupport (= 3.0.20) rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.4) rake (10.2.1) rdoc (3.12.2) json (~> 1.4) sqlite3 (1.3.9) test-unit (2.1.2) thor (0.14.6) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) mocha (~> 0.9.10) rails (~> 3.0.0) rake shoulda-context! sqlite3 test-unit (~> 2.1.0) shoulda-context-1.2.0/gemfiles/minitest_5_x.gemfile0000644000004100000410000000016412316470655022431 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "minitest", "~> 5.0" gemspec :path=>"../"shoulda-context-1.2.0/gemfiles/minitest_4_x.gemfile.lock0000644000004100000410000000406712316470655023365 0ustar www-datawww-dataPATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: actionmailer (4.0.3) actionpack (= 4.0.3) mail (~> 2.5.4) actionpack (4.0.3) activesupport (= 4.0.3) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) activemodel (4.0.3) activesupport (= 4.0.3) builder (~> 3.1.0) activerecord (4.0.3) activemodel (= 4.0.3) activerecord-deprecated_finders (~> 1.0.2) activesupport (= 4.0.3) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) activesupport (4.0.3) i18n (~> 0.6, >= 0.6.4) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) appraisal (0.5.2) bundler rake arel (4.0.2) atomic (1.1.16) builder (3.1.4) erubis (2.7.0) hike (1.2.3) i18n (0.6.9) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) minitest (4.7.5) mocha (0.9.12) multi_json (1.9.2) polyglot (0.3.4) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) rails (4.0.3) actionmailer (= 4.0.3) actionpack (= 4.0.3) activerecord (= 4.0.3) activesupport (= 4.0.3) bundler (>= 1.3.0, < 2.0) railties (= 4.0.3) sprockets-rails (~> 2.0.0) railties (4.0.3) actionpack (= 4.0.3) activesupport (= 4.0.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.2.1) sprockets (2.12.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sprockets-rails (2.0.1) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) test-unit (2.1.2) thor (0.19.1) thread_safe (0.3.1) atomic (>= 1.1.7, < 2) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) minitest (~> 4.0) mocha (~> 0.9.10) rails (>= 3.0) rake shoulda-context! test-unit (~> 2.1.0) shoulda-context-1.2.0/gemfiles/rails_4_0.gemfile.lock0000644000004100000410000000446412316470655022534 0ustar www-datawww-dataPATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: actionmailer (4.0.3) actionpack (= 4.0.3) mail (~> 2.5.4) actionpack (4.0.3) activesupport (= 4.0.3) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) activemodel (4.0.3) activesupport (= 4.0.3) builder (~> 3.1.0) activerecord (4.0.3) activemodel (= 4.0.3) activerecord-deprecated_finders (~> 1.0.2) activesupport (= 4.0.3) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) activesupport (4.0.3) i18n (~> 0.6, >= 0.6.4) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) appraisal (0.5.2) bundler rake arel (4.0.2) atomic (1.1.16) builder (3.1.4) erubis (2.7.0) hike (1.2.3) i18n (0.6.9) jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) minitest (4.7.5) mocha (0.9.12) multi_json (1.9.2) polyglot (0.3.4) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) rails (4.0.3) actionmailer (= 4.0.3) actionpack (= 4.0.3) activerecord (= 4.0.3) activesupport (= 4.0.3) bundler (>= 1.3.0, < 2.0) railties (= 4.0.3) sprockets-rails (~> 2.0.0) railties (4.0.3) actionpack (= 4.0.3) activesupport (= 4.0.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.2.1) sass (3.3.4) sass-rails (4.0.1) railties (>= 4.0.0, < 5.0) sass (>= 3.1.10) sprockets-rails (~> 2.0.0) sprockets (2.12.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sprockets-rails (2.0.1) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) sqlite3 (1.3.9) test-unit (2.1.2) thor (0.19.1) thread_safe (0.3.1) atomic (>= 1.1.7, < 2) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) jquery-rails mocha (~> 0.9.10) rails (~> 4.0.0) rake sass-rails shoulda-context! sqlite3 test-unit (~> 2.1.0) shoulda-context-1.2.0/gemfiles/minitest_5_x.gemfile.lock0000644000004100000410000000416612316470655023366 0ustar www-datawww-dataPATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: actionmailer (3.2.13) actionpack (= 3.2.13) mail (~> 2.5.3) actionpack (3.2.13) activemodel (= 3.2.13) activesupport (= 3.2.13) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) rack (~> 1.4.5) rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) activemodel (3.2.13) activesupport (= 3.2.13) builder (~> 3.0.0) activerecord (3.2.13) activemodel (= 3.2.13) activesupport (= 3.2.13) arel (~> 3.0.2) tzinfo (~> 0.3.29) activeresource (3.2.13) activemodel (= 3.2.13) activesupport (= 3.2.13) activesupport (3.2.13) i18n (= 0.6.1) multi_json (~> 1.0) appraisal (0.5.2) bundler rake arel (3.0.3) builder (3.0.4) erubis (2.7.0) hike (1.2.3) i18n (0.6.1) journey (1.0.4) json (1.8.1) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) minitest (5.3.1) mocha (0.9.12) multi_json (1.9.2) polyglot (0.3.4) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) rails (3.2.13) actionmailer (= 3.2.13) actionpack (= 3.2.13) activerecord (= 3.2.13) activeresource (= 3.2.13) activesupport (= 3.2.13) bundler (~> 1.0) railties (= 3.2.13) railties (3.2.13) actionpack (= 3.2.13) activesupport (= 3.2.13) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.2.1) rdoc (3.12.2) json (~> 1.4) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) test-unit (2.1.2) thor (0.19.1) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) minitest (~> 5.0) mocha (~> 0.9.10) rails (>= 3.0) rake shoulda-context! test-unit (~> 2.1.0) shoulda-context-1.2.0/gemfiles/test_unit.gemfile0000644000004100000410000000015312316470655022036 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "test-unit" gemspec :path=>"../"shoulda-context-1.2.0/gemfiles/rails_3_2.gemfile.lock0000644000004100000410000000451212316470655022527 0ustar www-datawww-dataPATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: actionmailer (3.2.13) actionpack (= 3.2.13) mail (~> 2.5.3) actionpack (3.2.13) activemodel (= 3.2.13) activesupport (= 3.2.13) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) rack (~> 1.4.5) rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) activemodel (3.2.13) activesupport (= 3.2.13) builder (~> 3.0.0) activerecord (3.2.13) activemodel (= 3.2.13) activesupport (= 3.2.13) arel (~> 3.0.2) tzinfo (~> 0.3.29) activeresource (3.2.13) activemodel (= 3.2.13) activesupport (= 3.2.13) activesupport (3.2.13) i18n (= 0.6.1) multi_json (~> 1.0) appraisal (0.5.2) bundler rake arel (3.0.3) builder (3.0.4) erubis (2.7.0) hike (1.2.3) i18n (0.6.1) journey (1.0.4) jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) mocha (0.9.12) multi_json (1.9.2) polyglot (0.3.4) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) rails (3.2.13) actionmailer (= 3.2.13) actionpack (= 3.2.13) activerecord (= 3.2.13) activeresource (= 3.2.13) activesupport (= 3.2.13) bundler (~> 1.0) railties (= 3.2.13) railties (3.2.13) actionpack (= 3.2.13) activesupport (= 3.2.13) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.2.1) rdoc (3.12.2) json (~> 1.4) sass (3.3.4) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.9) test-unit (2.1.2) thor (0.19.1) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.38) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) jquery-rails mocha (~> 0.9.10) rails (~> 3.2.0) rake sass-rails shoulda-context! sqlite3 test-unit (~> 2.1.0) shoulda-context-1.2.0/gemfiles/rails_4_1.gemfile.lock0000644000004100000410000000517612316470655022536 0ustar www-datawww-dataGIT remote: git://github.com/rails/rails.git revision: 5ac4d6e8dd6f11b3291ce85d455ab5aff0abdbfe branch: 4-1-stable specs: actionmailer (4.1.0.rc1) actionpack (= 4.1.0.rc1) actionview (= 4.1.0.rc1) mail (~> 2.5.4) actionpack (4.1.0.rc1) actionview (= 4.1.0.rc1) activesupport (= 4.1.0.rc1) rack (~> 1.5.2) rack-test (~> 0.6.2) actionview (4.1.0.rc1) activesupport (= 4.1.0.rc1) builder (~> 3.1) erubis (~> 2.7.0) activemodel (4.1.0.rc1) activesupport (= 4.1.0.rc1) builder (~> 3.1) activerecord (4.1.0.rc1) activemodel (= 4.1.0.rc1) activesupport (= 4.1.0.rc1) arel (~> 5.0.0) activesupport (4.1.0.rc1) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) rails (4.1.0.rc1) actionmailer (= 4.1.0.rc1) actionpack (= 4.1.0.rc1) actionview (= 4.1.0.rc1) activemodel (= 4.1.0.rc1) activerecord (= 4.1.0.rc1) activesupport (= 4.1.0.rc1) bundler (>= 1.3.0, < 2.0) railties (= 4.1.0.rc1) sprockets-rails (~> 2.0.0) railties (4.1.0.rc1) actionpack (= 4.1.0.rc1) activesupport (= 4.1.0.rc1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) PATH remote: ../ specs: shoulda-context (1.1.6) GEM remote: http://rubygems.org/ specs: appraisal (0.5.2) bundler rake arel (5.0.0) atomic (1.1.16) builder (3.2.2) erubis (2.7.0) hike (1.2.3) i18n (0.6.9) jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) minitest (5.3.1) mocha (0.9.12) multi_json (1.9.2) polyglot (0.3.4) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) rake (10.2.1) sass (3.3.4) sass-rails (4.0.1) railties (>= 4.0.0, < 5.0) sass (>= 3.1.10) sprockets-rails (~> 2.0.0) sprockets (2.12.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sprockets-rails (2.0.1) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) sqlite3 (1.3.9) test-unit (2.1.2) thor (0.19.1) thread_safe (0.3.1) atomic (>= 1.1.7, < 2) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (1.1.0) thread_safe (~> 0.1) PLATFORMS ruby DEPENDENCIES appraisal (~> 0.5) jquery-rails mocha (~> 0.9.10) rails! rake sass-rails shoulda-context! sqlite3 test-unit (~> 2.1.0) shoulda-context-1.2.0/gemfiles/rails_3_0.gemfile0000644000004100000410000000020112316470655021565 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "rails", "~> 3.0.0" gem "sqlite3" gemspec :path=>"../"shoulda-context-1.2.0/gemfiles/rails_3_2.gemfile0000644000004100000410000000024512316470655021577 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "rails", "~> 3.2.0" gem "jquery-rails" gem "sass-rails" gem "sqlite3" gemspec :path=>"../"shoulda-context-1.2.0/gemfiles/rails_4_0.gemfile0000644000004100000410000000024512316470655021576 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "rails", "~> 4.0.0" gem "jquery-rails" gem "sass-rails" gem "sqlite3" gemspec :path=>"../"shoulda-context-1.2.0/gemfiles/rails_3_1.gemfile0000644000004100000410000000024512316470655021576 0ustar www-datawww-data# This file was generated by Appraisal source "http://rubygems.org" gem "rails", "~> 3.1.0" gem "jquery-rails" gem "sass-rails" gem "sqlite3" gemspec :path=>"../"shoulda-context-1.2.0/metadata.yml0000644000004100000410000001165512316470655017207 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: shoulda-context version: !ruby/object:Gem::Version version: 1.2.0 platform: ruby authors: - thoughtbot, inc. - Tammer Saleh - Joe Ferris - Ryan McGeary - Dan Croak - Matt Jankowski autorequire: bindir: bin cert_chain: [] date: 2014-03-31 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: appraisal requirement: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: '0.5' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: '0.5' - !ruby/object:Gem::Dependency name: rails requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '3.0' - !ruby/object:Gem::Dependency name: mocha requirement: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: 0.9.10 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: 0.9.10 - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: test-unit requirement: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: 2.1.0 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: 2.1.0 description: Context framework extracted from Shoulda email: support@thoughtbot.com executables: - convert_to_should_syntax extensions: [] extra_rdoc_files: [] files: - .gitignore - .ruby-version - .travis.yml - Appraisals - CONTRIBUTING.md - Gemfile - MIT-LICENSE - README.md - Rakefile - bin/convert_to_should_syntax - gemfiles/minitest_4_x.gemfile - gemfiles/minitest_4_x.gemfile.lock - gemfiles/minitest_5_x.gemfile - gemfiles/minitest_5_x.gemfile.lock - gemfiles/rails_3_0.gemfile - gemfiles/rails_3_0.gemfile.lock - gemfiles/rails_3_1.gemfile - gemfiles/rails_3_1.gemfile.lock - gemfiles/rails_3_2.gemfile - gemfiles/rails_3_2.gemfile.lock - gemfiles/rails_4_0.gemfile - gemfiles/rails_4_0.gemfile.lock - gemfiles/rails_4_1.gemfile - gemfiles/rails_4_1.gemfile.lock - gemfiles/test_unit.gemfile - gemfiles/test_unit.gemfile.lock - init.rb - lib/shoulda-context.rb - lib/shoulda/context.rb - lib/shoulda/context/assertions.rb - lib/shoulda/context/autoload_macros.rb - lib/shoulda/context/context.rb - lib/shoulda/context/proc_extensions.rb - lib/shoulda/context/tasks.rb - lib/shoulda/context/tasks/list_tests.rake - lib/shoulda/context/tasks/yaml_to_shoulda.rake - lib/shoulda/context/test_framework_detection.rb - lib/shoulda/context/version.rb - rails/init.rb - shoulda-context.gemspec - tasks/shoulda.rake - test/fake_rails_root/test/shoulda_macros/custom_macro.rb - test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb - test/fake_rails_root/vendor/plugins/.keep - test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb - test/shoulda/autoload_macro_test.rb - test/shoulda/context_test.rb - test/shoulda/convert_to_should_syntax_test.rb - test/shoulda/helpers_test.rb - test/shoulda/should_test.rb - test/shoulda/test_framework_detection_test.rb - test/test_helper.rb homepage: http://thoughtbot.com/community/ licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.0.3 signing_key: specification_version: 4 summary: Context framework extracted from Shoulda test_files: - test/fake_rails_root/test/shoulda_macros/custom_macro.rb - test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb - test/fake_rails_root/vendor/plugins/.keep - test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb - test/shoulda/autoload_macro_test.rb - test/shoulda/context_test.rb - test/shoulda/convert_to_should_syntax_test.rb - test/shoulda/helpers_test.rb - test/shoulda/should_test.rb - test/shoulda/test_framework_detection_test.rb - test/test_helper.rb shoulda-context-1.2.0/test/0000755000004100000410000000000012316470655015653 5ustar www-datawww-datashoulda-context-1.2.0/test/shoulda/0000755000004100000410000000000012316470655017312 5ustar www-datawww-datashoulda-context-1.2.0/test/shoulda/context_test.rb0000644000004100000410000002024212316470655022362 0ustar www-datawww-datarequire 'test_helper' class ContextTest < Test::Unit::TestCase # :nodoc: def self.context_macro(&blk) context "with a subcontext made by a macro" do setup { @context_macro = :foo } merge_block(&blk) end end context "context with setup block" do setup do @blah = "blah" end should "run the setup block" do assert_equal "blah", @blah end should "have name set right" do assert_match(/^test: context with setup block/, self.to_s) end context "and a subcontext" do setup do @blah = "#{@blah} twice" end should "be named correctly" do assert_match(/^test: context with setup block and a subcontext should be named correctly/, self.to_s) end should "run the setup blocks in order" do assert_equal @blah, "blah twice" end end context_macro do should "have name set right" do assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, self.to_s) end should "run the setup block of that context macro" do assert_equal :foo, @context_macro end should "run the setup block of the main context" do assert_equal "blah", @blah end end end context "another context with setup block" do setup do @blah = "foo" end should "have @blah == 'foo'" do assert_equal "foo", @blah end should "have name set right" do assert_match(/^test: another context with setup block/, self.to_s) end end context "context with method definition" do setup do def hello; "hi"; end end should "be able to read that method" do assert_equal "hi", hello end should "have name set right" do assert_match(/^test: context with method definition/, self.to_s) end end context "another context" do should "not define @blah" do assert !instance_variable_defined?(:@blah) end end context "context with multiple setups and/or teardowns" do cleanup_count = 0 2.times do |i| setup { cleanup_count += 1 } teardown { cleanup_count -= 1 } end 2.times do |i| should "call all setups and all teardowns (check ##{i + 1})" do assert_equal 2, cleanup_count end end context "subcontexts" do 2.times do |i| setup { cleanup_count += 1 } teardown { cleanup_count -= 1 } end 2.times do |i| should "also call all setups and all teardowns in parent and subcontext (check ##{i + 1})" do assert_equal 4, cleanup_count end end end end should_eventually "pass, since it's unimplemented" do flunk "what?" end should_eventually "not require a block when using should_eventually" should "pass without a block, as that causes it to piggyback to should_eventually" context "context for testing should piggybacking" do should "call should_eventually as we are not passing a block" end context "context" do context "with nested subcontexts" do should_eventually "only print this statement once for a should_eventually" end end class ::SomeModel; end context "given a test named after a class" do setup do self.class.stubs(:name).returns("SomeModelTest") end should "determine the described type" do assert_equal SomeModel, self.class.described_type end should "return a new instance of the described type as the subject if none exists" do assert_kind_of SomeModel, subject end context "with an explicit subject block" do setup { @expected = SomeModel.new } subject { @expected } should "return the result of the block as the subject" do assert_equal @expected, subject end context "nested context block without a subject block" do should "return the result of the parent context's subject block" do assert_equal @expected, subject end end end end end class ::Some class NestedModel; end end class Some::NestedModelTest < Test::Unit::TestCase should "determine the described type for a nested model" do assert_equal Some::NestedModel, self.class.described_type end end class ShouldMatcherTest < Test::Unit::TestCase class FakeMatcher attr_reader :subject attr_accessor :fail def description "do something" end def matches?(subject) @subject = subject !@fail end def failure_message_for_should "failure message for should" end def failure_message_for_should_not "failure message for should not" end end def run_test_suite @test_suite.run(@test_result) { |event, name| } end def setup @matcher = FakeMatcher.new @test_result = Test::Unit::TestResult.new class << @test_result def failure_messages @failures.map { |failure| failure.message } end end end def create_test_suite(&definition) test_class = Class.new(Test::Unit::TestCase, &definition) test_class.suite end def assert_failed_with(message, test_result) assert_equal 1, test_result.failure_count assert_equal [message], test_result.failure_messages end def assert_passed(test_result) assert_equal 0, test_result.failure_count end def assert_test_named(expected_name, test_suite) name = test_suite.tests.map { |test| test.method_name }.first assert name.include?(expected_name), "Expected #{name} to include #{expected_name}" end def self.should_use_positive_matcher should "generate a test using the matcher's description" do assert_test_named "should #{@matcher.description}", @test_suite end should "pass with a passing matcher" do @matcher.fail = false run_test_suite assert_passed @test_result end should "fail with a failing matcher" do @matcher.fail = true run_test_suite assert_failed_with "failure message for should", @test_result end should "provide the subject" do @matcher.fail = false run_test_suite assert_equal 'a subject', @matcher.subject end end def self.should_use_negative_matcher should "generate a test using the matcher's description" do assert_test_named "should not #{@matcher.description}", @test_suite end should "pass with a failing matcher" do @matcher.fail = true run_test_suite assert_passed @test_result end should "fail with a passing matcher" do @matcher.fail = false run_test_suite assert_failed_with "failure message for should not", @test_result end should "provide the subject" do @matcher.fail = false run_test_suite assert_equal 'a subject', @matcher.subject end end context "a should block with a matcher" do setup do matcher = @matcher @test_suite = create_test_suite do subject { 'a subject' } should matcher end end should_use_positive_matcher end context "a should block with a matcher within a context" do setup do matcher = @matcher @test_suite = create_test_suite do context "in context" do subject { 'a subject' } should matcher end end end should_use_positive_matcher end context "a should_not block with a matcher" do setup do matcher = @matcher @test_suite = create_test_suite do subject { 'a subject' } should_not matcher end end should_use_negative_matcher end context "a should_not block with a matcher within a context" do setup do matcher = @matcher @test_suite = create_test_suite do context "in context" do subject { 'a subject' } should_not matcher end end end should_use_negative_matcher end end class Subject; end class SubjectTest < Test::Unit::TestCase def setup @expected = Subject.new end subject { @expected } should "return a specified subject" do assert_equal @expected, subject end end class SubjectLazinessTest < Test::Unit::TestCase subject { Subject.new } should "only build the subject once" do assert_equal subject, subject end end shoulda-context-1.2.0/test/shoulda/autoload_macro_test.rb0000644000004100000410000000071312316470655023670 0ustar www-datawww-datarequire 'test_helper' class AutoloadMacroTest < Test::Unit::TestCase # :nodoc: context "The macro auto-loader" do should "load macros from the plugins" do assert self.class.respond_to?('plugin_macro') end should "load macros from the gems" do assert self.class.respond_to?('gem_macro') end should "load custom macros from ROOT/test/shoulda_macros" do assert self.class.respond_to?('custom_macro') end end end shoulda-context-1.2.0/test/shoulda/convert_to_should_syntax_test.rb0000644000004100000410000000243112316470655026044 0ustar www-datawww-datarequire 'test/unit' class ConvertToShouldSyntaxTest < Test::Unit::TestCase # :nodoc: BEFORE_FIXTURE = <<-EOS class DummyTest < Test::Unit::TestCase should "Not change this_word_with_underscores" do end def test_should_be_working assert true end def test_some_cool_stuff assert true end def non_test_method end end EOS AFTER_FIXTURE = <<-EOS class DummyTest < Test::Unit::TestCase should "Not change this_word_with_underscores" do end should "be working" do assert true end should "RENAME ME: test some cool stuff" do assert true end def non_test_method end end EOS FIXTURE_PATH = "./convert_to_should_syntax_fixture.dat" RUBY = ENV['RUBY'] || 'ruby' def test_convert_to_should_syntax File.open(FIXTURE_PATH, "w") {|f| f.write(BEFORE_FIXTURE)} cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), '../../bin/convert_to_should_syntax')} #{FIXTURE_PATH}" output = `#{cmd}` File.unlink($1) if output.match(/has been stored in '([^']+)/) assert_match(/has been converted/, output) result = IO.read(FIXTURE_PATH) assert_equal result, AFTER_FIXTURE end def teardown File.unlink(FIXTURE_PATH) end end shoulda-context-1.2.0/test/shoulda/helpers_test.rb0000644000004100000410000001332312316470655022342 0ustar www-datawww-datarequire 'test_helper' class HelpersTest < Test::Unit::TestCase # :nodoc: context "an array of values" do setup do @a = ['abc', 'def', 3] end [/b/, 'abc', 3].each do |x| should "contain #{x.inspect}" do assert_raises(Test::Unit::AssertionFailedError) do assert_does_not_contain @a, x end assert_contains @a, x end end should "not contain 'wtf'" do assert_raises(Test::Unit::AssertionFailedError) {assert_contains @a, 'wtf'} assert_does_not_contain @a, 'wtf' end should "be the same as another array, ordered differently" do assert_same_elements(@a, [3, "def", "abc"]) assert_raises(Test::Unit::AssertionFailedError) do assert_same_elements(@a, [3, 3, "def", "abc"]) end assert_same_elements([@a, "abc"].flatten, ["abc", 3, "def", "abc"]) assert_raises(Test::Unit::AssertionFailedError) do assert_same_elements([@a, "abc"].flatten, [3, 3, "def", "abc"]) end end should "only count the number of occurrences once for each unique value" do a1 = [@a, "abc"].flatten a1.expects(:select).times(3).returns(["abc", "abc"], ["def"], [3]) assert_same_elements(a1, ["abc", 3, "def", "abc"]) end end context "a matching matcher" do setup do @matcher = stub('matcher', :matches? => true, :failure_message_for_should => 'bad failure message', :failure_message_for_should_not => 'big time failure') end should "pass when given to assert_accepts with no message expectation" do assert_accepts @matcher, 'target' end should "pass when given to assert_accepts with a matching message" do assert_accepts @matcher, 'target', :message => /big time/ end should "fail when given to assert_accepts with non-matching message" do assert_raise Test::Unit::AssertionFailedError do assert_accepts @matcher, 'target', :message => /small time/ end end context "when given to assert_rejects" do context "and matcher has :does_not_match?" do setup do @error = nil begin @matcher.stubs(:matches?).returns(false) @matcher.stubs(:does_not_match?).returns(true) assert_rejects @matcher, 'target' rescue Test::Unit::AssertionFailedError => @error end end should "pass" do assert_nil @error end end context "and matcher does not have :does_not_match?" do setup do @error = nil begin assert_rejects @matcher, 'target' rescue Test::Unit::AssertionFailedError => @error end end should "fail" do assert_not_nil @error end should "use the error message from the matcher" do assert_equal 'big time failure', @error.message end end end end context "a non-matching matcher" do setup do @matcher = stub('matcher', :matches? => false, :failure_message_for_should => 'big time failure', :failure_message_for_should_not => 'bad failure message') end should "pass when given to assert_rejects with no message expectation" do assert_rejects @matcher, 'target' end should "pass when given to assert_rejects with a matching message" do assert_rejects @matcher, 'target', :message => /big time/ end should "fail when given to assert_rejects with a non-matching message" do assert_raise Test::Unit::AssertionFailedError do assert_rejects @matcher, 'target', :message => /small time/ end end context "when given to assert_accepts" do setup do begin assert_accepts @matcher, 'target' rescue Test::Unit::AssertionFailedError => @error end end should "fail" do assert_not_nil @error end should "use the error message from the matcher" do assert_equal 'big time failure', @error.message end end end context "a matcher using antiquated syntax" do setup do @matcher = stub('matcher', :matches? => false, :failure_message => 'big time failure', :negative_failure_message => 'bad failure message') end should "pass when given to assert_rejects with no message expectation" do assert_rejects @matcher, 'target' end should "pass when given to assert_rejects with a matching message" do assert_rejects @matcher, 'target', :message => /big time/ end should "fail when given to assert_rejects with a non-matching message" do assert_raise Test::Unit::AssertionFailedError do assert_rejects @matcher, 'target', :message => /small time/ end end context "when given to assert_accepts" do setup do begin assert_accepts @matcher, 'target' rescue Test::Unit::AssertionFailedError => @error end end should "fail" do assert_not_nil @error end should "use the error message from the matcher" do assert_equal 'big time failure', @error.message end end end should "assign context to a support matching on assert_accepts" do matcher = stub('matcher', :matches? => true) matcher.expects(:in_context).with(self) assert_accepts matcher, nil end should "assign context to a support matching on assert_rejects" do matcher = stub('matcher', :matches? => false) matcher.expects(:in_context).with(self) assert_rejects matcher, nil end end shoulda-context-1.2.0/test/shoulda/test_framework_detection_test.rb0000644000004100000410000001061012316470655025766 0ustar www-datawww-datarequire 'test_helper' require 'tempfile' class TestFrameworkDetectionTest < Test::Unit::TestCase if CURRENT_APPRAISAL_NAME == 'rails_4_1' should 'detect Minitest 5.x w/ Rails 4.1' do assert_integration_with_rails_and 'Minitest::Test', 'Minitest::Unit::TestCase' end end if CURRENT_APPRAISAL_NAME == 'rails_4_0' should 'detect ActiveSupport::TestCase and Minitest 4.x w/ Rails 4.0' do assert_integration_with_rails_and 'MiniTest::Unit::TestCase' end end if CURRENT_APPRAISAL_NAME == 'rails_3_2' should 'detect ActiveSupport::TestCase and Test::Unit::TestCase w/ Rails 3.2' do assert_integration_with_rails_and 'Test::Unit::TestCase' end end if CURRENT_APPRAISAL_NAME == 'rails_3_1' should 'detect ActiveSupport::TestCase and Test::Unit::TestCase w/ Rails 3.1' do assert_integration_with_rails_and 'Test::Unit::TestCase' end end if CURRENT_APPRAISAL_NAME == 'rails_3_0' should 'detect ActiveSupport::TestCase and Test::Unit::TestCase w/ Rails 3.0' do assert_integration_with_rails_and 'Test::Unit::TestCase' end end if CURRENT_APPRAISAL_NAME == 'minitest_5_x' should 'detect Minitest 5.x when it is loaded standalone' do assert_integration_with 'Minitest::Test', 'Minitest::Unit::TestCase', setup: <<-RUBY require 'minitest/autorun' RUBY end end if CURRENT_APPRAISAL_NAME == 'minitest_4_x' should 'detect Minitest 4.x when it is loaded standalone' do assert_integration_with 'MiniTest::Unit::TestCase', setup: <<-RUBY require 'minitest/autorun' RUBY end end if CURRENT_APPRAISAL_NAME == 'test_unit' should 'detect the test-unit gem when it is loaded standalone' do assert_integration_with 'Test::Unit::TestCase', setup: <<-RUBY require 'test/unit' RUBY end end def assert_integration_with(*test_cases) assert_test_cases_are_detected(*test_cases) assert_our_api_is_available_in_test_cases(*test_cases) end def assert_integration_with_rails_and(*test_cases) test_cases = ['ActiveSupport::TestCase'] | test_cases options = test_cases.last.is_a?(Hash) ? test_cases.pop : {} options[:setup] = <<-RUBY require 'rails/all' require 'rails/test_help' ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ':memory:' ) RUBY args = test_cases + [options] assert_integration_with(*args) end def assert_test_cases_are_detected(*expected_test_cases) options = expected_test_cases.last.is_a?(Hash) ? expected_test_cases.pop : {} setup = options[:setup] || '' output = execute(file_that_detects_test_framework_test_cases([setup])) actual_test_cases = output.split("\n").first.split(', ') assert_equal expected_test_cases, actual_test_cases end def file_that_detects_test_framework_test_cases(mixins) <<-RUBY #{require_gems(mixins)} require 'yaml' test_cases = Shoulda::Context.test_framework_test_cases.map { |test_case| test_case.to_s } puts test_cases.join(', ') RUBY end def require_gems(mixins) <<-RUBY ENV['BUNDLE_GEMFILE'] = "#{PROJECT_DIR}/gemfiles/#{CURRENT_APPRAISAL_NAME}.gemfile" require 'bundler' Bundler.setup #{mixins.join("\n")} require 'shoulda-context' RUBY end def assert_our_api_is_available_in_test_cases(*test_cases) options = test_cases.last.is_a?(Hash) ? test_cases.pop : {} setup = options[:setup] || '' test_cases.each do |test_case| output = execute(file_that_runs_a_test_within_test_case(test_case, [setup])) assert_match /1 (tests|runs)/, output assert_match /1 assertions/, output assert_match /0 failures/, output assert_match /0 errors/, output end end def file_that_runs_a_test_within_test_case(test_case, mixins) <<-RUBY #{require_gems(mixins)} class FrameworkIntegrationTest < #{test_case} context 'a context' do should 'have a test' do assert_equal true, true end end end RUBY end def execute(code) tempfile = Tempfile.new('shoulda-context-test') tempfile.write(code) tempfile.close if ENV['DEBUG'] puts 'Code:' puts code end output = `RUBYOPT='' ruby #{tempfile.path} 2>&1` if ENV['DEBUG'] puts 'Output:' puts output end output end end shoulda-context-1.2.0/test/shoulda/should_test.rb0000644000004100000410000001743712316470655022210 0ustar www-datawww-datarequire 'test_helper' class ShouldTest < Test::Unit::TestCase # :nodoc: should "be able to define a should statement outside of a context" do assert true end should "see the name of my class as ShouldTest" do assert_equal "ShouldTest", self.class.name end def self.should_see_class_methods should "be able to see class methods" do assert true end end def self.should_be_able_to_setup_a_should_eventually_in_a_class_method should "be able to setup a should eventually in a class method" end def self.should_see_a_context_block_like_a_Test_Unit_class should "see a context block as a Test::Unit class" do assert_equal "ShouldTest", self.class.name end end def self.should_see_blah should "see @blah through a macro" do assert @blah end end def self.should_not_see_blah should "not see @blah through a macro" do assert !instance_variable_defined?(:@blah) end end def self.should_be_able_to_make_context_macros(prefix = nil) context "a macro" do should "have the tests named correctly" do assert_match(/^test: #{prefix}a macro should have the tests named correctly/, self.to_s) end end end context "Context" do should_see_class_methods should_see_a_context_block_like_a_Test_Unit_class should_be_able_to_make_context_macros("Context ") should_be_able_to_setup_a_should_eventually_in_a_class_method should "not define @blah" do assert ! self.instance_variables.include?("@blah") end should_not_see_blah should "be able to define a should statement" do assert true end should "see the name of my class as ShouldTest" do assert_equal "ShouldTest", self.class.name end context "with a subcontext" do should_be_able_to_make_context_macros("Context with a subcontext ") end end context "Context with setup block" do setup do @blah = "blah" end should "have @blah == 'blah'" do assert_equal "blah", @blah end should_see_blah should "have name set right" do assert_match(/^test: Context with setup block/, self.to_s) end context "and a subcontext" do setup do @blah = "#{@blah} twice" end should "be named correctly" do assert_match(/^test: Context with setup block and a subcontext should be named correctly/, self.to_s) end should "run the setup methods in order" do assert_equal @blah, "blah twice" end should_see_blah end end context "Another context with setup block" do setup do @blah = "foo" end should "have @blah == 'foo'" do assert_equal "foo", @blah end should "have name set right" do assert_match(/^test: Another context with setup block/, self.to_s) end should_see_blah end should_eventually "pass, since it's a should_eventually" do flunk "what?" end # Context creation and naming def test_should_create_a_new_context assert_nothing_raised do Shoulda::Context::Context.new("context name", self) do; end end end def test_should_create_a_new_context_even_if_block_is_omitted old_verbose, $VERBOSE = $VERBOSE, nil assert_nothing_raised do Shoulda::Context::Context.new("context without a block", self) end ensure $VERBOSE = old_verbose end def test_should_create_a_nested_context assert_nothing_raised do parent = Shoulda::Context::Context.new("Parent", self) do; end child = Shoulda::Context::Context.new("Child", parent) do; end raise unless child.instance_of? Shoulda::Context::Context end end def test_should_name_a_contexts_correctly parent = Shoulda::Context::Context.new("Parent", self) do; end child = Shoulda::Context::Context.new("Child", parent) do; end grandchild = Shoulda::Context::Context.new("GrandChild", child) do; end assert_equal "Parent", parent.full_name assert_equal "Parent Child", child.full_name assert_equal "Parent Child GrandChild", grandchild.full_name end def test_should_raise_on_duplicate_naming tu_class = Test::Unit::TestCase context = Shoulda::Context::Context.new("DupContext", tu_class) do should "dup" do; end should "dup" do; end end assert_raise DuplicateTestError do context.build end end # Should statements def test_should_have_should_hashes_when_given_should_statements context = Shoulda::Context::Context.new("name", self) do should "be good" do; end should "another" do; end end names = context.shoulds.map {|s| s[:name]} assert_equal ["another", "be good"], names.sort end # setup and teardown def test_should_capture_setup_and_teardown_blocks context = Shoulda::Context::Context.new("name", self) do setup do; "setup"; end teardown do; "teardown"; end end assert_equal "setup", context.setup_blocks.first.call assert_equal "teardown", context.teardown_blocks.first.call end # building def test_should_create_shoulda_test_for_each_should_on_build context = Shoulda::Context::Context.new("name", self) do should "one" do; end should "two" do; end end context.expects(:create_test_from_should_hash).with(has_entry(:name => "one")) context.expects(:create_test_from_should_hash).with(has_entry(:name => "two")) context.build end def test_should_create_test_methods_on_build tu_class = Test::Unit::TestCase context = Shoulda::Context::Context.new("A Context", tu_class) do should "define the test" do; end end tu_class.expects(:define_method).with(:"test: A Context should define the test. ") context.build end def test_should_create_test_methods_on_build_when_subcontext tu_class = Test::Unit::TestCase context = Shoulda::Context::Context.new("A Context", tu_class) do context "with a child" do should "define the test" do; end end end tu_class.expects(:define_method).with(:"test: A Context with a child should define the test. ") context.build end # Test::Unit integration def test_should_create_a_new_context_and_build_it_on_Test_Unit_context c = mock("context") c.expects(:build) Shoulda::Context::Context.expects(:new).with("foo", kind_of(Class)).returns(c) self.class.context "foo" do; end end def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should s = mock("test") Shoulda::Context::Context.any_instance.expects(:should).with("rock", {}).returns(s) Shoulda::Context::Context.any_instance.expects(:build) self.class.should "rock" do; end end def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should_eventually s = mock("test") Shoulda::Context::Context.any_instance.expects(:should_eventually).with("rock").returns(s) Shoulda::Context::Context.any_instance.expects(:build) self.class.should_eventually "rock" do; end end should "run a :before proc", :before => lambda { @value = "before" } do assert_equal "before", @value end context "A :before proc" do setup do assert_equal "before", @value @value = "setup" end should "run before the current setup", :before => lambda { @value = "before" } do assert_equal "setup", @value end end context "a before statement" do setup do assert_equal "before", @value @value = "setup" end before_should "run before the current setup" do @value = "before" end end context "A context" do setup do @value = "outer" end context "with a subcontext and a :before proc" do before = lambda do assert "outer", @value @value = "before" end should "run after the parent setup", :before => before do assert_equal "before", @value end end end end shoulda-context-1.2.0/test/test_helper.rb0000644000004100000410000000101712316470655020515 0ustar www-datawww-datarequire 'fileutils' require 'test/unit' require 'mocha' if ENV['BUNDLE_GEMFILE'].to_s.empty? raise "No Appraisal is specified. Please re-run your tests with BUNDLE_GEMFILE set." end PROJECT_DIR = File.expand_path('../..', __FILE__) CURRENT_APPRAISAL_NAME = File.basename(ENV['BUNDLE_GEMFILE'], '.gemfile') $LOAD_PATH << File.join(PROJECT_DIR, 'lib') require 'shoulda/context' Shoulda.autoload_macros File.join(File.dirname(__FILE__), 'fake_rails_root'), File.join("vendor", "{plugins,gems}", "*") shoulda-context-1.2.0/test/fake_rails_root/0000755000004100000410000000000012316470655021016 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/vendor/0000755000004100000410000000000012316470655022313 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/vendor/gems/0000755000004100000410000000000012316470655023246 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/0000755000004100000410000000000012316470655026664 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/0000755000004100000410000000000012316470655031667 5ustar www-datawww-data././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootshoulda-context-1.2.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rbshoulda-context-1.2.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro0000644000004100000410000000012112316470655033535 0ustar www-datawww-datamodule GemMacro def gem_macro end end Test::Unit::TestCase.extend(GemMacro) shoulda-context-1.2.0/test/fake_rails_root/vendor/plugins/0000755000004100000410000000000012316470655023774 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/0000755000004100000410000000000012316470655027506 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/0000755000004100000410000000000012316470655032511 5ustar www-datawww-data././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootshoulda-context-1.2.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rbshoulda-context-1.2.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_ma0000644000004100000410000000013212316470655034403 0ustar www-datawww-datamodule PluginMacro def plugin_macro end end Test::Unit::TestCase.extend(PluginMacro) shoulda-context-1.2.0/test/fake_rails_root/vendor/plugins/.keep0000644000004100000410000000000012316470655024707 0ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/test/0000755000004100000410000000000012316470655021775 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/test/shoulda_macros/0000755000004100000410000000000012316470655025000 5ustar www-datawww-datashoulda-context-1.2.0/test/fake_rails_root/test/shoulda_macros/custom_macro.rb0000644000004100000410000000013212316470655030014 0ustar www-datawww-datamodule CustomMacro def custom_macro end end Test::Unit::TestCase.extend(CustomMacro) shoulda-context-1.2.0/init.rb0000644000004100000410000000007312316470655016164 0ustar www-datawww-datarequire File.join(File.dirname(__FILE__), 'rails', 'init') shoulda-context-1.2.0/.gitignore0000644000004100000410000000012412316470655016661 0ustar www-datawww-data.bundle Gemfile.lock vendor/ruby vendor/cache doc coverage pkg *.swp *.swo tags tmp shoulda-context-1.2.0/shoulda-context.gemspec0000644000004100000410000000220712316470655021363 0ustar www-datawww-data# -*- encoding: utf-8 -*- $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') require 'shoulda/context/version' Gem::Specification.new do |s| s.name = %q{shoulda-context} s.version = Shoulda::Context::VERSION.dup s.platform = Gem::Platform::RUBY s.authors = ["thoughtbot, inc.", "Tammer Saleh", "Joe Ferris", "Ryan McGeary", "Dan Croak", "Matt Jankowski"] s.email = %q{support@thoughtbot.com} s.homepage = %q{http://thoughtbot.com/community/} s.summary = %q{Context framework extracted from Shoulda} s.description = %q{Context framework extracted from Shoulda} s.license = %q{MIT} s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] s.add_development_dependency("appraisal", "~> 0.5") s.add_development_dependency("rails", ">= 3.0") s.add_development_dependency("mocha", "~> 0.9.10") s.add_development_dependency("rake") s.add_development_dependency("test-unit", "~> 2.1.0") end shoulda-context-1.2.0/tasks/0000755000004100000410000000000012316470655016021 5ustar www-datawww-datashoulda-context-1.2.0/tasks/shoulda.rake0000644000004100000410000000012612316470655020323 0ustar www-datawww-dataload File.join(File.dirname(__FILE__), "..", "lib", "shoulda", "context", "tasks.rb") shoulda-context-1.2.0/CONTRIBUTING.md0000644000004100000410000000247012316470655017130 0ustar www-datawww-dataWe love pull requests. Here's a quick guide: 1. Fork the repo. 2. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `bundle && rake` 3. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, we need a test! 4. Make the test pass. 5. Push to your fork and submit a pull request. At this point you're waiting on us. We like to at least comment on, if not accept, pull requests within three business days (and, typically, one business day). We may suggest some changes or improvements or alternatives. Some things that will increase the chance that your pull request is accepted, taken straight from the Ruby on Rails guide: * Use Rails idioms and helpers * Include tests that fail without your code, and pass with it * Update the documentation, the surrounding one, examples elsewhere, guides, whatever is affected by your contribution Syntax: * Two spaces, no tabs. * No trailing whitespace. Blank lines should not have any space. * Prefer &&/|| over and/or. * MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg. * a = b and not a=b. * Follow the conventions you see used in the source already. And in case we didn't emphasize it enough: we love tests! shoulda-context-1.2.0/rails/0000755000004100000410000000000012316470655016006 5ustar www-datawww-datashoulda-context-1.2.0/rails/init.rb0000644000004100000410000000021012316470655017267 0ustar www-datawww-dataif RAILS_ENV == 'test' require "shoulda/context" Shoulda.autoload_macros RAILS_ROOT, File.join("vendor", "{plugins,gems}", "*") end shoulda-context-1.2.0/Appraisals0000644000004100000410000000131012316470655016711 0ustar www-datawww-dataappraise 'rails_3_0' do gem 'rails', '~> 3.0.0' gem 'sqlite3' end appraise 'rails_3_1' do gem 'rails', '~> 3.1.0' gem 'jquery-rails' gem 'sass-rails' gem 'sqlite3' end appraise 'rails_3_2' do gem 'rails', '~> 3.2.0' gem 'jquery-rails' gem 'sass-rails' gem 'sqlite3' end appraise 'rails_4_0' do gem 'rails', '~> 4.0.0' gem 'jquery-rails' gem 'sass-rails' gem 'sqlite3' end appraise 'rails_4_1' do gem 'rails', github: 'rails/rails', branch: '4-1-stable' gem 'jquery-rails' gem 'sass-rails' gem 'sqlite3' end appraise 'minitest_4_x' do gem 'minitest', '~> 4.0' end appraise 'minitest_5_x' do gem 'minitest', '~> 5.0' end appraise 'test_unit' do gem 'test-unit' end shoulda-context-1.2.0/checksums.yaml.gz0000444000004100000410000000041412316470655020161 0ustar www-datawww-data9Se;R0 D"tt@,*&ǡzvy{z܏|ސªIuK hTd:/ȯ_n,=Qcp_]c ,clmiU^hI)ܾvz.&46BxV8Tnސj d#RA[a"J Tq W{8Ft*$DbP+ oScseq<.lSLTcO -N2%#xaf*V!shoulda-context-1.2.0/README.md0000644000004100000410000000401712316470655016155 0ustar www-datawww-data# shoulda-context [![Gem Version](https://badge.fury.io/rb/shoulda-context.png)](http://badge.fury.io/rb/shoulda-context) [![Build Status](https://travis-ci.org/thoughtbot/shoulda-context.png?branch=master)](https://travis-ci.org/thoughtbot/shoulda-context) [Official Documentation](http://rubydoc.info/github/thoughtbot/shoulda-context/master/frames) Shoulda's contexts make it easy to write understandable and maintainable tests for Test::Unit. It's fully compatible with your existing tests in Test::Unit, and requires no retooling to use. Refer to the [shoulda](https://github.com/thoughtbot/shoulda) gem if you want to know more about using shoulda with Rails or RSpec. ## Contexts Instead of writing Ruby methods with `lots_of_underscores`, shoulda-context adds context, setup, and should blocks... class CalculatorTest < Test::Unit::TestCase context "a calculator" do setup do @calculator = Calculator.new end should "add two numbers for the sum" do assert_equal 4, @calculator.sum(2, 2) end should "multiply two numbers for the product" do assert_equal 10, @calculator.product(2, 5) end end end ... which combine to produce the following test methods: "test: a calculator should add two numbers for the sum." "test: a calculator should multiply two numbers for the product." ## Assertions It also has two additional Test::Unit assertions for working with Ruby's Array: assert_same_elements([:a, :b, :c], [:c, :a, :b]) assert_contains(['a', '1'], /\d/) assert_contains(['a', '1'], 'a') ## Credits Shoulda is maintained and funded by [thoughtbot](http://thoughtbot.com/community). shoulda-context is maintained by [Travis Jeffery](https://github.com/travisjeffery). Thank you to all the [contributors](https://github.com/thoughtbot/shoulda-context/contributors). ## License Shoulda is Copyright © 2006-2013 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.