Browse files

End of Chapter 6

  • Loading branch information...
1 parent a4a5d58 commit d2e59df6462d4edcd5363b40933d7b80d808e160 Chris Kenward committed May 5, 2011
View
8 .idea/.generators
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Settings><!--This file was automatically generated by Ruby plugin.
+You are allowed to:
+1. Reorder generators
+2. Remove generators
+3. Add installed generators
+To add new installed generators automatically delete this file and reload the project.
+--><GeneratorsGroup><Generator name="controller" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="observer" /><Generator name="performance_test" /><Generator name="plugin" /><Generator name="resource" /><Generator name="rspec:install" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="session_migration" /><Generator name="stylesheets" /><Generator name="test_unit:controller" /><Generator name="test_unit:helper" /><Generator name="test_unit:integration" /><Generator name="test_unit:mailer" /><Generator name="test_unit:model" /><Generator name="test_unit:observer" /><Generator name="test_unit:performance" /><Generator name="test_unit:plugin" /><Generator name="test_unit:scaffold" /></GeneratorsGroup></Settings>
View
1 .idea/.name
@@ -0,0 +1 @@
+sample_app
View
7 .idea/.rakeTasks
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Settings><!--This file was automatically generated by Ruby plugin.
+You are allowed to:
+1. Remove rake task
+2. Add existing rake tasks
+To add existing rake tasks automatically delete this file and reload the project.
+--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
View
1 .idea/dataSources.ids
@@ -0,0 +1 @@
+<?xml version='1.0' ?><component name="dataSourceStorage"><data-source source="LOCAL" name="Rails sample_app: development" product="" version="" jdbc-version="" driver-version="" uuid="4b145d5a-8a67-4199-a9fc-03904ad28ef7"><jdbc-driver>org.sqlite.JDBC</jdbc-driver><jdbc-url>jdbc:sqlite:/home/chrisk/dev/rails_tutorial/sample_app/db/development.sqlite3</jdbc-url><libraries><library><url>jar://$USER_HOME$/.RubyMine31/config/jdbc-drivers/sqlitejdbc-v056.jar!/</url></library></libraries></data-source></component>
View
5 .idea/dataSources.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="DataSourceManagerImpl" compressed="false" />
+</project>
+
View
5 .idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
View
8 .idea/misc.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.2-p180 [rails3tutorial]" project-jdk-type="RUBY_SDK" />
+</project>
+
View
9 .idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/sample_app.iml" filepath="$PROJECT_DIR$/.idea/sample_app.iml" />
+ </modules>
+ </component>
+</project>
+
View
90 .idea/sample_app.iml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="RUBY_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="RailsFacetType" name="Ruby on Rails">
+ <configuration>
+ <RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
+ <RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
+ <RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
+ </configuration>
+ </facet>
+ </component>
+ <component name="GemRequirementsHolder" version="3">
+ <requirement>
+ <requirement>
+ <dependency name="rails" version="3.0.7" bound="EQUAL" git="false" path="false" doRequire="true" />
+ </requirement>
+ <source from="Gemfile" />
+ </requirement>
+ <requirement>
+ <requirement>
+ <dependency name="rspec" version="2.5.0" bound="EQUAL" git="false" path="false" doRequire="true" />
+ </requirement>
+ <source from="Gemfile" />
+ </requirement>
+ <requirement>
+ <requirement>
+ <dependency name="rspec-rails" version="2.5.0" bound="EQUAL" git="false" path="false" doRequire="true" />
+ </requirement>
+ <source from="Gemfile" />
+ </requirement>
+ <requirement>
+ <requirement>
+ <dependency name="spork" version="0.9.0.rc5" bound="EQUAL" git="false" path="false" doRequire="true" />
+ </requirement>
+ <source from="Gemfile" />
+ </requirement>
+ <requirement>
+ <requirement>
+ <dependency name="sqlite3-ruby" version="0" bound="GREATER_OR_EQUAL" lib="sqlite3" git="false" path="false" doRequire="true" />
+ </requirement>
+ <source from="Gemfile" />
+ </requirement>
+ <requirement>
+ <requirement>
+ <dependency name="webrat" version="0.7.1" bound="EQUAL" git="false" path="false" doRequire="true" />
+ </requirement>
+ <source from="Gemfile" />
+ </requirement>
+ </component>
+ <component name="NewModuleRootManager">
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rake (v0.8.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.8.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] mime-types (v1.16, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/mime-types-1.16)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] treetop (v1.4.9, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/treetop-1.4.9)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] tzinfo (v0.3.27, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/tzinfo-0.3.27)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] abstract (v1.0.0, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/abstract-1.0.0)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rack (v1.2.2, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rack-1.2.2)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] arel (v2.0.9, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/arel-2.0.9)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] i18n (v0.5.0, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/i18n-0.5.0)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] thor (v0.14.6, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/thor-0.14.6)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] activemodel (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activemodel-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] railties (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] actionmailer (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/actionmailer-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rails (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rails-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rack-mount (v0.6.14, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rack-mount-0.6.14)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] actionpack (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/actionpack-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] activesupport (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rack-test (v0.5.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rack-test-0.5.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] polyglot (v0.3.1, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/polyglot-0.3.1)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] builder (v2.1.2, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/builder-2.1.2)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] activerecord (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activerecord-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] mail (v2.2.19, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/mail-2.2.19)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] bundler (v1.0.12, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/bundler-1.0.12)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] activeresource (v3.0.7, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activeresource-3.0.7)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] erubis (v2.6.6, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/erubis-2.6.6)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rspec (v2.5.0, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-2.5.0)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rspec-rails (v2.5.0, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-rails-2.5.0)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rspec (v2.5.0, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-2.5.0)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] diff-lcs (v1.1.2, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/diff-lcs-1.1.2)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rspec-mocks (v2.5.0, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-mocks-2.5.0)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rspec-core (v2.5.1, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.5.1)" level="application" />
+ <orderEntry type="library" scope="PROVIDED" name="[gem] rspec-expectations (v2.5.0, /home/chrisk/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-expectations-2.5.0)" level="application" />
+ </component>
+</module>
+
View
7 .idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
+ </component>
+</project>
+
View
344 .idea/workspace.xml
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ChangeListManager">
+ <list default="true" id="65f3dc4f-a924-4a2e-904a-176e720129cc" name="Default" comment="" />
+ <ignored path="sample_app.iws" />
+ <ignored path=".idea/workspace.xml" />
+ <option name="TRACKING_ENABLED" value="true" />
+ <option name="SHOW_DIALOG" value="false" />
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+ <option name="LAST_RESOLUTION" value="IGNORE" />
+ </component>
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
+ <component name="CoverageDataManager" choice="3" />
+ <component name="CreatePatchCommitExecutor">
+ <option name="PATCH_PATH" value="" />
+ <option name="REVERSE_PATCH" value="false" />
+ </component>
+ <component name="DaemonCodeAnalyzer">
+ <disable_hints />
+ </component>
+ <component name="FavoritesManager">
+ <favorites_list name="sample_app" />
+ </component>
+ <component name="FindManager">
+ <FindUsagesManager>
+ <setting name="OPEN_NEW_TAB" value="false" />
+ </FindUsagesManager>
+ </component>
+ <component name="Git.Settings">
+ <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
+ <option name="UPDATE_CHANGES_POLICY" value="STASH" />
+ </component>
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectReloadState">
+ <option name="STATE" value="0" />
+ </component>
+ <component name="ProjectView">
+ <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
+ <flattenPackages />
+ <showMembers />
+ <showModules />
+ <showLibraryContents />
+ <hideEmptyPackages />
+ <abbreviatePackageNames />
+ <autoscrollToSource />
+ <autoscrollFromSource />
+ <sortByType />
+ </navigator>
+ <panes>
+ <pane id="Favorites" />
+ <pane id="Scope" />
+ <pane id="ProjectPane">
+ <subPane>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="sample_app" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="sample_app" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="sample_app" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </pane>
+ <pane id="RailsProjectView" />
+ </panes>
+ </component>
+ <component name="PropertiesComponent">
+ <property name="options.splitter.main.proportions" value="0.3" />
+ <property name="options.lastSelected" value="org.jetbrains.plugins.ruby.settings.RubyIdeSdkConfigurable" />
+ <property name="recentsLimit" value="5" />
+ <property name="options.searchVisible" value="true" />
+ <property name="options.splitter.details.proportions" value="0.2" />
+ </component>
+ <component name="RunManager" selected="Rails.Development: sample_app">
+ <configuration default="true" type="RakeRunConfigurationType" factoryName="Rake">
+ <module name="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
+ <method />
+ </configuration>
+ <configuration default="true" type="RailsRunConfigurationType" factoryName="Rails">
+ <predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
+ <module name="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
+ <method />
+ </configuration>
+ <configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
+ <predefined_log_file id="RUBY_RSPEC" enabled="true" />
+ <module name="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
+ <method />
+ </configuration>
+ <configuration default="false" name="test" type="RakeRunConfigurationType" factoryName="Rake">
+ <module name="sample_app" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs>
+ <env name="RAILS_ENV" value="test" />
+ </envs>
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
+ <method />
+ </configuration>
+ <configuration default="false" name="spec" type="RakeRunConfigurationType" factoryName="Rake">
+ <module name="sample_app" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
+ <method />
+ </configuration>
+ <configuration default="false" name="Production: sample_app" type="RailsRunConfigurationType" factoryName="Rails">
+ <predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
+ <module name="sample_app" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="production" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
+ <method />
+ </configuration>
+ <configuration default="false" name="Development: sample_app" type="RailsRunConfigurationType" factoryName="Rails">
+ <predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
+ <module name="sample_app" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$PROJECT_DIR$" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
+ <envs />
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" track_test_folders="true" runner="rcov">
+ <COVERAGE_PATTERN ENABLED="true">
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
+ </COVERAGE_PATTERN>
+ </EXTENSION>
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
+ <RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
+ <method />
+ </configuration>
+ <list size="4">
+ <item index="0" class="java.lang.String" itemvalue="Rake.test" />
+ <item index="1" class="java.lang.String" itemvalue="Rake.spec" />
+ <item index="2" class="java.lang.String" itemvalue="Rails.Production: sample_app" />
+ <item index="3" class="java.lang.String" itemvalue="Rails.Development: sample_app" />
+ </list>
+ </component>
+ <component name="ShelveChangesManager" show_recycled="false" />
+ <component name="SvnConfiguration" maxAnnotateRevisions="500">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
+ <option name="DETECT_NESTED_COPIES" value="true" />
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
+ <option name="FORCE_UPDATE" value="false" />
+ <configuration useDefault="true">$USER_HOME$/.subversion_IDEA</configuration>
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
+ </component>
+ <component name="TaskManager">
+ <task active="true" id="Default" summary="Default task">
+ <created>1304486632797</created>
+ <updated>1304486632797</updated>
+ </task>
+ <servers />
+ </component>
+ <component name="ToolWindowManager">
+ <frame x="-1" y="24" width="1922" height="934" extended-state="6" />
+ <editor active="false" />
+ <layout>
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3287841" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
+ <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24960423" sideWeight="0.6712159" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+ </layout>
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
+ <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
+ <option name="ENABLE_BACKGROUND_PROCESSES" value="false" />
+ <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
+ <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
+ <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
+ <option name="LAST_COMMIT_MESSAGE" />
+ <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
+ <option name="ACTIVE_VCS_NAME" />
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
+ </component>
+ <component name="XDebuggerManager">
+ <breakpoint-manager />
+ </component>
+</project>
+
View
1 Gemfile
@@ -9,6 +9,7 @@ gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.5.0'
+ gem 'annotate-models', '1.0.4'
end
group :test do
View
2 Gemfile.lock
@@ -28,6 +28,7 @@ GEM
activemodel (= 3.0.7)
activesupport (= 3.0.7)
activesupport (3.0.7)
+ annotate-models (1.0.4)
arel (2.0.9)
builder (2.1.2)
diff-lcs (1.1.2)
@@ -89,6 +90,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ annotate-models (= 1.0.4)
rails (= 3.0.7)
rspec (= 2.5.0)
rspec-rails (= 2.5.0)
View
6 app/controllers/users_controller.rb
@@ -1,5 +1,11 @@
class UsersController < ApplicationController
+
+ def show
+ @user = User.find(params[:id])
+ end
+
def new
@title = "Sign up"
end
+
end
View
26 app/models/user.rb
@@ -0,0 +1,26 @@
+# == Schema Information
+# Schema version: 20110504232921
+#
+# Table name: users
+#
+# id :integer not null, primary key
+# name :string(255)
+# email :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
+class User < ActiveRecord::Base
+
+ email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
+
+ attr_accessible :name, :email
+
+ validates :name, :presence => true,
+ :length => { :maximum => 50 }
+
+ validates :email, :presence => true,
+ :format => { :with => email_regex },
+ :uniqueness => { :case_sensitive => false }
+
+end
View
1 app/views/layouts/application.html.erb
@@ -12,6 +12,7 @@
<%= yield %>
</section>
<%= render 'layouts/footer' %>
+ <%= debug(params) if Rails.env.development? %>
</div>
</body>
</html>
View
1 app/views/users/show.html.erb
@@ -0,0 +1 @@
+<%= @user.name %>, <%= @user.email %>
View
3 config/routes.rb
@@ -1,8 +1,7 @@
SampleApp::Application.routes.draw do
+ resources :users
- get "users/new"
-
match '/signup', :to => 'users#new'
match '/contact', :to => 'pages#contact'
View
14 db/migrate/20110504232921_create_users.rb
@@ -0,0 +1,14 @@
+class CreateUsers < ActiveRecord::Migration
+ def self.up
+ create_table :users do |t|
+ t.string :name
+ t.string :email
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :users
+ end
+end
View
7 db/migrate/20110505013321_add_email_uniqueness_index.rb
@@ -0,0 +1,7 @@
+class AddEmailUniquenessIndex < ActiveRecord::Migration
+ def self.up
+ end
+
+ def self.down
+ end
+end
View
22 db/schema.rb
@@ -0,0 +1,22 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20110505013321) do
+
+ create_table "users", :force => true do |t|
+ t.string "name"
+ t.string "email"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
View
59 spec/models/user_spec.rb
@@ -0,0 +1,59 @@
+require 'spec_helper'
+
+describe User do
+
+ before(:each) do
+ @attr = { :name => "Example User", :email => "user@example.com" }
+ end
+
+ it "should create a new instance given valid attributes" do
+ User.create!(@attr)
+ end
+
+ it "should require a name" do
+ no_name_user = User.new(@attr.merge(:name => ""))
+ no_name_user.should_not be_valid
+ end
+
+ it "should require an email address" do
+ no_email_user = User.new(@attr.merge(:email => ""))
+ no_email_user.should_not be_valid
+ end
+
+ it "should reject names that are too long" do
+ long_name = "a" * 51
+ long_name_user = User.new(@attr.merge(:name => long_name))
+ long_name_user.should_not be_valid
+ end
+
+ it "should accept valid email addresses" do
+ addresses = %w[user@foo.com THE_USER@foo.bar.org first.last@foo.jp]
+ addresses.each do |address|
+ valid_email_user = User.new(@attr.merge(:email => address))
+ valid_email_user.should be_valid
+ end
+ end
+
+ it "should reject invalid email addresses" do
+ addresses = %w[user@foo,com user_at_foo.org example.user@foo.]
+ addresses.each do |address|
+ invalid_email_user = User.new(@attr.merge(:email => address))
+ invalid_email_user.should_not be_valid
+ end
+ end
+
+ it "should reject duplicate email addresses" do
+ # Put a user with given email address into the database.
+ User.create!(@attr)
+ user_with_duplicate_email = User.new(@attr)
+ user_with_duplicate_email.should_not be_valid
+ end
+
+ it "should reject email addresses identical up to case" do
+ upcased_email = @attr[:email].upcase
+ User.create!(@attr.merge(:email => upcased_email))
+ user_with_duplicate_email = User.new(@attr)
+ user_with_duplicate_email.should_not be_valid
+ end
+
+end

0 comments on commit d2e59df

Please sign in to comment.