Sha256: e1a3aa020c007b86c2dde6a1bb240cce08791c6b8d1c99e7893485f965897bf4

Contents?: true

Size: 1.52 KB

Versions: 29

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe CassandraObject::Base do
  it "should be able to a create/fetch/destroy an issue" do
    issue = Issue.create! :description => 'web site not working', :worth => 1.5
    expect(issue.persisted?).to be true
    issue = Issue.find issue.id
    expect(issue.worth.to_f).to be 1.5
    issue.destroy
    expect(Issue.find_by_id(issue.id)).to be nil
  end

  it "should be able to get the first issue" do
    issue = Issue.create! :description => 'web site not working', :worth => 1.5
    expect(Issue.first.id).to eq issue.id
  end

  it "should be able to get all issues" do
    issue1 = Issue.create! :description => 'web site not working', :worth => 1.5
    issue2 = Issue.create! :description => 'button is disabled', :worth => 0.2
    expect(Issue.all.map(&:id).sort).to eq [issue1.id, issue2.id].sort
  end

  it "should be able to find issues by id" do
    issue1 = Issue.create! :description => 'web site not working', :worth => 1.5
    issue2 = Issue.create! :description => 'button is disabled', :worth => 0.2
    issue3 = Issue.create! :description => 'button is disabled', :worth => 0.2
    expect(Issue.find_with_ids(issue1.id, issue2.id).map(&:id).sort).to eq [issue1.id, issue2.id].sort
  end

  it "should be able to get all issues" do
    issue1 = Issue.create! :description => 'web site not working', :worth => 1.5
    issue2 = Issue.create! :description => 'button is disabled', :worth => 0.2
    expect(Issue.find_with_ids([issue1.id, issue2.id]).map(&:id).sort).to eq [issue1.id, issue2.id].sort
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
sessionm-cassandra_object-4.0.32 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.31 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.30 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.29 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.28 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.27 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.26 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.25 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.24 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.23 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.22 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.21 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.20 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.18 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.17 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.16 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.15 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.14 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.13 spec/cassandra_object/base_spec.rb
sessionm-cassandra_object-4.0.12 spec/cassandra_object/base_spec.rb