Sha256: 60f4b05bdd22eaf0fcde09b86a011f691a1fe06c70c75dcb785fb01e24131b91
Contents?: true
Size: 1.72 KB
Versions: 5
Compression:
Stored size: 1.72 KB
Contents
require 'spec_helper' require 'cells' class DummyCell < Cell::Base def show "<p>I'm Dummy.</p>" end def update(what) "Updating #{what}." end end module RSpec::Rails describe CellExampleGroup do let(:group) do RSpec::Core::ExampleGroup.describe do include CellExampleGroup end end it "adds :type => :cell to the metadata" do group.metadata[:type].should eq(:cell) end describe "#render_cell" do it "renders a state" do group.new.render_cell(:dummy, :show).should == "<p>I'm Dummy.</p>" end it "allows passing state args" do group.new.render_cell(:dummy, :update, "this").should == "Updating this." end end it "responds to #cell" do group.new.cell(:dummy).should be_kind_of(DummyCell) end # FIXME: could anyone make capybara/rails work in these tests? # it "allows using matchers with #render_state" do # cell(:dummy).render_state(:show).should have_selector("p") # end context "as a test writer" do include CellExampleGroup it "should support _path helpers from the controller" do # We have to stub include so that things determine the route exists. Rails.application.routes.named_routes.helpers.stub(:include?).and_return(:true) @controller.should_receive(:test_path).at_least(:once) test_path end it "should support polymorphic_path from the controller" do # We have to stub include so that things determine the route exists. Rails.application.routes.named_routes.helpers.stub(:include?).and_return(:true) @controller.should_receive(:test_path).at_least(:once) polymorphic_path(:test) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems