spec/models/photos_spec.rb in flickrmocks-0.8.15 vs spec/models/photos_spec.rb in flickrmocks-0.9.0
- old
+ new
@@ -1,16 +1,18 @@
require 'spec_helper'
-describe APP::Photos do
+describe APP::Models::Photos do
let(:api) {APP::Api}
- let(:klass) {APP::Photos}
+ let(:models){APP::Models}
+ let(:klass) {models::Photos}
let(:fixtures){APP::Fixtures.instance}
let(:photos_fixture) {fixtures.photos}
let(:interesting_photos_fixture){fixtures.interesting_photos}
+
subject {klass.new photos_fixture}
- let(:max_pages){subject.default(:max_entries)/subject.default(:per_page)}
+ let(:max_pages){subject.max_entries/subject.per_page}
context "class methods" do
specify { klass.should respond_to(:defaults)}
context "defaults" do
before(:each) do
@@ -37,12 +39,12 @@
context "class instance variables" do
context "@defaults" do
specify { klass.defaults.should have_key(:max_entries) }
specify { klass.defaults.should have_key(:per_page) }
- it "returns 50 for argument :per_page" do
- klass.defaults[:per_page].should == 50
+ it "returns 200 for argument :per_page" do
+ klass.defaults[:per_page].should == FlickrMocks::Api.default(:per_page).to_i
end
it "returns 4000 for argument :max_entries" do
klass.defaults[:max_entries].should == 4000
end
end
@@ -179,11 +181,11 @@
it "returns kind of Array" do
subject.photos.should be_an(Array)
end
it "returns Array containing elements of class FlickrMocks::Photo " do
subject.photos.each do |photo|
- photo.should be_instance_of(APP::Photo)
+ photo.should be_instance_of(models::Photo)
end
end
it "returns expected number of photos" do
subject.photos.length.should == fixtures.photos.map(&:id).length
end
@@ -259,10 +261,10 @@
context "meta-programming" do
specify{ subject.should respond_to(:delegated_instance_methods)}
context "#delegated_instance_methods" do
it "returns expected list of methods that are delegated to other objects" do
- subject.delegated_instance_methods.should == APP::Models::Helpers.array_accessor_methods
+ subject.delegated_instance_methods.should == models::Helpers.array_accessor_methods
end
end
specify { subject.should respond_to(:methods)}
context "#methods" do