Sha256: fe0cc22a1e3d5245d0fc0971becd03b273336d929bdda6a1a7c8ef370657ca7a
Contents?: true
Size: 1.29 KB
Versions: 23
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, :link].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
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
transcriber-0.0.6 | spec/unit/resource_spec.rb |
transcriber-0.0.5 | spec/unit/resource_spec.rb |
transcriber-0.0.4 | spec/unit/resource_spec.rb |