spec/lib/buttercms/butter_resource_spec.rb in buttercms-ruby-1.6 vs spec/lib/buttercms/butter_resource_spec.rb in buttercms-ruby-1.7
- old
+ new
@@ -6,9 +6,20 @@
allow(ButterCMS).to receive(:request).and_return({"data" => [{"attribute" => 'test'}]})
allow(ButterCMS::ButterResource).to receive(:resource_path).and_return('')
end
+ describe 'auto-generated methods' do
+ let(:resource) { described_class.new('data' => { 'name' => 'Test Name', 'description' => 'Test Description' }) }
+
+ it 'creates attribute reader methods for data pairs' do
+ aggregate_failures do
+ expect(resource.name).to eq('Test Name')
+ expect(resource.description).to eq('Test Description')
+ end
+ end
+ end
+
describe '.all' do
it 'should make a request with the correct endpoint' do
expect(ButterCMS).to receive(:request).with('', {})
ButterCMS::ButterResource.all()