Created
September 5, 2008 21:49
-
-
Save paul/9034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') | |
describe Templates, "index action" do | |
before :all do | |
create_template_xml 'simple', <<-"XML" | |
<template name="simple" description="The simplest template possible" /> | |
XML | |
end | |
before do | |
end | |
def get_index | |
dispatch_to(Templates, :index) | |
end | |
it "should be successful" do | |
get_index.should be_successful | |
end | |
it "should get all the templates" do | |
get_index.assigns(:templates).should have(1).object | |
end | |
it "SHOULD DO A LOT MORE" # TODO | |
after :all do | |
wipe_templates | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Templates < Application | |
provides :html, :sscj1 | |
def index | |
@templates = Template.all | |
display @templates | |
end | |
def show | |
@template = Template.get(params[:id]) | |
raise NotFound unless @template | |
display @template | |
end | |
end # Templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<template name="Questions Template Test" description="For testing various question types"> | |
<questions> | |
<question name="empty"> | |
<text>This question has no default, regex or choices</text> | |
</question> | |
<question name="with-default"> | |
<text>This question has a default answer</text> | |
<default>1.0</default> | |
</question> | |
<question name="regex-validation"> | |
<text>This question has a regex to validate the answer</text> | |
<regex>^\d+$</regex> | |
</question> | |
<question name="choices"> | |
<text>This question has some choices</text> | |
<choice-list> | |
<choice title="No" value="0"/> | |
<choice title="Yes" value="1"/> | |
</choice-list> | |
</question> | |
</questions> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment