Sha256: 19e294e69133b884396aaa7d055f2838acf291978786db0d4935bac53539e75f
Contents?: true
Size: 1.77 KB
Versions: 6
Compression:
Stored size: 1.77 KB
Contents
require 'test_helper' module Vedeu module DSL describe Menu do let(:described) { Vedeu::DSL::Menu } let(:instance) { described.new(model) } let(:model) { Vedeu::Menu.new(attributes) } let(:attributes) { { collection: collection, name: menu_name, } } let(:collection) { [:sodium, :magnesium, :aluminium, :silicon] } let(:menu_name) { 'elements' } describe '#initialize' do it { instance.must_be_instance_of(described) } it { instance.instance_variable_get('@model').must_equal(model) } end describe '#item' do let(:_value) { :platinum } subject { instance.item(_value) } it { instance.must_respond_to(:item=) } context 'when items are provided' do it { subject.must_equal([:sodium, :magnesium, :aluminium, :silicon, :platinum]) } end end describe '#items' do let(:_value) { [] } subject { instance.items(_value) } it { instance.must_respond_to(:items=) } context 'when no items are provided' do it { subject.must_equal([]) } end context 'when items are provided' do let(:_value) { [:gold, :silver, :tin] } it { subject.must_equal(_value)} end end describe '#name' do let(:_value) { 'metals' } subject { instance.name(_value) } it { instance.must_respond_to(:name=) } it 'returns the name of the menu' do subject model.name.must_equal('metals') end end end # Menu end # DSL end # Vedeu
Version data entries
6 entries across 6 versions & 1 rubygems