Sha256: 1f7227ee98291ec3710ffc22dba1f48331fe56aa3f463da603141814939f5a95
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' describe Olson do context "when using Draper and ActiveModel" do let(:object) { User.new } let(:decorated) { UserDecorator.decorate(object) } before { object.status = 'submitted' } it "humanizes a field" do decorated.status.should == "Submitted" end it 'humanizes with I18n when specified' do object.status = 'rejected' decorated.status.should == 'OMG Fail' end it 'humanizes options for select' do UserDecorator.status_options.should == [ ["Approved", "approved"], ["OMG Fail", "rejected"], ] end context 'overriding the default behaviour' do let(:decorated) { CustomUserDecorator.decorate(object) } it "humanizes a field" do decorated.status.should == "SUBMITTED" end it 'humanizes options for select' do CustomUserDecorator.status_options.should == [ ["APPROVED", "approved"], ["OMG Fail", "rejected"], ] end end end context 'without draper' do let(:object) { Human.new } let(:decorated) { HumanDecorator.new(object) } it 'humanizes a field' do object.status = 'submitted' decorated.status.should == 'Submitted' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
olson-0.0.3 | spec/olson_spec.rb |