Sha256: afaae258612f38417d2de8de422115afe8f61742a8e33b071f13dccaf7ed0aad

Contents?: true

Size: 930 Bytes

Versions: 48

Compression:

Stored size: 930 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'test_helper')

class PrivateHelpersTest < Test::Unit::TestCase # :nodoc:
  include ThoughtBot::Shoulda::Private
  context "get_options!" do
    should "remove opts from args" do
      args = [:a, :b, {}]
      get_options!(args)
      assert_equal [:a, :b], args
    end

    should "return wanted opts in order" do
      args = [{:one => 1, :two => 2}]
      one, two = get_options!(args, :one, :two)
      assert_equal 1, one
      assert_equal 2, two
    end

    should "raise ArgumentError if given unwanted option" do
      args = [{:one => 1, :two => 2}]
      assert_raises ArgumentError do
        get_options!(args, :one)
      end
    end
  end

  class ::SomeModel; end
  context "model_class" do
    should "sniff the class constant from the test class" do
      self.expects(:name).returns("SomeModelTest")
      assert_equal SomeModel, model_class
    end
  end
end

Version data entries

48 entries across 48 versions & 11 rubygems

Version Path
emschwar-shoulda-2.0.6.1 test/other/private_helpers_test.rb
francois-shoulda-2.0.5.1 test/other/private_helpers_test.rb
francois-shoulda-2.0.5.2 test/other/private_helpers_test.rb
francois-shoulda-2.0.5.4 test/other/private_helpers_test.rb
gsterndale-warrant-0.2.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.6/test/other/private_helpers_test.rb
gsterndale-warrant-0.3.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.6/test/other/private_helpers_test.rb
hashrocket-clearance-0.4.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/private_helpers_test.rb
hashrocket-clearance-0.4.1 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/private_helpers_test.rb
hashrocket-clearance-0.4.2 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/private_helpers_test.rb
hashrocket-clearance-0.4.3 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/private_helpers_test.rb
mattknox-goaloc-0.3.0 lib/goaloc/generators/resources/shoulda/test/other/private_helpers_test.rb
mattknox-goaloc-0.4.0 lib/goaloc/generators/resources/shoulda/test/other/private_helpers_test.rb
mjankowski-shoulda-2.0.4 test/other/private_helpers_test.rb
mjankowski-shoulda-2.0.5 test/other/private_helpers_test.rb
rmm5t-shoulda-2.0.2 test/other/private_helpers_test.rb
rmm5t-shoulda-2.0.5 test/other/private_helpers_test.rb
rmm5t-shoulda-2.0.6 test/other/private_helpers_test.rb
technicalpickles-shoulda-2.0.0 test/other/private_helpers_test.rb
technicalpickles-shoulda-2.0.1 test/other/private_helpers_test.rb
technicalpickles-shoulda-2.0.2 test/other/private_helpers_test.rb