Sha256: bb6ff71b7d179fdd76a3e1a678d1d06dc8fad6eab7e63fc8a907bab67f107b04
Contents?: true
Size: 1.32 KB
Versions: 30
Compression:
Stored size: 1.32 KB
Contents
require 'test_helper' module Vedeu class ToggleableTestClass include Vedeu::Toggleable def initialize(boolean) @visible = boolean end def store self end end describe Toggleable do let(:described) { Vedeu::Toggleable } let(:instance) { Vedeu::ToggleableTestClass.new(visible) } let(:visible) { false } describe 'accessors' do it { instance.must_respond_to(:visible) } it { instance.must_respond_to(:visible=) } it { instance.must_respond_to(:visible?) } end describe '#hide' do subject { instance.hide } it { subject instance.instance_variable_get('@visible').must_equal(false) } end describe '#show' do subject { instance.show } it { subject instance.instance_variable_get('@visible').must_equal(true) } end describe '#toggle' do subject { instance.toggle } context 'when the model is visible' do let(:visible) { true } it { subject instance.instance_variable_get('@visible').must_equal(false) } end context 'when the model is not visible' do it { subject instance.instance_variable_get('@visible').must_equal(true) } end end end # Toggleable end # Vedeu
Version data entries
30 entries across 30 versions & 1 rubygems