Sha256: 1b6366ba530faf1150f8fda1b81b4febfc6d0c0882c442dfe579fdffa019b295

Contents?: true

Size: 918 Bytes

Versions: 22

Compression:

Stored size: 918 Bytes

Contents

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

class PrivateHelpersTest < Test::Unit::TestCase # :nodoc:
  include 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

22 entries across 22 versions & 7 rubygems

Version Path
Flamefork-shoulda-2.10.1 test/other/private_helpers_test.rb
Flamefork-shoulda-2.10.2 test/other/private_helpers_test.rb
francois-shoulda-2.10.1 test/other/private_helpers_test.rb
ratnikov-shoulda-2.0.6.1 test/other/private_helpers_test.rb
ratnikov-shoulda-2.0.6.2 test/other/private_helpers_test.rb
ratnikov-shoulda-2.0.6.3 test/other/private_helpers_test.rb
ratnikov-shoulda-2.9.0.1 test/other/private_helpers_test.rb
ratnikov-shoulda-2.9.0.2 test/other/private_helpers_test.rb
ratnikov-shoulda-2.9.0.3 test/other/private_helpers_test.rb
ratnikov-shoulda-2.9.0 test/other/private_helpers_test.rb
rmm5t-shoulda-2.9.1 test/other/private_helpers_test.rb
technicalpickles-shoulda-2.10.0 test/other/private_helpers_test.rb
thoughtbot-shoulda-2.10.0 test/other/private_helpers_test.rb
thoughtbot-shoulda-2.10.1 test/other/private_helpers_test.rb
thoughtbot-shoulda-2.9.0 test/other/private_helpers_test.rb
thoughtbot-shoulda-2.9.1 test/other/private_helpers_test.rb
thoughtbot-shoulda-2.9.2 test/other/private_helpers_test.rb
shoulda-2.9.0 test/other/private_helpers_test.rb
shoulda-2.9.1 test/other/private_helpers_test.rb
shoulda-2.9.2 test/other/private_helpers_test.rb