File: options_class_method.rb

package info (click to toggle)
ruby-virtus 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 660 kB
  • sloc: ruby: 4,378; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
shared_examples_for 'an options class method' do
  context 'with no argument' do
    subject { object.send(method) }

    it { is_expected.to be(default) }
  end

  context 'with a default value' do
    subject { object.send(method, value) }

    let(:value) { mock('value') }

    it { is_expected.to equal(object) }

    it 'sets the default value for the class method' do
      expect { subject }.to change { object.send(method) }.from(default).to(value)
    end
  end
end