Sha256: 4c26e15bf9b31ce765dadc58d462b47d38d99599600aea63f3afdfcc29626ed9

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

require File.expand_path('../test_helper', __FILE__)

module Loquor
  class ResourceMockTest < Minitest::Test
    class Foobar < Resource
      extend ResourceMock
      self.attributes = {
        name: "Foobar"
      }
    end

    def test_should_be_able_to_set_allowed_attributes
      name = "Cat"
      foobar = Foobar.find(1)
      foobar.name = name
      assert_equal name, foobar.name
    end

    def test_should_not_be_able_to_set_arbitary_attributes
      foobar = Foobar.find(1)
      assert_raises(NameError) do
        foobar.description = "Cat"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loquor-0.5.2 test/resource_mock_test.rb