Sha256: 693a4ca324c96a20ce3c09cfba76f1b6d004cd276d83a15cc4c45635eec12f2a

Contents?: true

Size: 1.01 KB

Versions: 67

Compression:

Stored size: 1.01 KB

Contents

require 'test_helper'

class CassandraObject::AttributeMethodsTest < CassandraObject::TestCase
  test 'read and write attributes' do
    issue = Issue.new
    assert_nil issue.read_attribute(:description)

    issue.write_attribute(:description, nil)
    assert_nil issue.read_attribute(:description)

    issue.write_attribute(:description, 'foo')
    assert_equal 'foo', issue.read_attribute(:description)
  end

  test 'hash accessor aliases' do
    issue = Issue.new

    issue[:description] = 'bar'

    assert_equal 'bar', issue[:description]
  end

  # test 'attribute_exists' do
  #   assert !Issue.new.attribute_exists?(:description)
  #   assert Issue.new(description: nil).attribute_exists?(:description)
  #   assert Issue.new(description: false).attribute_exists?(:description)
  #   assert Issue.new(description: 'hey').attribute_exists?(:description)
  # end

  test 'attributes setter' do
    issue = Issue.new

    issue.attributes = {
      description: 'foo'
    }

    assert_equal 'foo', issue.description
  end
end

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
cassandra_object_rails-0.0.1 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.9.2 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.9.1 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.9.0 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.8.1 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.8.0 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.7.3 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.7.2 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.7.1 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.7.0 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.6.0 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.5.1 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.5.0 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.4.5 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.4.4 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.4.3 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.4.0 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.3.2 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.3.1 test/unit/attribute_methods_test.rb
gotime-cassandra_object-4.3.0 test/unit/attribute_methods_test.rb