Sha256: 9cfe8d39d074a4280baa42c91bbf7422695825b4c05e148382c402989ee0671e

Contents?: true

Size: 963 Bytes

Versions: 4

Compression:

Stored size: 963 Bytes

Contents

require 'spec_helper'

describe Resource do

  def reset_resource(options = {})
    @valid_attributes = {
      :id => 1,
      :file => File.new(File.expand_path('../../uploads/refinery_is_awesome.txt', __FILE__))
    }.merge(options)

    @resource.destroy if @resource
    @resource = Resource.create!(@valid_attributes)
  end

  def resource_can_be_destroyed
    @resource.destroy.should == true
  end

  before(:each) do
    reset_resource
  end

  context "with valid attributes" do
    it "should create successfully" do
      @resource.errors.empty?
    end
  end

  context "resource url" do
    it "should respond to .url" do
      @resource.respond_to?(:url).should == true
    end

    it "should not support thumbnailing like images do" do
      @resource.respond_to?(:thumbnail).should == false
    end

    it "should contain its filename at the end" do
      @resource.url.should =~ %r{#{@resource.file_uid.split('/').last}$}
    end
  end


end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refinerycms-0.9.8.9 vendor/refinerycms/resources/spec/models/resource_spec.rb
refinerycms-0.9.8.8 vendor/refinerycms/resources/spec/models/resource_spec.rb
refinerycms-0.9.8.7 vendor/refinerycms/resources/spec/models/resource_spec.rb
refinerycms-0.9.8.6 vendor/refinerycms/resources/spec/models/resource_spec.rb