Sha256: e14b09f53214d70ad2f0ea56ac38537871228b7f82190d23eb867f378ad75359

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

require 'spec_helper'
require 'support/query_struct'

RSpec.describe Support::QueryStruct do
  subject { described_class.new(first: 1, second: 2) }

  describe '#new' do
    it 'assigns attributes according to the given options' do
      expect(subject.first).to eq 1
      expect(subject.second).to eq 2
    end
  end

  it 'permits reading arbitrary attributes' do
    expect(subject.fourty_second).to be nil
  end

  it 'permits writing arbitrary attributes' do
    subject.fourty_second = 42
    expect(subject.fourty_second).to eq 42
  end

  it 'permits querying arbitrary attributes' do
    expect(subject.fourty_second?).to be false
    subject.fourty_second = 42
    expect(subject.fourty_second?).to be true
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rail-0.1.1 spec/lib/support/query_struct_spec.rb
rail-0.1.0 spec/lib/support/query_struct_spec.rb
rail-0.0.8 spec/lib/support/query_struct_spec.rb