Sha256: efeeff12e2298074624168adc44f87b59598ff8c43cc78c867001acafee718bb

Contents?: true

Size: 1.06 KB

Versions: 37

Compression:

Stored size: 1.06 KB

Contents

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

class AssignToMatcherTest < ActionController::TestCase # :nodoc:

  context "a controller that assigns to an instance variable" do
    setup do
      @controller = build_response { @var = 'value' }
    end

    should "accept assigning to that variable" do
      assert_accepts assign_to(:var), @controller
    end

    should "accept assigning to that variable with the correct class" do
      assert_accepts assign_to(:var).with_kind_of(String), @controller
    end

    should "reject assigning to that variable with another class" do
      assert_rejects assign_to(:var).with_kind_of(Fixnum), @controller
    end

    should "accept assigning the correct value to that variable" do
      assert_accepts assign_to(:var).with('value'), @controller
    end

    should "reject assigning another value to that variable" do
      assert_rejects assign_to(:var).with('other'), @controller
    end

    should "reject assigning to another variable" do
      assert_rejects assign_to(:other), @controller
    end
  end

end

Version data entries

37 entries across 37 versions & 9 rubygems

Version Path
auser-poolparty-1.3.0 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.1 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.10 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.11 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.12 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.13 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.14 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.15 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.16 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.17 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.2 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.3 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.4 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.5 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.6 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.7 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
auser-poolparty-1.3.8 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
fairchild-poolparty-1.3.17 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
fairchild-poolparty-1.3.5 vendor/gems/shoulda/test/matchers/controller/assign_to_matcher_test.rb
thoughtbot-shoulda-2.10.2 test/matchers/controller/assign_to_matcher_test.rb