Sha256: e5780417a96f35b9a8b5f36b0d280359ba3d0c731311d36454e79dc5f7674e72
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require "spec_helper" describe Depot::Context do before do User.stub!(:find_or_create_by_name) @base = Depot::Base.new end subject { described_class.new(User, @base) } describe "#initialize" do its(:klass) { should eql User } its(:base) { should eql @base } end describe "#finder" do it "should change the finder criteria" do attributes = { email: "jonh@doe.com" } User.should_receive(:find_or_create_by_email).with(attributes) subject.finder(:email) subject.create(attributes) end end describe "#render_template" do output = subject.call.render_template(:example, { title: "Hello World" }, "spec/fixtures") output.should == "<h1>Hello World</h1>\n" end describe "#create" do it "should create a new entry given a hash" do subject.create({ name: "Jonh Doe", email: "jonh@doe.com", :as => :jonh_doe }) @base.entries.should have_key :jonh_doe end it "should create a new entry given a block" do subject.create :as => :jonh_doe do |p| p.name = "Jonh Doe" p.email = "jonh@doe.com" end @base.entries.should have_key :jonh_doe end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
depot-0.2.0 | spec/depot/context_spec.rb |