Sha256: 3275211fae6962ea1f8fac02fb4d8d53e9ad4beb8f12befe4f78a2000e50247c
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' describe Resource do describe '#resource' do before do class Example < Resource property :login property :name property :age, type: Float end end it "returns a hash with properties and its values" do example = Example.new(login: 'jackiechan2010', name: 'Jackie Chan', age: 45) example.resource.should == {login: 'jackiechan2010', name: 'Jackie Chan', age: 45} end end context "when using not allowed names" do [:resource_id, :resource, :links].each do |unallowed| it "warns when method #{unallowed} is redefined" do output = out do eval <<-RUBY class Example < Resource def #{unallowed} end end RUBY end output.should =~ /^warning: redefining '#{unallowed}' may cause serious problems/ end %w(property embeds_one embeds_many has_one has_many belongs_to).each do |kind| it "removes method #{unallowed} created by #{kind}" do expect { eval <<-RUBY class Example < Resource #{kind} :#{unallowed} end RUBY }.to raise_error "you can't define a key with name '#{unallowed}'" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transcriber-0.0.3 | spec/unit/resource_spec.rb |
transcriber-0.0.2 | spec/unit/resource_spec.rb |