Sha256: 90a550f499b560490b1358d45520fa72a228263e7d7c402fd180a7990be8654d
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' require 'katapult/wui' require 'katapult/model' require 'katapult/application_model' describe Katapult::WUI do subject { described_class.new 'wui' } let(:application_model) { Katapult::ApplicationModel.new } describe '#path' do it 'raises an error if the given action does not exist' do expect do subject.path(:foobar) end.to raise_error(Katapult::WUI::UnknownActionError) end end describe '#model' do it 'returns the model object' do subject = described_class.new('Customer', model: 'User') model = Katapult::Model.new('User') application_model.add_wui(subject) application_model.add_model(model) expect(subject.model).to eql(model) end it 'detects the model from its own name, if not stated explicitly' do subject = described_class.new('Customer') model = Katapult::Model.new('Customer') application_model.add_wui(subject) application_model.add_model(model) expect(subject.model).to eql(model) end it 'raises an error if it cannot find the model' do subject = described_class.new('MissingModel') application_model.add_wui(subject) expect{ subject.model }.to raise_error(Katapult::WUI::UnknownModelError) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
katapult-0.1.2 | spec/wui_spec.rb |
katapult-0.1.1 | spec/wui_spec.rb |
katapult-0.1.0 | spec/wui_spec.rb |