Files
openfoodnetwork/spec/models/spree/preferences/file_configuration_spec.rb
Rob Harrington 59578a73af Changing all references to 'be_true' and 'be_false' to 'be true' and 'be false'
See next commit for changes where this substitution was broken
2017-11-10 08:47:12 +11:00

58 lines
1.4 KiB
Ruby

require 'spec_helper'
module Spree
module Preferences
class TestConfiguration < FileConfiguration
preference :name, :string
include OpenFoodNetwork::Paperclippable
preference :logo, :file
has_attached_file :logo
end
describe FileConfiguration do
let(:c) { TestConfiguration.new }
describe "getting preferences" do
it "returns regular preferences" do
c.name = 'foo'
c.get_preference(:name).should == 'foo'
end
it "returns file preferences" do
c.get_preference(:logo).should be_a Paperclip::Attachment
end
it "returns regular preferences via []" do
c.name = 'foo'
c[:name].should == 'foo'
end
it "returns file preferences via []" do
c[:logo].should be_a Paperclip::Attachment
end
end
describe "getting preference types" do
it "returns regular preference types" do
c.preference_type(:name).should == :string
end
it "returns file preference types" do
c.preference_type(:logo).should == :file
end
end
describe "respond_to?" do
it "responds to preference getters" do
c.respond_to?(:name).should be true
end
it "responds to preference setters" do
c.respond_to?(:name=).should be true
end
end
end
end
end