Sha256: e2987fff4d80a2e6e859b7d9de38bc12d2df3c6df26d3a135362d9f1460a9858
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' describe Sinatra::RMceUploadr::ImagesController, :type => :controller do before(:each) do @image_data = mock("image data", :url => "image url") @image = mock("image", :data => @image_data, :size_in_bytes => "10Kb", :geometry => "10x11") RMceUploadr::Image.stub!(:find).and_return(@image) RMceUploadr::Image.stub!(:all).and_return([@image]) end it "should find all images" do RMceUploadr::Image.should_receive(:all) get '/rmce_uploadr/images' end it "should render found images" do get '/rmce_uploadr/images' last_response.body.gsub(/[\n\r]/, '').should =~ /<img .*src="image url" .*data-src-original="image url"/ end it "should display image size and geometry" do get '/rmce_uploadr/images' last_response.body.should =~ /<span .*>#{@image.size_in_bytes}, #{@image.geometry}/ end it "should say something of no images found" do RMceUploadr::Image.stub!(:all).and_return([]) get '/rmce_uploadr/images' last_response.body.should =~ /no images found/i end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rmce_uploadr-0.0.3 | spec/images_controller_spec.rb |