shoulda-context-2.0.0/0000755000004100000410000000000013701071075014663 5ustar www-datawww-datashoulda-context-2.0.0/Gemfile.lock0000644000004100000410000000241613701071075017110 0ustar www-datawww-dataPATH remote: . specs: shoulda-context (2.0.0) GEM remote: https://rubygems.org/ specs: appraisal (2.2.0) bundler rake thor (>= 0.14.0) ast (2.4.0) byebug (10.0.2) coderay (1.1.2) jaro_winkler (1.5.4) m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) method_source (0.9.2) minitest (5.14.0) mocha (1.11.2) parallel (1.19.1) parser (2.7.1.0) ast (~> 2.4.0) power_assert (1.1.7) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) rainbow (3.0.0) rake (13.0.1) rubocop (0.71.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.1) snowglobe (0.3.0) test-unit (3.3.5) power_assert thor (1.0.1) unicode-display_width (1.6.1) warnings_logger (0.1.0) PLATFORMS ruby DEPENDENCIES appraisal bundler (~> 1.0) byebug m minitest mocha pry (~> 0.12.0) pry-byebug (~> 3.6.0) rake rubocop (= 0.71.0) shoulda-context! snowglobe (>= 0.3.0) test-unit warnings_logger BUNDLED WITH 1.17.3 shoulda-context-2.0.0/.travis.yml0000644000004100000410000000164313701071075017000 0ustar www-datawww-datalanguage: ruby dist: xenial os: linux cache: directories: - vendor/bundle # Source: before_install: - gem update --system '3.1.2' --no-document - gem uninstall -v '< 2' -i $(rvm gemdir)@global -ax bundler || true - gem install bundler -v '< 2' --no-document - nvm use v11.0.0 - bundle config set path vendor/bundle install: "bundle install --jobs=3 --retry=3" script: "bundle exec rake" rvm: - 2.4.9 - 2.5.8 - 2.6.6 - 2.7.1 env: - TEST_FRAMEWORK=minitest - TEST_FRAMEWORK=test_unit gemfile: - gemfiles/rails_4_2.gemfile - gemfiles/rails_5_0.gemfile - gemfiles/rails_5_1.gemfile - gemfiles/rails_5_2.gemfile - gemfiles/rails_6_0.gemfile matrix: exclude: - rvm: 2.4.9 gemfile: gemfiles/rails_6_0.gemfile - rvm: 2.6.6 gemfile: gemfiles/rails_4_2.gemfile - rvm: 2.7.1 gemfile: gemfiles/rails_4_2.gemfile shoulda-context-2.0.0/test/0000755000004100000410000000000013701071075015642 5ustar www-datawww-datashoulda-context-2.0.0/test/shoulda/0000755000004100000410000000000013701071075017301 5ustar www-datawww-datashoulda-context-2.0.0/test/shoulda/helpers_test.rb0000644000004100000410000001033513701071075022331 0ustar www-datawww-datarequire 'test_helper' class HelpersTest < PARENT_TEST_CASE 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(ASSERTION_CLASS) do assert_does_not_contain @a, x end assert_contains @a, x end end should "not contain 'wtf'" do assert_raises(ASSERTION_CLASS) {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(ASSERTION_CLASS) do assert_same_elements(@a, [3, 3, "def", "abc"]) end assert_same_elements([@a, "abc"].flatten, ["abc", 3, "def", "abc"]) assert_raises(ASSERTION_CLASS) 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: "bad failure message", failure_message_when_negated: "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_raises ASSERTION_CLASS 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 ASSERTION_CLASS => @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 ASSERTION_CLASS => @error end end should "fail" do refute_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: "big time failure", failure_message_when_negated: "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_raises ASSERTION_CLASS 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 ASSERTION_CLASS => @error end end should "fail" do refute_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-2.0.0/test/shoulda/railtie_test.rb0000644000004100000410000000222513701071075022317 0ustar www-datawww-datarequire "test_helper" class RailtieTest < PARENT_TEST_CASE context "A Rails application with shoulda-context added to it" do setup do app.create end should "load files in vendor/gems and vendor/plugins when booted" do app.create_gem_with_macro( module_name: "MacrosFromVendor", location: "vendor/gems/vendored_gem_with_macro", macro_name: "macro_from_vendored_gem" ) app.create_gem_with_macro( module_name: "MacrosFromPlugin", location: "vendor/plugins/plugin_gem_with_macro", macro_name: "macro_from_plugin_gem" ) app.create_gem_with_macro( module_name: "MacrosFromTest", location: "test", macro_name: "macro_from_test" ) app.write_file("test/macros_test.rb", <<~RUBY) ENV["RAILS_ENV"] = "test" require_relative "../config/environment" class MacrosTest < #{PARENT_TEST_CASE} macro_from_vendored_gem macro_from_plugin_gem macro_from_test end RUBY app.run_n_unit_test_suite end end def app @_app ||= RailsApplicationWithShouldaContext.new end end shoulda-context-2.0.0/test/shoulda/rerun_snippet_test.rb0000644000004100000410000000226613701071075023570 0ustar www-datawww-datarequire "test_helper" class RerunSnippetTest < PARENT_TEST_CASE context "A Rails application with shoulda-context added to it" do should "display the correct rerun snippet when a test fails" do if app.rails_version >= 5 && TEST_FRAMEWORK == "minitest" app.create app.write_file("test/models/failing_test.rb", <<~RUBY) ENV["RAILS_ENV"] = "test" require_relative "../../config/environment" class FailingTest < #{PARENT_TEST_CASE} should "fail" do assert false end end RUBY command_runner = app.run_n_unit_test_suite expected_file_path_with_line_number = if rails_version >= 6 "rails test test/models/failing_test.rb:5" else "bin/rails test test/models/failing_test.rb:5" end assert_includes( command_runner.output, expected_file_path_with_line_number ) end end end def app @_app ||= RailsApplicationWithShouldaContext.new end def rails_version # TODO: Update snowglobe so that we don't have to do this app.send(:bundle).version_of("rails") end end shoulda-context-2.0.0/test/shoulda/should_test.rb0000644000004100000410000002532713701071075022174 0ustar www-datawww-datarequire 'test_helper' class ShouldTest < PARENT_TEST_CASE 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_case_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( Regexp.new( "^" + build_expected_test_name( "#{prefix}a macro should have the tests named correctly" ) ), test_name ) end end end context "Context" do should_see_class_methods should_see_a_context_block_like_a_test_case_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( Regexp.new( "^" + build_expected_test_name("Context with setup block") ), test_name ) end context "and a subcontext" do setup do @blah = "#{@blah} twice" end should "be named correctly" do assert_match( Regexp.new( "^" + build_expected_test_name( "Context with setup block and a subcontext should be named correctly" ) ), test_name ) 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( Regexp.new( "^" + build_expected_test_name("Another context with setup block") ), test_name ) 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.class) 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.class) end ensure $VERBOSE = old_verbose end def test_should_create_a_nested_context assert_nothing_raised do parent = Shoulda::Context::Context.new("Parent", self.class) 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.class) 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 context = Shoulda::Context::Context.new("DupContext", self.class) do should "dup" do; end should "dup" do; end end assert_raises Shoulda::Context::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.class) 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.class) 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.class) 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 = self.class context = Shoulda::Context::Context.new("A Context", tu_class) do should "define the test" do; end end tu_class. expects(:define_method). with( build_expected_test_name("A Context should define the test. ").to_sym ) context.build end def test_should_create_test_methods_on_build_when_subcontext tu_class = self.class 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( build_expected_test_name( "A Context with a child should define the test. " ).to_sym ) context.build end # Test::Unit integration def test_should_create_a_new_context_and_build_it_on_test_case_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_case_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_case_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 def test_name name end def build_expected_test_name(value) if TEST_FRAMEWORK == "minitest" if value.is_a?(Regexp) Regexp.new("^test_: #{value.source}") else "test_: #{value}" end elsif value.is_a?(Regexp) Regexp.new("^test: #{value.source}") else "test: #{value}" end end # Minitest removed assert_nothing_raised a while back; # see here: def assert_nothing_raised yield end end class RedTestarossaDriver; end class RedTestarossaDriverTest < PARENT_TEST_CASE class DummyMatcher def description "fail to construct the proper test name with a 'should_not'" end def matches?(*) false end def failure_message_when_negated "dummy failure message" end end should "call Shoulda::Context::Context.new using the correct context name" do assert_equal "RedTestarossaDriver", @shoulda_context.name end should "see the name of the test case class as RedTestarossaDriverTest" do assert_equal "RedTestarossaDriverTest", self.class.name end should "include the correct context name in the full name of the test" do assert_match( build_expected_test_name(/RedTestarossaDriver/), test_name ) end def test_should_property_construct_test_name_for_should_eventually context = Shoulda::Context::Context.new("whatever", self.class) do "this is just a placeholder" end Shoulda::Context::Context. expects(:new). with("RedTestarossaDriver", RedTestarossaDriverTest). returns(context) self.class.should_eventually("do something") {} end def test_should_property_construct_test_name_for_should_not context = Shoulda::Context::Context.new("whatever", self.class) do "this is just a placeholder" end Shoulda::Context::Context. expects(:new). with("RedTestarossaDriver", RedTestarossaDriverTest). returns(context) self.class.should_not(DummyMatcher.new) end private def test_name name end def build_expected_test_name(value) if TEST_FRAMEWORK == "minitest" if value.is_a?(Regexp) Regexp.new("^test_: #{value.source}") else "test_: #{value}" end elsif value.is_a?(Regexp) Regexp.new("^test: #{value.source}") else "test: #{value}" end end end shoulda-context-2.0.0/test/shoulda/context_test.rb0000644000004100000410000002174613701071075022363 0ustar www-datawww-datarequire 'test_helper' class ContextTest < PARENT_TEST_CASE 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/, normalized_name) 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/, normalized_name) 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/, normalized_name) 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/, normalized_name) 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/, normalized_name) 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 def normalized_name name.sub("test_:", "test:") end end class ::Some class NestedModel; end end class Some::NestedModelTest < PARENT_TEST_CASE should "determine the described type for a nested model" do assert_equal Some::NestedModel, self.class.described_type end end class Some::SomeTest < PARENT_TEST_CASE should "not fallback to higher-level constants with same name" do assert_raises(NameError) do assert_equal nil, self.class.described_type end end end class ShouldMatcherTest < PARENT_TEST_CASE class FakeMatcher attr_reader :subject attr_accessor :fail def description "be a fake matcher" end def matches?(subject) @subject = subject !@fail end def failure_message "positive failure message" end def failure_message_when_negated "negative failure message" end end def setup @matcher = FakeMatcher.new end def assert_failed_with(message, test_suite) assert_equal [message], test_suite.failure_messages end def assert_passed(test_suite) assert_equal [], test_suite.failure_messages end def assert_test_named(expected_name, test_suite) name = test_suite.test_names.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 @test_suite.run assert_passed @test_suite end should "fail with a failing matcher" do @matcher.fail = true @test_suite.run assert_failed_with "positive failure message", @test_suite end should "provide the subject" do @matcher.fail = false @test_suite.run 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 @test_suite.run assert_passed @test_suite end should "fail with a passing matcher" do @matcher.fail = false @test_suite.run assert_failed_with "negative failure message", @test_suite end should "provide the subject" do @matcher.fail = false @test_suite.run assert_equal 'a subject', @matcher.subject end end context "a should block with a matcher" do setup do matcher = @matcher @test_suite = TestSuite.create 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 = TestSuite.create 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 = TestSuite.create 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 = TestSuite.create do context "in context" do subject { 'a subject' } should_not matcher end end end should_use_negative_matcher end class TestSuite def self.create(&definition) if defined?(Test::Unit) TestUnitSuite.new(&definition) else MinitestSuite.new(&definition) end end end class TestUnitSuite def initialize(&definition) @suite = Class.new(Test::Unit::TestCase, &definition).suite @result = Test::Unit::TestResult.new end def run @suite.run(@result) do |event, name| # do nothing end end def failure_messages @result.failures.map(&:message) end def test_names @suite.tests.map(&:method_name) end end class MinitestSuite def initialize(&definition) @test_case_class = Class.new(Minitest::Test, &definition) @reporter = Minitest::StatisticsReporter.new(StringIO.new) end def run @test_case_class.run(@reporter) end def failure_messages @reporter.results.flat_map(&:failures).map(&:message) end def test_names @test_case_class.runnable_methods end end end class Subject; end class SubjectTest < PARENT_TEST_CASE def setup @expected = Subject.new end subject { @expected } should "return a specified subject" do assert_equal @expected, subject end end class SubjectLazinessTest < PARENT_TEST_CASE subject { Subject.new } should "only build the subject once" do assert_equal subject, subject end end shoulda-context-2.0.0/test/shoulda/convert_to_should_syntax_test.rb0000644000004100000410000000241113701071075026031 0ustar www-datawww-datarequire 'test_helper' class ConvertToShouldSyntaxTest < PARENT_TEST_CASE BEFORE_FIXTURE = <<-EOS class DummyTest < #{PARENT_TEST_CASE} 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 < #{PARENT_TEST_CASE} 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__), '../../exe/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-2.0.0/test/shoulda/autoload_macro_test.rb0000644000004100000410000000067513701071075023666 0ustar www-datawww-datarequire 'test_helper' class AutoloadMacroTest < PARENT_TEST_CASE 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-2.0.0/test/shoulda/test_framework_detection_test.rb0000644000004100000410000000770513701071075025770 0ustar www-datawww-datarequire "test_helper" require "tempfile" class TestFrameworkDetectionTest < PARENT_TEST_CASE if Tests::CurrentBundle.instance.current_appraisal == "rails_5_2" should "detect Minitest 5.x w/ Rails 5.2" do assert_integration_with_rails_and "Minitest::Test" end end if Tests::CurrentBundle.instance.current_appraisal == "rails_5_1" should "detect Minitest 5.x w/ Rails 5.1" do assert_integration_with_rails_and "Minitest::Test" end end if Tests::CurrentBundle.instance.current_appraisal == "rails_5_0" should "detect Minitest 5.x w/ Rails 5.0" do assert_integration_with_rails_and "Minitest::Test" end end if Tests::CurrentBundle.instance.current_appraisal == "rails_4_2" should "detect ActiveSupport::TestCase and Minitest 4.x w/ Rails 4.2" do assert_integration_with_rails_and "Minitest::Test" end end if TEST_FRAMEWORK == "minitest" should "detect Minitest 5.x when it is loaded standalone" do assert_integration_with "Minitest::Test", setup: <<-RUBY require "minitest/autorun" RUBY end end if TEST_FRAMEWORK == "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_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_integration_with(*test_cases) assert_test_cases_are_detected(*test_cases) assert_our_api_is_available_in_test_cases(*test_cases) 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 do |test_case| test_case.to_s end puts test_cases.join(', ') RUBY end def require_gems(mixins) <<-RUBY ENV["BUNDLE_GEMFILE"] = "#{PROJECT_DIR}/gemfiles/" + "#{Tests::CurrentBundle.instance.current_appraisal}.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>/dev/null` if ENV["DEBUG"] puts "Output:" puts output end output end end shoulda-context-2.0.0/test/fake_rails_root/0000755000004100000410000000000013701071075021005 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/test/0000755000004100000410000000000013701071075021764 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/test/shoulda_macros/0000755000004100000410000000000013701071075024767 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/test/shoulda_macros/custom_macro.rb0000644000004100000410000000012613701071075030006 0ustar www-datawww-datamodule CustomMacro def custom_macro end end PARENT_TEST_CASE.extend(CustomMacro) shoulda-context-2.0.0/test/fake_rails_root/vendor/0000755000004100000410000000000013701071075022302 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/vendor/gems/0000755000004100000410000000000013701071075023235 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/0000755000004100000410000000000013701071075026653 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/0000755000004100000410000000000013701071075031656 5ustar www-datawww-data././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootshoulda-context-2.0.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rbshoulda-context-2.0.0/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro0000644000004100000410000000011413701071075033526 0ustar www-datawww-datamodule GemMacro def gem_macro end end PARENT_TEST_CASE.extend(GemMacro) shoulda-context-2.0.0/test/fake_rails_root/vendor/plugins/0000755000004100000410000000000013701071075023763 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/0000755000004100000410000000000013701071075027475 5ustar www-datawww-datashoulda-context-2.0.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/0000755000004100000410000000000013701071075032500 5ustar www-datawww-data././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootshoulda-context-2.0.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rbshoulda-context-2.0.0/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_ma0000644000004100000410000000012513701071075034374 0ustar www-datawww-datamodule PluginMacro def plugin_macro end end PARENT_TEST_CASE.extend(PluginMacro) shoulda-context-2.0.0/test/fake_rails_root/vendor/plugins/.keep0000644000004100000410000000000013701071075024676 0ustar www-datawww-datashoulda-context-2.0.0/test/support/0000755000004100000410000000000013701071075017356 5ustar www-datawww-datashoulda-context-2.0.0/test/support/current_bundle.rb0000644000004100000410000000207413701071075022721 0ustar www-datawww-datarequire "bundler" require "appraisal" module Tests class CurrentBundle AppraisalNotSpecified = Class.new(ArgumentError) include Singleton def assert_appraisal! unless appraisal_in_use? message = <`. Possible appraisals are: #{available_appraisals} MSG raise AppraisalNotSpecified, message end end def appraisal_in_use? path.dirname == root.join("gemfiles") end def current_or_latest_appraisal current_appraisal || latest_appraisal end def latest_appraisal available_appraisals.max end def current_appraisal if appraisal_in_use? File.basename(path, ".gemfile") end end private def available_appraisals appraisals = [] Appraisal::AppraisalFile.each do |appraisal| appraisals << appraisal.name end appraisals end def path Bundler.default_gemfile end def root Pathname.new("../../..").expand_path(__FILE__) end end end shoulda-context-2.0.0/test/support/snowglobe.rb0000644000004100000410000000014313701071075021700 0ustar www-datawww-datarequire "snowglobe" Snowglobe.configure do |config| config.project_name = "shoulda-context" end shoulda-context-2.0.0/test/support/rails_application_with_shoulda_context.rb0000644000004100000410000000175713701071075027730 0ustar www-datawww-datarequire_relative "snowglobe" class RailsApplicationWithShouldaContext < Snowglobe::RailsApplication ROOT_DIRECTORY = Pathname.new("../../..").expand_path(__FILE__) def create super bundle.updating do bundle.add_gem(test_framework_gem_name, group: :test) bundle.add_gem("shoulda-context", path: ROOT_DIRECTORY, group: :test) end end def test_framework_require_path if TEST_FRAMEWORK == "test_unit" "test-unit" else "minitest/autorun" end end def create_gem_with_macro(module_name:, location:, macro_name:) fs.write_file("#{location}/shoulda_macros/macros.rb", <<~FILE) module #{module_name} def #{macro_name} puts "#{macro_name} is available" end end Shoulda::Context.configure do |config| config.extend(#{module_name}) end FILE end private def test_framework_gem_name if TEST_FRAMEWORK == "test_unit" "test-unit" else "minitest" end end end shoulda-context-2.0.0/test/test_helper.rb0000644000004100000410000000200213701071075020477 0ustar www-datawww-datarequire_relative "support/current_bundle" Tests::CurrentBundle.instance.assert_appraisal! #--- require "pry-byebug" require "warnings_logger" TEST_FRAMEWORK = ENV.fetch("TEST_FRAMEWORK", "minitest") if TEST_FRAMEWORK == "test_unit" require "test-unit" require "mocha/test_unit" else require "minitest/autorun" require "mocha/minitest" end PROJECT_DIR = File.expand_path("../..", __FILE__) PARENT_TEST_CASE = if TEST_FRAMEWORK == "test_unit" Test::Unit::TestCase else Minitest::Test end ASSERTION_CLASS = if TEST_FRAMEWORK == "test_unit" Test::Unit::AssertionFailedError else Minitest::Assertion end WarningsLogger::Spy.call( project_name: "shoulda-context", project_directory: Pathname.new("../..").expand_path(__FILE__) ) require_relative "support/rails_application_with_shoulda_context" require_relative "../lib/shoulda/context" Shoulda.autoload_macros( File.join(File.dirname(__FILE__), "fake_rails_root"), File.join("vendor", "{plugins,gems}", "*") ) $VERBOSE = true shoulda-context-2.0.0/README.md0000644000004100000410000001355413701071075016152 0ustar www-datawww-data# Shoulda Context [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] ![Downloads][downloads-badge] [![Hound][hound-badge]][hound] [version-badge]: https://img.shields.io/gem/v/shoulda-context.svg [rubygems]: https://rubygems.org/gems/shoulda-matchers [travis-badge]: https://img.shields.io/travis/thoughtbot/shoulda-context/master.svg [travis]: https://travis-ci.org/thoughtbot/shoulda-context [downloads-badge]: https://img.shields.io/gem/dtv/shoulda-context.svg [hound-badge]: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg [hound]: https://houndci.com Shoulda Context makes it easy to write understandable and maintainable tests under Minitest and Test::Unit within Rails projects or plain Ruby projects. It's fully compatible with your existing tests and requires no retooling to use. ## Quick links 📖 **[Read the documentation for the latest version.][rubydocs]** 📢 **[See what's changed in recent versions.][changelog]** [rubydocs]: http://rubydoc.info/github/thoughtbot/shoulda-context/master/frames [changelog]: CHANGELOG.md ## Usage Instead of writing Ruby methods with `lots_of_underscores`, Shoulda Context lets you name your tests and group them together using English. At a minimum, the gem provides some convenience layers around core Minitest / Test::Unit functionality. For instance, this test case: ```ruby class CalculatorTest < Minitest::Test 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 ``` turns into: ```ruby class CalculatorTest < Minitest::Test def setup @calculator = Calculator.new end define_method "test_: a calculator should add two numbers for the sum" do assert_equal 4, @calculator.sum(2, 2) end define_method "test_: a calculator should multiply two numbers for the product" do assert_equal 10, @calculator.product(2, 5) end end ``` However, Shoulda Context also provides functionality apart from Minitest / Test::Unit that allows you to shorten tests drastically by making use of RSpec-compatible matchers. For instance, with [Shoulda Matchers][shoulda-matchers] you can write such tests as: ```ruby class User < ActiveSupport::TestCase context "validations" do subject { FactoryBot.build(:user) } should validate_presence_of(:first_name) should validate_presence_of(:last_name) should validate_uniqueness_of(:email) should_not allow_value('weird').for(:email) end end ``` [shoulda-matchers]: https://github.com/thoughtbot/shoulda-matchers ## API ### DSL The primary method in Shoulda Context's API is `context`, which declares a group of a tests. These methods are available inside of a `context`: * `setup` — a DSL-y alternative to defining a `setup` method * `teardown` — a DSL-y alternative to defining a `teardown` method * `should` — There are two forms: 1. when passed a name + block, creates a test equivalent to defining a `test_` method 2. when passed a matcher, creates a test that will run the matcher, asserting that it passes * `should_not` — like the matcher version of `should`, but creates a test that asserts that the matcher fails * `should_eventually` — allows you to temporarily skip tests * `context` — creates a subcontext These methods are available within a test case class, but outside of a `context`: * `should` — same as above * `should_not` — same as above * `should_eventually` — same as above * `described_type` — returns the class being tested, as determined by the class name of the outermost class * `subject` — lets you define an object that is the primary focus of the tests within a context; this is most useful when using a matcher as the matcher will make use of this as _its_ subject And these methods are available inside of a test (whether defined via a method or via `should`): * `subject` — an instance of the class under test, which is derived automatically from the name of the test case class but is overridable via the class method version of `subject` above ### Assertions In addition to the main API, the gem also provides some extra assertions that may be of use: * `assert_same_elements` — compares two arrays for equality, but ignoring ordering * `assert_contains` — asserts that an array has an item * `assert_does_not_contain` — the opposite of `assert_contains` * `assert_accepts` — what `should` uses internally; asserts that a matcher object matches against a value * `assert_reject` — what `should_not` uses internally; asserts that a matcher object does not match against a value ## Note on running tests Normally, you will run a single test like this: ruby -I lib -I test path_to_test.rb -n name_of_test_method When using Shoulda Context, however, you'll need to put a space after the test name: ruby -I lib -I test path_to_test.rb -n "test_: a calculator should add two numbers for the sum. " If this is too cumbersome, consider using the [m] gem to run tests instead: m path_to_test.rb:39 [m]: https://github.com/qrush/m ## Compatibility Shoulda Context is tested and supported against Rails 4.x+, Minitest 4.x, Test::Unit 3.x, and Ruby 2.4+. ## Credits Shoulda Context is maintained by [Elliot Winkler][elliot-winkler], [Travis Jeffery][travis-jeffery], and thoughtbot. Thank you to all the [contributors]. [elliot-winkler]: https://github.com/mcmire [travis-jeffery]: https://github.com/travisjeffery [contributors]: https://github.com/thoughtbot/shoulda-context/contributors ## License Shoulda Context is copyright © 2006-2020 [thoughtbot, inc][thoughtbot-website]. It is free software, and may be redistributed under the terms specified in the [MIT-LICENSE](MIT-LICENSE) file. [thoughtbot-website]: https://thoughtbot.com shoulda-context-2.0.0/tasks/0000755000004100000410000000000013701071075016010 5ustar www-datawww-datashoulda-context-2.0.0/tasks/shoulda.rake0000644000004100000410000000012613701071075020312 0ustar www-datawww-dataload File.join(File.dirname(__FILE__), "..", "lib", "shoulda", "context", "tasks.rb") shoulda-context-2.0.0/bin/0000755000004100000410000000000013701071075015433 5ustar www-datawww-datashoulda-context-2.0.0/bin/run_all_tests0000755000004100000410000000047113701071075020241 0ustar www-datawww-data#!/bin/bash set -euo pipefail SUPPORTED_VERSIONS=$(bin/supported_ruby_versions) run-tests-for-version() { local version="$1" (export RBENV_VERSION=$version; bundle exec rake) } for version in $SUPPORTED_VERSIONS; do echo echo "*** Running tests for $version ***" run-tests-for-version $version done shoulda-context-2.0.0/bin/update_gem_in_all_appraisals0000755000004100000410000000055513701071075023235 0ustar www-datawww-data#!/bin/bash set -euo pipefail SUPPORTED_VERSIONS=$(bin/supported_ruby_versions) gem="$1" update-gem-for-version() { local version="$1" (export RBENV_VERSION=$version; bundle update "$gem"; bundle exec appraisal update "$gem") } for version in $SUPPORTED_VERSIONS; do echo echo "*** Updating $gem for $version ***" update-gem-for-version $version done shoulda-context-2.0.0/bin/supported_ruby_versions0000755000004100000410000000030713701071075022377 0ustar www-datawww-data#!/usr/bin/env ruby require 'yaml' travis_config_path = File.expand_path('../../.travis.yml', __FILE__) travis_config = YAML.load_file(travis_config_path) puts travis_config.fetch('rvm').join(' ') shoulda-context-2.0.0/bin/setup0000755000004100000410000001014213701071075016517 0ustar www-datawww-data#!/usr/bin/env bash set -euo pipefail RUBY_VERSION=$(bin/supported_ruby_versions | xargs -n 1 echo | sort -V | tail -n 1) cd "$(dirname "$(dirname "$0")")" uname=$(uname) if [[ $uname == 'Darwin' ]]; then platform='mac' else platform='linux' fi banner() { echo -e "\033[34m== $@ ==\033[0m" } success() { echo -e "\033[32m$@\033[0m" } warning() { echo -e "\033[33m$@\033[0m" } error() { echo -e "\033[31m$@\033[0m" } has-executable() { type "$1" &>/dev/null } is-running() { pgrep "$1" >/dev/null } install() { local apt_package="" local rpm_package="" local brew_package="" local default_package="" local package="" for arg in "$@"; do case $arg in apt=*) apt_package="$arg" ;; rpm=*) rpm_package="$arg" ;; brew=*) brew_package="$arg" ;; *) default_package="$arg" ;; esac done if has-executable brew; then package="${brew_package:-$default_package}" if [[ -n $package ]]; then brew install "$package" fi elif has-executable apt-get; then package="${apt_package:-$default_package}" if [[ -n $package ]]; then sudo apt-get install -y "$package" fi elif has-executable yum; then package="${yum_package:-$default_package}" if [[ -n $package ]]; then sudo yum install -y "$package" fi else error "Sorry, I'm not sure how to install $default_package." exit 1 fi } check-for-build-tools() { if [[ $platform == "linux" ]]; then if ! has-executable apt-get; then error "You don't seem to have a package manager installed." echo "The setup script assumes you're using Debian or a Debian-derived flavor of Linux" echo "(i.e. something with Apt). If this is not the case, then we would gladly take a" echo "PR fixing this!" exit 1 fi # TODO: Check if build-essential is installed on Debian? else if ! has-executable brew; then error "You don't seem to have Homebrew installed." echo echo "Follow the instructions here to do this:" echo echo "http://brew.sh" exit 1 fi # TODO: Check that OS X Command Line Tools are installed? fi } install-development-libraries() { install apt=ruby-dev rpm=ruby-devel install rpm=zlib-devel } install-dependencies() { if ! has-executable sqlite3; then banner 'Installing SQLite 3' install sqlite3 install apt=libsqlite3-dev rpm=sqlite-devel fi if ! has-executable psql; then banner 'Installing PostgreSQL' install postgresql install apt=libpq-dev rpm=postgresql-devel fi if ! is-running postgres; then banner 'Starting PostgreSQL' start postgresql fi if ! has-executable heroku; then banner 'Installing Heroku' install heroku/brew/heroku heroku fi if has-executable rbenv; then if ! (rbenv versions | grep $RUBY_VERSION'\>' &>/dev/null); then banner "Installing Ruby $RUBY_VERSION with rbenv" rbenv install --skip-existing "$RUBY_VERSION" fi elif has-executable rvm; then if ! (rvm ls | grep $RUBY_VERSION'\>' &>/dev/null); then banner "Installing Ruby $RUBY_VERSION with rvm" error "You don't seem to have Ruby $RUBY_VERSION installed." echo echo "Use RVM to do so, and then re-run this command." echo fi else error "You don't seem to have a Ruby manager installed." echo echo 'We recommend using rbenv. You can find installation instructions here:' echo echo 'http://github.com/rbenv/rbenv' echo echo "When you're done, simply re-run this script!" exit 1 fi banner 'Installing Ruby dependencies' gem install bundler -v '~> 1.0' --conservative bundle check || bundle install bundle exec appraisal install if ! has-executable node; then banner 'Installing Node' if [[ $platform == 'linux' ]]; then curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - install nodejs if ! has-executable npm; then install npm fi else install nodejs fi fi } check-for-build-tools install-development-libraries install-dependencies shoulda-context-2.0.0/bin/update_gems_in_all_appraisals0000755000004100000410000000056113701071075023415 0ustar www-datawww-data#!/bin/bash set -euo pipefail SUPPORTED_VERSIONS=$(bin/supported_ruby_versions) update-gems-for-version() { local version="$1" (export RBENV_VERSION=$version; bundle update "${@:2}"; bundle exec appraisal update "${@:2}") } for version in $SUPPORTED_VERSIONS; do echo echo "*** Updating gems for $version ***" update-gems-for-version "$version" "$@" done shoulda-context-2.0.0/bin/install_gems_in_all_appraisals0000755000004100000410000000053013701071075023575 0ustar www-datawww-data#!/bin/bash set -euo pipefail SUPPORTED_VERSIONS=$(bin/supported_ruby_versions) install-gems-for-version() { local version="$1" (export RBENV_VERSION=$version; bundle && bundle exec appraisal install) } for version in $SUPPORTED_VERSIONS; do echo echo "*** Installing gems for $version ***" install-gems-for-version $version done shoulda-context-2.0.0/gemfiles/0000755000004100000410000000000013701071075016456 5ustar www-datawww-datashoulda-context-2.0.0/gemfiles/rails_5_2.gemfile.lock0000644000004100000410000001416713701071075022527 0ustar www-datawww-dataPATH remote: .. specs: shoulda-context (2.0.0) GEM remote: https://rubygems.org/ specs: actioncable (5.2.4.2) actionpack (= 5.2.4.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailer (5.2.4.2) actionpack (= 5.2.4.2) actionview (= 5.2.4.2) activejob (= 5.2.4.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (5.2.4.2) actionview (= 5.2.4.2) activesupport (= 5.2.4.2) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionview (5.2.4.2) activesupport (= 5.2.4.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) activejob (5.2.4.2) activesupport (= 5.2.4.2) globalid (>= 0.3.6) activemodel (5.2.4.2) activesupport (= 5.2.4.2) activerecord (5.2.4.2) activemodel (= 5.2.4.2) activesupport (= 5.2.4.2) arel (>= 9.0) activestorage (5.2.4.2) actionpack (= 5.2.4.2) activerecord (= 5.2.4.2) marcel (~> 0.3.1) activesupport (5.2.4.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) appraisal (2.2.0) bundler rake thor (>= 0.14.0) archive-zip (0.12.0) io-like (~> 0.3.0) arel (9.0.0) ast (2.4.0) bcrypt (3.1.13) bootsnap (1.4.6) msgpack (~> 1.0) builder (3.2.4) byebug (10.0.2) capybara (3.1.1) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) xpath (~> 3.0) childprocess (3.0.0) chromedriver-helper (2.1.1) archive-zip (~> 0.10) nokogiri (~> 1.8) coderay (1.1.2) concurrent-ruby (1.1.6) crass (1.0.6) erubi (1.9.0) ffi (1.12.2) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.2) concurrent-ruby (~> 1.0) io-like (0.3.1) jaro_winkler (1.5.4) jbuilder (2.10.0) activesupport (>= 5.0.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.4) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0) minitest-reporters (1.4.2) ansi builder minitest (>= 5.0) ruby-progressbar mocha (1.11.2) msgpack (1.3.3) nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) parallel (1.19.1) parser (2.7.1.0) ast (~> 2.4.0) power_assert (1.1.7) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) public_suffix (4.0.3) puma (3.12.4) rack (2.2.2) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.2.4.2) actioncable (= 5.2.4.2) actionmailer (= 5.2.4.2) actionpack (= 5.2.4.2) actionview (= 5.2.4.2) activejob (= 5.2.4.2) activemodel (= 5.2.4.2) activerecord (= 5.2.4.2) activestorage (= 5.2.4.2) activesupport (= 5.2.4.2) bundler (>= 1.3.0) railties (= 5.2.4.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) actionview (>= 5.0.1.x) activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (5.2.4.2) actionpack (= 5.2.4.2) activesupport (= 5.2.4.2) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) rubocop (0.71.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.1) ruby_dep (1.5.0) rubyzip (2.3.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.1.0) railties (>= 5.2.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) snowglobe (0.3.0) spring (2.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) test-unit (3.3.5) power_assert thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.7) thread_safe (~> 0.1) unicode-display_width (1.6.1) warnings_logger (0.1.0) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS ruby DEPENDENCIES appraisal bcrypt (~> 3.1.7) bootsnap (>= 1.1.0) bundler (~> 1.0) byebug capybara (~> 3.1.1) chromedriver-helper jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) m minitest minitest-reporters mocha pry (~> 0.12.0) pry-byebug (~> 3.6.0) puma (~> 3.11) rails (~> 5.2.2) rails-controller-testing (>= 1.0.1) rake rubocop (= 0.71.0) sass-rails (~> 5.0) selenium-webdriver shoulda-context! snowglobe (>= 0.3.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) sqlite3 (~> 1.3.6) test-unit turbolinks (~> 5) warnings_logger BUNDLED WITH 1.17.3 shoulda-context-2.0.0/gemfiles/rails_4_2.gemfile0000644000004100000410000000135313701071075021570 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "appraisal" gem "bundler", "~> 1.0" gem "byebug" gem "m" gem "minitest" gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" gem "rubocop", "0.71.0" gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" gem "sqlite3", "~> 1.3.6" gem "spring" gem "spring-commands-rspec" gem "minitest-reporters" gem "rails", "~> 4.2.10" gem "sass-rails", "~> 5.0" gem "uglifier", ">= 1.3.0" gem "coffee-rails", "~> 4.1.0" gem "jquery-rails" gem "turbolinks" gem "jbuilder", "~> 2.0" gem "sdoc", "~> 0.4.0", group: :doc gem "bcrypt", "~> 3.1.7" gem "activeresource", "4.0.0" gem "json", "~> 1.4" gem "protected_attributes", "~> 1.0.6" gemspec path: "../" shoulda-context-2.0.0/gemfiles/rails_5_2.gemfile0000644000004100000410000000145313701071075021572 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "appraisal" gem "bundler", "~> 1.0" gem "byebug" gem "m" gem "minitest" gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" gem "rubocop", "0.71.0" gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" gem "sqlite3", "~> 1.3.6" gem "spring" gem "spring-commands-rspec" gem "minitest-reporters" gem "rails", "~> 5.2.2" gem "rails-controller-testing", ">= 1.0.1" gem "puma", "~> 3.11" gem "bootsnap", ">= 1.1.0", require: false gem "sass-rails", "~> 5.0" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.5" gem "bcrypt", "~> 3.1.7" gem "capybara", "~> 3.1.1" gem "selenium-webdriver" gem "chromedriver-helper" gem "listen", ">= 3.0.5", "< 3.2" gem "spring-watcher-listen", "~> 2.0.0" gemspec path: "../" shoulda-context-2.0.0/gemfiles/rails_5_1.gemfile.lock0000644000004100000410000001314013701071075022514 0ustar www-datawww-dataPATH remote: .. specs: shoulda-context (2.0.0) GEM remote: https://rubygems.org/ specs: actioncable (5.1.7) actionpack (= 5.1.7) nio4r (~> 2.0) websocket-driver (~> 0.6.1) actionmailer (5.1.7) actionpack (= 5.1.7) actionview (= 5.1.7) activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (5.1.7) actionview (= 5.1.7) activesupport (= 5.1.7) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionview (5.1.7) activesupport (= 5.1.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) activejob (5.1.7) activesupport (= 5.1.7) globalid (>= 0.3.6) activemodel (5.1.7) activesupport (= 5.1.7) activerecord (5.1.7) activemodel (= 5.1.7) activesupport (= 5.1.7) arel (~> 8.0) activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) appraisal (2.2.0) bundler rake thor (>= 0.14.0) arel (8.0.0) ast (2.4.0) bcrypt (3.1.13) builder (3.2.4) byebug (10.0.2) capybara (2.18.0) addressable mini_mime (>= 0.1.3) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) childprocess (3.0.0) coderay (1.1.2) concurrent-ruby (1.1.6) crass (1.0.6) erubi (1.9.0) ffi (1.12.2) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.2) concurrent-ruby (~> 1.0) jaro_winkler (1.5.4) jbuilder (2.10.0) activesupport (>= 5.0.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.2) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0) minitest-reporters (1.4.2) ansi builder minitest (>= 5.0) ruby-progressbar mocha (1.11.2) nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) parallel (1.19.1) parser (2.7.1.0) ast (~> 2.4.0) power_assert (1.1.7) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) public_suffix (4.0.3) puma (3.12.4) rack (2.2.2) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.1.7) actioncable (= 5.1.7) actionmailer (= 5.1.7) actionpack (= 5.1.7) actionview (= 5.1.7) activejob (= 5.1.7) activemodel (= 5.1.7) activerecord (= 5.1.7) activesupport (= 5.1.7) bundler (>= 1.3.0) railties (= 5.1.7) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) actionview (>= 5.0.1.x) activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (5.1.7) actionpack (= 5.1.7) activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) rubocop (0.71.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.1) ruby_dep (1.5.0) rubyzip (2.3.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) snowglobe (0.3.0) spring (2.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) test-unit (3.3.5) power_assert thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.7) thread_safe (~> 0.1) unicode-display_width (1.6.1) warnings_logger (0.1.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS ruby DEPENDENCIES appraisal bcrypt (~> 3.1.7) bundler (~> 1.0) byebug capybara (~> 2.13) jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) m minitest minitest-reporters mocha pry (~> 0.12.0) pry-byebug (~> 3.6.0) puma (~> 3.7) rails (~> 5.1.6) rails-controller-testing (>= 1.0.1) rake rubocop (= 0.71.0) sass-rails (~> 5.0) selenium-webdriver shoulda-context! snowglobe (>= 0.3.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) sqlite3 (~> 1.3.6) test-unit turbolinks (~> 5) warnings_logger BUNDLED WITH 1.17.3 shoulda-context-2.0.0/gemfiles/rails_6_0.gemfile.lock0000644000004100000410000001532013701071075022516 0ustar www-datawww-dataPATH remote: .. specs: shoulda-context (2.0.0) GEM remote: https://rubygems.org/ specs: actioncable (6.0.2.2) actionpack (= 6.0.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailbox (6.0.2.2) actionpack (= 6.0.2.2) activejob (= 6.0.2.2) activerecord (= 6.0.2.2) activestorage (= 6.0.2.2) activesupport (= 6.0.2.2) mail (>= 2.7.1) actionmailer (6.0.2.2) actionpack (= 6.0.2.2) actionview (= 6.0.2.2) activejob (= 6.0.2.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (6.0.2.2) actionview (= 6.0.2.2) activesupport (= 6.0.2.2) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actiontext (6.0.2.2) actionpack (= 6.0.2.2) activerecord (= 6.0.2.2) activestorage (= 6.0.2.2) activesupport (= 6.0.2.2) nokogiri (>= 1.8.5) actionview (6.0.2.2) activesupport (= 6.0.2.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) activejob (6.0.2.2) activesupport (= 6.0.2.2) globalid (>= 0.3.6) activemodel (6.0.2.2) activesupport (= 6.0.2.2) activerecord (6.0.2.2) activemodel (= 6.0.2.2) activesupport (= 6.0.2.2) activestorage (6.0.2.2) actionpack (= 6.0.2.2) activejob (= 6.0.2.2) activerecord (= 6.0.2.2) marcel (~> 0.3.1) activesupport (6.0.2.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) appraisal (2.2.0) bundler rake thor (>= 0.14.0) ast (2.4.0) bcrypt (3.1.13) bootsnap (1.4.6) msgpack (~> 1.0) builder (3.2.4) byebug (10.0.2) capybara (3.32.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (~> 1.5) xpath (~> 3.2) childprocess (3.0.0) coderay (1.1.2) concurrent-ruby (1.1.6) crass (1.0.6) erubi (1.9.0) ffi (1.12.2) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.2) concurrent-ruby (~> 1.0) jaro_winkler (1.5.4) jbuilder (2.10.0) activesupport (>= 5.0.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) method_source (0.9.2) mimemagic (0.3.4) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0) minitest-reporters (1.4.2) ansi builder minitest (>= 5.0) ruby-progressbar mocha (1.11.2) msgpack (1.3.3) nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) parallel (1.19.1) parser (2.7.1.0) ast (~> 2.4.0) pg (1.2.3) power_assert (1.1.7) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) public_suffix (4.0.3) puma (4.3.3) nio4r (~> 2.0) rack (2.2.2) rack-proxy (0.6.5) rack rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.0.2.2) actioncable (= 6.0.2.2) actionmailbox (= 6.0.2.2) actionmailer (= 6.0.2.2) actionpack (= 6.0.2.2) actiontext (= 6.0.2.2) actionview (= 6.0.2.2) activejob (= 6.0.2.2) activemodel (= 6.0.2.2) activerecord (= 6.0.2.2) activestorage (= 6.0.2.2) activesupport (= 6.0.2.2) bundler (>= 1.3.0) railties (= 6.0.2.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) actionview (>= 5.0.1.x) activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (6.0.2.2) actionpack (= 6.0.2.2) activesupport (= 6.0.2.2) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (1.7.0) rubocop (0.71.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.1) ruby_dep (1.5.0) rubyzip (2.3.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.2.1) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) sassc (>= 2.0) sprockets (> 3.0) sprockets-rails tilt selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) snowglobe (0.3.0) spring (2.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (4.0.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.4.2) test-unit (3.3.5) power_assert thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.7) thread_safe (~> 0.1) unicode-display_width (1.6.1) warnings_logger (0.1.0) webdrivers (4.2.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) webpacker (4.2.2) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.3.0) PLATFORMS ruby DEPENDENCIES appraisal bcrypt (~> 3.1.7) bootsnap (>= 1.4.2) bundler (~> 1.0) byebug capybara (>= 2.15) jbuilder (~> 2.7) listen (>= 3.0.5, < 3.2) m minitest minitest-reporters mocha pg (~> 1.1) pry (~> 0.12.0) pry-byebug (~> 3.6.0) puma (~> 4.1) rails (~> 6.0.2) rails-controller-testing (>= 1.0.4) rake rubocop (= 0.71.0) sass-rails (>= 6) selenium-webdriver shoulda-context! snowglobe (>= 0.3.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) sqlite3 (~> 1.4.0) test-unit turbolinks (~> 5) warnings_logger webdrivers webpacker (~> 4.0) BUNDLED WITH 1.17.3 shoulda-context-2.0.0/gemfiles/rails_5_0.gemfile0000644000004100000410000000127313701071075021570 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "appraisal" gem "bundler", "~> 1.0" gem "byebug" gem "m" gem "minitest" gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" gem "rubocop", "0.71.0" gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" gem "sqlite3", "~> 1.3.6" gem "spring" gem "spring-commands-rspec" gem "minitest-reporters" gem "rails", "~> 5.0.7" gem "rails-controller-testing", ">= 1.0.1" gem "puma", "~> 3.0" gem "sass-rails", "~> 5.0" gem "jquery-rails" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.5" gem "bcrypt", "~> 3.1.7" gem "listen", "~> 3.0.5" gem "spring-watcher-listen", "~> 2.0.0" gemspec path: "../" shoulda-context-2.0.0/gemfiles/rails_5_1.gemfile0000644000004100000410000000134413701071075021570 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "appraisal" gem "bundler", "~> 1.0" gem "byebug" gem "m" gem "minitest" gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" gem "rubocop", "0.71.0" gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" gem "sqlite3", "~> 1.3.6" gem "spring" gem "spring-commands-rspec" gem "minitest-reporters" gem "rails", "~> 5.1.6" gem "rails-controller-testing", ">= 1.0.1" gem "puma", "~> 3.7" gem "sass-rails", "~> 5.0" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.5" gem "bcrypt", "~> 3.1.7" gem "capybara", "~> 2.13" gem "selenium-webdriver" gem "listen", ">= 3.0.5", "< 3.2" gem "spring-watcher-listen", "~> 2.0.0" gemspec path: "../" shoulda-context-2.0.0/gemfiles/rails_6_0.gemfile0000644000004100000410000000153413701071075021571 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "appraisal" gem "bundler", "~> 1.0" gem "byebug" gem "m" gem "minitest" gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" gem "rubocop", "0.71.0" gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" gem "sqlite3", "~> 1.4.0" gem "spring" gem "spring-commands-rspec" gem "minitest-reporters" gem "rails", "~> 6.0.2" gem "puma", "~> 4.1" gem "sass-rails", ">= 6" gem "webpacker", "~> 4.0" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.7" gem "bcrypt", "~> 3.1.7" gem "bootsnap", ">= 1.4.2", require: false gem "listen", ">= 3.0.5", "< 3.2" gem "spring-watcher-listen", "~> 2.0.0" gem "capybara", ">= 2.15" gem "selenium-webdriver" gem "webdrivers" gem "rails-controller-testing", ">= 1.0.4" gem "pg", "~> 1.1", platform: :ruby gemspec path: "../" shoulda-context-2.0.0/gemfiles/rails_5_0.gemfile.lock0000644000004100000410000001242413701071075022517 0ustar www-datawww-dataPATH remote: .. specs: shoulda-context (2.0.0) GEM remote: https://rubygems.org/ specs: actioncable (5.0.7.2) actionpack (= 5.0.7.2) nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) actionmailer (5.0.7.2) actionpack (= 5.0.7.2) actionview (= 5.0.7.2) activejob (= 5.0.7.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (5.0.7.2) actionview (= 5.0.7.2) activesupport (= 5.0.7.2) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionview (5.0.7.2) activesupport (= 5.0.7.2) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) activejob (5.0.7.2) activesupport (= 5.0.7.2) globalid (>= 0.3.6) activemodel (5.0.7.2) activesupport (= 5.0.7.2) activerecord (5.0.7.2) activemodel (= 5.0.7.2) activesupport (= 5.0.7.2) arel (~> 7.0) activesupport (5.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) ansi (1.5.0) appraisal (2.2.0) bundler rake thor (>= 0.14.0) arel (7.1.4) ast (2.4.0) bcrypt (3.1.13) builder (3.2.4) byebug (10.0.2) coderay (1.1.2) concurrent-ruby (1.1.6) crass (1.0.6) erubis (2.7.0) ffi (1.12.2) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.2) concurrent-ruby (~> 1.0) jaro_winkler (1.5.4) jbuilder (2.10.0) activesupport (>= 5.0.0) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.2) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0) minitest-reporters (1.4.2) ansi builder minitest (>= 5.0) ruby-progressbar mocha (1.11.2) nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) parallel (1.19.1) parser (2.7.1.0) ast (~> 2.4.0) power_assert (1.1.7) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) puma (3.12.4) rack (2.2.2) rack-test (0.6.3) rack (>= 1.0) rails (5.0.7.2) actioncable (= 5.0.7.2) actionmailer (= 5.0.7.2) actionpack (= 5.0.7.2) actionview (= 5.0.7.2) activejob (= 5.0.7.2) activemodel (= 5.0.7.2) activerecord (= 5.0.7.2) activesupport (= 5.0.7.2) bundler (>= 1.3.0) railties (= 5.0.7.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) actionview (>= 5.0.1.x) activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (5.0.7.2) actionpack (= 5.0.7.2) activesupport (= 5.0.7.2) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) rubocop (0.71.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.1) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) snowglobe (0.3.0) spring (2.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) test-unit (3.3.5) power_assert thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.7) thread_safe (~> 0.1) unicode-display_width (1.6.1) warnings_logger (0.1.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) PLATFORMS ruby DEPENDENCIES appraisal bcrypt (~> 3.1.7) bundler (~> 1.0) byebug jbuilder (~> 2.5) jquery-rails listen (~> 3.0.5) m minitest minitest-reporters mocha pry (~> 0.12.0) pry-byebug (~> 3.6.0) puma (~> 3.0) rails (~> 5.0.7) rails-controller-testing (>= 1.0.1) rake rubocop (= 0.71.0) sass-rails (~> 5.0) shoulda-context! snowglobe (>= 0.3.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) sqlite3 (~> 1.3.6) test-unit turbolinks (~> 5) warnings_logger BUNDLED WITH 1.17.3 shoulda-context-2.0.0/gemfiles/rails_4_2.gemfile.lock0000644000004100000410000001274513701071075022526 0ustar www-datawww-dataPATH remote: .. specs: shoulda-context (2.0.0) GEM remote: https://rubygems.org/ specs: actionmailer (4.2.11.1) actionpack (= 4.2.11.1) actionview (= 4.2.11.1) activejob (= 4.2.11.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) actionpack (4.2.11.1) actionview (= 4.2.11.1) activesupport (= 4.2.11.1) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionview (4.2.11.1) activesupport (= 4.2.11.1) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) activejob (4.2.11.1) activesupport (= 4.2.11.1) globalid (>= 0.3.0) activemodel (4.2.11.1) activesupport (= 4.2.11.1) builder (~> 3.1) activerecord (4.2.11.1) activemodel (= 4.2.11.1) activesupport (= 4.2.11.1) arel (~> 6.0) activeresource (4.0.0) activemodel (~> 4.0) activesupport (~> 4.0) rails-observers (~> 0.1.1) activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) ansi (1.5.0) appraisal (2.2.0) bundler rake thor (>= 0.14.0) arel (6.0.4) ast (2.4.0) bcrypt (3.1.13) builder (3.2.4) byebug (10.0.2) coderay (1.1.2) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) concurrent-ruby (1.1.6) crass (1.0.6) erubis (2.7.0) execjs (2.7.0) ffi (1.12.2) globalid (0.4.2) activesupport (>= 4.2.0) i18n (0.9.5) concurrent-ruby (~> 1.0) jaro_winkler (1.5.4) jbuilder (2.9.1) activesupport (>= 4.2.0) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.6) loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.2) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0) minitest-reporters (1.4.2) ansi builder minitest (>= 5.0) ruby-progressbar mocha (1.11.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) parallel (1.19.1) parser (2.7.1.0) ast (~> 2.4.0) power_assert (1.1.7) protected_attributes (1.0.9) activemodel (>= 4.0.1, < 5.0) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) rack (1.6.13) rack-test (0.6.3) rack (>= 1.0) rails (4.2.11.1) actionmailer (= 4.2.11.1) actionpack (= 4.2.11.1) actionview (= 4.2.11.1) activejob (= 4.2.11.1) activemodel (= 4.2.11.1) activerecord (= 4.2.11.1) activesupport (= 4.2.11.1) bundler (>= 1.3.0, < 2.0) railties (= 4.2.11.1) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.9) activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.3.0) loofah (~> 2.3) rails-observers (0.1.5) activemodel (>= 4.0) railties (4.2.11.1) actionpack (= 4.2.11.1) activesupport (= 4.2.11.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (3.0.0) rake (13.0.1) rb-fsevent (0.10.3) rb-inotify (0.10.1) ffi (~> 1.0) rdoc (4.3.0) rubocop (0.71.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) ruby-progressbar (1.10.1) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) snowglobe (0.3.0) spring (2.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) test-unit (3.3.5) power_assert thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.7) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (1.6.1) warnings_logger (0.1.0) PLATFORMS ruby DEPENDENCIES activeresource (= 4.0.0) appraisal bcrypt (~> 3.1.7) bundler (~> 1.0) byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails json (~> 1.4) m minitest minitest-reporters mocha protected_attributes (~> 1.0.6) pry (~> 0.12.0) pry-byebug (~> 3.6.0) rails (~> 4.2.10) rake rubocop (= 0.71.0) sass-rails (~> 5.0) sdoc (~> 0.4.0) shoulda-context! snowglobe (>= 0.3.0) spring spring-commands-rspec sqlite3 (~> 1.3.6) test-unit turbolinks uglifier (>= 1.3.0) warnings_logger BUNDLED WITH 1.17.3 shoulda-context-2.0.0/CHANGELOG.md0000644000004100000410000000234413701071075016477 0ustar www-datawww-data# Changelog ## 2.0.0 (2020-06-13) ### Backward-incompatible changes * Drop support for RSpec 2 matchers. Matchers passed to `should` must conform to RSpec 3's API (`failure_message` and `failure_message_when_negated`). * Drop support for older versions of Rails. Rails 4.x-6.x are the only versions supported now. * Drop support for older versions of Ruby. Ruby 2.4.x-2.7.x are the only versions supported now. ### Bug fixes * Fix how test names are generated so that when including the name of the outermost test class, "Test" is not removed from the class name if it does not fall at the end. * Remove warning from Ruby about `context` not being used when using the gem with warnings enabled. * Fix macro autoloading code. Files intended to hold custom macros which are located in either `test/shoulda_macros`, `vendor/gems/*/shoulda_macros`, or `vendor/plugins/*/shoulda_macros` are now loaded and mixed into your test framework's automatically. * Restore compatibility with Shoulda Matchers, starting from 3.0. * Fix some compatibility issues with Minitest 5. * Fix running tests within a Rails < 5.2 environment so that when tests fail, an error is not produced claiming that Minitest::Result cannot find a test method. shoulda-context-2.0.0/.rubocop.yml0000644000004100000410000000744613701071075017150 0ustar www-datawww-dataAllCops: TargetRubyVersion: 2.4 Exclude: - '*.gemspec' Layout/AlignParameters: EnforcedStyle: with_fixed_indentation Layout/ConditionPosition: Enabled: false Layout/DotPosition: EnforcedStyle: trailing Layout/MultilineMethodCallIndentation: EnforcedStyle: indented Lint/AmbiguousOperator: Enabled: false Lint/AmbiguousRegexpLiteral: Enabled: false Lint/AssignmentInCondition: Enabled: false Lint/DeprecatedClassMethods: Enabled: false Lint/ElseLayout: Enabled: false Lint/HandleExceptions: Enabled: false Lint/IndentHeredoc: Enabled: false Lint/LiteralInInterpolation: Enabled: false Lint/Loop: Enabled: false Lint/ParenthesesAsGroupedExpression: Enabled: false Lint/RequireParentheses: Enabled: false Lint/UnderscorePrefixedVariableName: Enabled: false Lint/Void: Enabled: false Metrics/BlockLength: Enabled: false Metrics/ClassLength: Enabled: false Metrics/LineLength: IgnoredPatterns: - "^[ ]*describe.+$" - "^[ ]*context.+$" - "^[ ]*shared_context.+$" - "^[ ]*shared_examples_for.+$" - "^[ ]*it.+$" - "^[ ]*'.+?' => '.+?',?$" - "^[ ]*\".+?\" => \".+?\",?$" - "^[ ]*.+?: .+?$" Metrics/MethodLength: Max: 30 Naming/AccessorMethodName: Enabled: false Naming/AsciiIdentifiers: Enabled: false Naming/BinaryOperatorParameterName: Enabled: false Naming/MemoizedInstanceVariableName: EnforcedStyleForLeadingUnderscores: required Style/ClassVars: Enabled: false Style/ColonMethodCall: Enabled: false Naming/FileName: Enabled: false Rails: Enabled: true Rails/Delegate: Enabled: false Rails/HttpPositionalArguments: Enabled: false Style/Alias: Enabled: false Style/ArrayJoin: Enabled: false Style/AsciiComments: Enabled: false Style/Attr: Enabled: false Style/CaseEquality: Enabled: false Style/CharacterLiteral: Enabled: false Style/ClassAndModuleChildren: Enabled: false Style/CollectionMethods: PreferredMethods: find: detect reduce: inject collect: map find_all: select Style/CommentAnnotation: Enabled: false Style/Documentation: Enabled: false Style/DoubleNegation: Enabled: false Style/EachWithObject: Enabled: false Style/EmptyLiteral: Enabled: false Style/Encoding: Enabled: false Style/EvenOdd: Enabled: false Style/ExpandPathArguments: Enabled: false Style/FlipFlop: Enabled: false Style/FormatString: Enabled: false Style/FrozenStringLiteralComment: Enabled: false Style/GlobalVars: Enabled: false Style/GuardClause: Enabled: false Style/IfUnlessModifier: Enabled: false Style/IfWithSemicolon: Enabled: false Style/InlineComment: Enabled: false Style/Lambda: Enabled: false Style/LambdaCall: Enabled: false Style/LineEndConcatenation: Enabled: false Style/MethodCalledOnDoEndBlock: Enabled: false Style/ModuleFunction: Enabled: false Style/NegatedIf: Enabled: false Style/NegatedWhile: Enabled: false Style/Next: Enabled: false Style/NilComparison: Enabled: false Style/Not: Enabled: false Style/NumericLiterals: Enabled: false Style/NumericPredicate: Enabled: false Style/OneLineConditional: Enabled: false Style/PercentLiteralDelimiters: Enabled: false Style/PerlBackrefs: Enabled: false Style/PreferredHashMethods: Enabled: false Style/Proc: Enabled: false Style/RaiseArgs: Enabled: false Style/RegexpLiteral: Enabled: false Style/RescueStandardError: Enabled: false Style/SelfAssignment: Enabled: false Style/SignalException: Enabled: false Style/SingleLineBlockParams: Enabled: false Style/SingleLineMethods: Enabled: false Style/SpecialGlobalVars: Enabled: false Style/StringLiterals: EnforcedStyle: double_quotes Style/SymbolArray: Enabled: false Style/TrivialAccessors: Enabled: false Style/WhenThen: Enabled: false Style/WhileUntilModifier: Enabled: false Style/WordArray: Enabled: false Style/VariableInterpolation: Enabled: false shoulda-context-2.0.0/Appraisals0000644000004100000410000000576513701071075016722 0ustar www-datawww-data# Note: All of the dependencies here were obtained by running `rails new` with # various versions of Rails and copying lines from the generated Gemfile. It's # best to keep the gems here in the same order as they're listed there so you # can compare them more easily. shared_rails_dependencies = proc do gem "sqlite3", "~> 1.3.6" end shared_spring_dependencies = proc do gem "spring" gem "spring-commands-rspec" end shared_test_dependencies = proc do gem "minitest-reporters" end shared_dependencies = proc do instance_eval(&shared_rails_dependencies) instance_eval(&shared_spring_dependencies) instance_eval(&shared_test_dependencies) end appraise "rails_4_2" do instance_eval(&shared_dependencies) gem "rails", "~> 4.2.10" gem "sass-rails", "~> 5.0" gem "uglifier", ">= 1.3.0" gem "coffee-rails", "~> 4.1.0" gem "jquery-rails" gem "turbolinks" gem "jbuilder", "~> 2.0" gem "sdoc", "~> 0.4.0", group: :doc gem "bcrypt", "~> 3.1.7" # Other dependencies we use gem "activeresource", "4.0.0" gem "json", "~> 1.4" gem "protected_attributes", "~> 1.0.6" end appraise "rails_5_0" do instance_eval(&shared_dependencies) gem "rails", "~> 5.0.7" gem "rails-controller-testing", ">= 1.0.1" gem "puma", "~> 3.0" gem "sass-rails", "~> 5.0" gem "jquery-rails" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.5" gem "bcrypt", "~> 3.1.7" gem "listen", "~> 3.0.5" gem "spring-watcher-listen", "~> 2.0.0" end appraise "rails_5_1" do instance_eval(&shared_dependencies) gem "rails", "~> 5.1.6" gem "rails-controller-testing", ">= 1.0.1" gem "puma", "~> 3.7" gem "sass-rails", "~> 5.0" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.5" gem "bcrypt", "~> 3.1.7" gem "capybara", "~> 2.13" gem "selenium-webdriver" gem "listen", ">= 3.0.5", "< 3.2" gem "spring-watcher-listen", "~> 2.0.0" end appraise "rails_5_2" do instance_eval(&shared_dependencies) gem "rails", "~> 5.2.2" gem "rails-controller-testing", ">= 1.0.1" gem "puma", "~> 3.11" gem "bootsnap", ">= 1.1.0", require: false gem "sass-rails", "~> 5.0" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.5" gem "bcrypt", "~> 3.1.7" gem "capybara", "~> 3.1.1" gem "selenium-webdriver" gem "chromedriver-helper" gem "listen", ">= 3.0.5", "< 3.2" gem "spring-watcher-listen", "~> 2.0.0" end if Gem::Requirement.new('>= 2.5.0').satisfied_by?(Gem::Version.new(RUBY_VERSION)) appraise "rails_6_0" do instance_eval(&shared_dependencies) gem "rails", "~> 6.0.2" gem "puma", "~> 4.1" gem "sass-rails", ">= 6" gem "webpacker", "~> 4.0" gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.7" gem "bcrypt", "~> 3.1.7" gem "bootsnap", ">= 1.4.2", require: false gem "listen", ">= 3.0.5", "< 3.2" gem "spring-watcher-listen", "~> 2.0.0" gem "capybara", ">= 2.15" gem "selenium-webdriver" gem "sqlite3", "~> 1.4.0" gem "webdrivers" # Other dependencies gem "rails-controller-testing", ">= 1.0.4" gem "pg", "~> 1.1", platform: :ruby end end shoulda-context-2.0.0/shoulda-context.gemspec0000644000004100000410000000163513701071075021356 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 = "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 = "support@thoughtbot.com" s.homepage = "http://thoughtbot.com/community/" s.summary = "Context framework extracted from Shoulda" s.description = "Context framework extracted from Shoulda" s.license = "MIT" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) } s.bindir = "exe" s.require_paths = ["lib"] end shoulda-context-2.0.0/.gitignore0000644000004100000410000000010713701071075016651 0ustar www-datawww-data.bundle vendor/ruby vendor/cache doc coverage pkg *.swp *.swo tags tmp shoulda-context-2.0.0/.hound.yml0000644000004100000410000000006713701071075016604 0ustar www-datawww-datarubocop: version: 0.64.0 config_file: .rubocop.yml shoulda-context-2.0.0/Rakefile0000644000004100000410000000115513701071075016332 0ustar www-datawww-datarequire "bundler/setup" require "bundler/gem_tasks" require "rake/testtask" require "pry-byebug" require_relative "test/support/current_bundle" load "tasks/shoulda.rake" Rake::TestTask.new do |t| t.libs << "test" t.ruby_opts += ["-w"] t.pattern = "test/**/*_test.rb" t.verbose = true end task :default do if Tests::CurrentBundle.instance.appraisal_in_use? Rake::Task["test"].invoke elsif ENV["CI"] exec "appraisal install && appraisal rake --trace" else appraisal = Tests::CurrentBundle.instance.latest_appraisal exec "appraisal install && appraisal #{appraisal} rake --trace" end end shoulda-context-2.0.0/lib/0000755000004100000410000000000013701071075015431 5ustar www-datawww-datashoulda-context-2.0.0/lib/shoulda-context.rb0000644000004100000410000000003213701071075021072 0ustar www-datawww-datarequire "shoulda/context" shoulda-context-2.0.0/lib/shoulda/0000755000004100000410000000000013701071075017070 5ustar www-datawww-datashoulda-context-2.0.0/lib/shoulda/context.rb0000644000004100000410000000077413701071075021111 0ustar www-datawww-datarequire "shoulda/context/autoload_macros" require "shoulda/context/configuration" require "shoulda/context/context" require "shoulda/context/dsl" require "shoulda/context/proc_extensions" require "shoulda/context/test_framework_detection" require "shoulda/context/version" require "shoulda/context/world" if defined?(Rails) require "shoulda/context/railtie" require "shoulda/context/rails_test_unit_reporter_patch" end Shoulda::Context.configure do |config| config.include(Shoulda::Context::DSL) end shoulda-context-2.0.0/lib/shoulda/context/0000755000004100000410000000000013701071075020554 5ustar www-datawww-datashoulda-context-2.0.0/lib/shoulda/context/version.rb0000644000004100000410000000010713701071075022564 0ustar www-datawww-datamodule Shoulda module Context VERSION = "2.0.0".freeze end end shoulda-context-2.0.0/lib/shoulda/context/proc_extensions.rb0000644000004100000410000000056513701071075024331 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-2.0.0/lib/shoulda/context/tasks/0000755000004100000410000000000013701071075021701 5ustar www-datawww-datashoulda-context-2.0.0/lib/shoulda/context/tasks/yaml_to_shoulda.rake0000644000004100000410000000161313701071075025731 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-2.0.0/lib/shoulda/context/tasks/list_tests.rake0000644000004100000410000000150413701071075024742 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-2.0.0/lib/shoulda/context/railtie.rb0000644000004100000410000000047313701071075022536 0ustar www-datawww-datamodule Shoulda module Context class Railtie < Rails::Railtie initializer "shoulda_context.autoload_macros" do if Rails.env.test? Shoulda.autoload_macros( Rails.root, File.join("vendor", "{plugins,gems}", "*") ) end end end end end shoulda-context-2.0.0/lib/shoulda/context/test_framework_detection.rb0000644000004100000410000000145313701071075026176 0ustar www-datawww-datamodule Shoulda module Context module TestFrameworkDetection def self.possible_test_frameworks [ -> { ActiveSupport::TestCase }, -> { Minitest::Test }, -> { 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_cases ||= detected_test_framework_test_cases end end def self.test_framework_test_cases TestFrameworkDetection.test_framework_test_cases end end end shoulda-context-2.0.0/lib/shoulda/context/world.rb0000644000004100000410000000061213701071075022227 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 end end shoulda-context-2.0.0/lib/shoulda/context/context.rb0000644000004100000410000001446413701071075022576 0ustar www-datawww-datamodule Shoulda module Context 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 = build_test_name_from(should) if test_methods[test_unit_class][test_name.to_s] raise Shoulda::Context::DuplicateTestError.new( "'#{test_name}' is defined more than once." ) end test_methods[test_unit_class][test_name.to_s] = true file, line_no = should[:block].source_location # Ruby doesn't know that we are referring to this variable inside of the # eval, so it will emit a warning that it's "assigned but unused". # However, making a double assignment places `context` on the right hand # side of the assignment, thereby putting it into use. context = context = self test_unit_class.class_eval <<-end_eval, file, line_no define_method test_name do @shoulda_context = context begin context.run_parent_setup_blocks(self) if should[:before] instance_exec(&should[:before]) end context.run_current_setup_blocks(self) instance_exec(&should[:block]) ensure context.run_all_teardown_blocks(self) end end end_eval end def build_test_name_from(should) [ test_name_prefix, full_name, "should", "#{should[:name]}. " ].flatten.join(' ').to_sym 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) 'test_:' else 'test:' end end def method_missing(method, *args, &blk) test_unit_class.send(method, *args, &blk) end end class DuplicateTestError < RuntimeError; end end end shoulda-context-2.0.0/lib/shoulda/context/configuration.rb0000644000004100000410000000054613701071075023755 0ustar www-datawww-datamodule Shoulda module Context def self.configure yield self end def self.include(mod) test_framework_test_cases.each do |test_case| test_case.class_eval { include mod } end end def self.extend(mod) test_framework_test_cases.each do |test_case| test_case.extend(mod) end end end end shoulda-context-2.0.0/lib/shoulda/context/dsl.rb0000644000004100000410000002232113701071075021663 0ustar www-datawww-datarequire "shoulda/context/assertions" module Shoulda module Context module DSL def self.included(base) base.class_eval do include Assertions include InstanceMethods end base.extend(ClassMethods) 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 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 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) do |parent, local_name| parent.const_get(local_name, false) end 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 end end end shoulda-context-2.0.0/lib/shoulda/context/rails_test_unit_reporter_patch.rb0000644000004100000410000000126313701071075027414 0ustar www-datawww-databegin require "rails/test_unit/reporter" Rails::TestUnitReporter.class_eval do # Fix #format_rerun_snippet so that it works with recent versions of Minitest. # This was cribbed from: # def format_rerun_snippet(result) location, line = if result.respond_to?(:source_location) result.source_location else result.method(result.name).source_location end "#{executable} #{relative_path_for(location)}:#{line}" end end rescue LoadError # Rails::TestUnitReporter was introduced in Rails 5 end shoulda-context-2.0.0/lib/shoulda/context/autoload_macros.rb0000644000004100000410000000361013701071075024255 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-2.0.0/lib/shoulda/context/assertions.rb0000644000004100000410000000700613701071075023276 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] assert_match options[:message], matcher.failure_message_when_negated end else safe_assert_block(matcher.failure_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 = if matcher.respond_to?(:does_not_match?) matcher.does_not_match?(target) else !matcher.matches?(target) end if not_match safe_assert_block { true } if options[:message] assert_match options[:message], matcher.failure_message end else safe_assert_block(matcher.failure_message_when_negated) { 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-2.0.0/lib/shoulda/context/tasks.rb0000644000004100000410000000012313701071075022222 0ustar www-datawww-dataDir[File.join(File.dirname(__FILE__), 'tasks', '*.rake')].each do |f| load f end shoulda-context-2.0.0/CONTRIBUTING.md0000644000004100000410000000247013701071075017117 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-2.0.0/Gemfile0000644000004100000410000000043113701071075016154 0ustar www-datawww-datasource "https://rubygems.org" gemspec gem "appraisal" gem "bundler", "~> 1.0" gem "byebug" gem "m" gem "minitest" gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" gem "rubocop", "0.71.0" gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" shoulda-context-2.0.0/.ruby-version0000644000004100000410000000000613701071075017324 0ustar www-datawww-data2.7.1 shoulda-context-2.0.0/MIT-LICENSE0000644000004100000410000000212113701071075016313 0ustar www-datawww-dataCopyright (c) 2006-2020, Tammer Saleh and 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-2.0.0/exe/0000755000004100000410000000000013701071075015444 5ustar www-datawww-datashoulda-context-2.0.0/exe/convert_to_should_syntax0000755000004100000410000000250513701071075022542 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}'"