Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: penso/heritage
base: 0661be01e3
...
head fork: penso/heritage
compare: a3d06fd58e
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 28 files changed
  • 0 commit comments
  • 1 contributor
Showing with 285 additions and 166 deletions.
  1. +34 −0 .rvmrc
  2. +5 −0 ChangeLog
  3. +2 −1  Gemfile
  4. +71 −45 Gemfile.lock
  5. +1 −0  app/assets/stylesheets/bootstrap_and_overrides.css.less
  6. +11 −2 app/models/user.rb
  7. +3 −1 app/views/stories/_thumbnails.html.erb
  8. +6 −0 config/initializers/carrierwave.rb
  9. +25 −25 spec/controllers/as/emails_controller_spec.rb
  10. +25 −25 spec/controllers/as/photos_controller_spec.rb
  11. +24 −24 spec/controllers/as/stories_controller_spec.rb
  12. +25 −25 spec/controllers/as/users_controller_spec.rb
  13. +7 −2 spec/controllers/photos_controller_spec.rb
  14. +18 −1 spec/models/user_spec.rb
  15. +11 −0 spec/requests/as/as_users_spec.rb
  16. +2 −0  spec/spec_helper.rb
  17. +1 −1  spec/views/as/emails/edit.html.erb_spec.rb
  18. +2 −2 spec/views/as/emails/index.html.erb_spec.rb
  19. +1 −1  spec/views/as/emails/new.html.erb_spec.rb
  20. +1 −1  spec/views/as/emails/show.html.erb_spec.rb
  21. +1 −1  spec/views/as/stories/edit.html.erb_spec.rb
  22. +2 −2 spec/views/as/stories/index.html.erb_spec.rb
  23. +1 −1  spec/views/as/stories/new.html.erb_spec.rb
  24. +1 −1  spec/views/as/stories/show.html.erb_spec.rb
  25. +1 −1  spec/views/as/users/edit.html.erb_spec.rb
  26. +2 −2 spec/views/as/users/index.html.erb_spec.rb
  27. +1 −1  spec/views/as/users/new.html.erb_spec.rb
  28. +1 −1  spec/views/as/users/show.html.erb_spec.rb
View
34 .rvmrc
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+# This is an RVM Project .rvmrc file, used to automatically load the ruby
+# development environment upon cd'ing into the directory
+
+# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
+# Only full ruby name is supported here, for short names use:
+# echo "rvm use 1.9.2" > .rvmrc
+environment_id="ruby-1.9.2-p318"
+
+# Uncomment the following lines if you want to verify rvm version per project
+# rvmrc_rvm_version="1.11.2" # 1.10.1 seams as a safe start
+# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
+# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
+# return 1
+# }
+
+# First we attempt to load the desired environment directly from the environment
+# file. This is very fast and efficient compared to running through the entire
+# CLI and selector. If you want feedback on which environment was used then
+# insert the word 'use' after --create as this triggers verbose mode.
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
+then
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
+else
+ # If the environment file has not yet been created, use the RVM CLI to select.
+ rvm --create "$environment_id" || {
+ echo "Failed to create RVM environment '${environment_id}'."
+ return 1
+ }
+fi
View
5 ChangeLog
@@ -1,3 +1,8 @@
+2013-01-08 Fabien Penso <fabien.penso@conovae.com>
+
+ * specs fixing, lots of bugfix
+ * 8h
+
2013-01-06 Fabien Penso <fabien.penso@conovae.com>
* Flexslider integration
View
3  Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'rails', '3.2.9'
+gem 'rails'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -48,6 +48,7 @@ group :test, :development do
gem 'webmock'
gem 'factory_girl_rails'
gem 'database_cleaner'
+ gem 'capybara'
end
gem 'mysql2'
View
116 Gemfile.lock
@@ -8,13 +8,13 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- aasm (3.0.14)
- actionmailer (3.2.9)
- actionpack (= 3.2.9)
+ aasm (3.0.15)
+ actionmailer (3.2.11)
+ actionpack (= 3.2.11)
mail (~> 2.4.4)
- actionpack (3.2.9)
- activemodel (= 3.2.9)
- activesupport (= 3.2.9)
+ actionpack (3.2.11)
+ activemodel (= 3.2.11)
+ activesupport (= 3.2.11)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@@ -24,23 +24,23 @@ GEM
sprockets (~> 2.2.1)
active_scaffold (3.2.17)
rails (>= 3.1.3)
- activemodel (3.2.9)
- activesupport (= 3.2.9)
+ activemodel (3.2.11)
+ activesupport (= 3.2.11)
builder (~> 3.0.0)
- activerecord (3.2.9)
- activemodel (= 3.2.9)
- activesupport (= 3.2.9)
+ activerecord (3.2.11)
+ activemodel (= 3.2.11)
+ activesupport (= 3.2.11)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.9)
- activemodel (= 3.2.9)
- activesupport (= 3.2.9)
- activesupport (3.2.9)
+ activeresource (3.2.11)
+ activemodel (= 3.2.11)
+ activesupport (= 3.2.11)
+ activesupport (3.2.11)
i18n (~> 0.6)
multi_json (~> 1.0)
acts-as-taggable-on (2.3.3)
rails (~> 3.0)
- acts_as_list (0.1.8)
+ acts_as_list (0.1.9)
addressable (2.3.2)
archive-tar-minitar (0.5.2)
arel (3.0.2)
@@ -54,9 +54,18 @@ GEM
net-ssh-gateway (>= 1.1.0)
capistrano-ext (1.2.1)
capistrano (>= 1.0.0)
- carrierwave (0.7.1)
+ capybara (2.0.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 1.0.0)
+ carrierwave (0.8.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
+ childprocess (0.3.6)
+ ffi (~> 1.0, >= 1.0.6)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -67,9 +76,9 @@ GEM
colored (1.2)
columnize (0.3.6)
commonjs (0.2.6)
- crack (0.3.1)
+ crack (0.3.2)
database_cleaner (0.9.1)
- devise (2.1.2)
+ devise (2.2.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (~> 3.1)
@@ -85,6 +94,7 @@ GEM
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
+ ffi (1.3.0)
flash_cookie_session (1.1.3)
rails (~> 3.0)
formtastic (2.2.1)
@@ -101,14 +111,17 @@ GEM
jquery-rails (2.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
- json (1.7.5)
+ json (1.7.6)
kgio (2.7.4)
less (2.2.2)
commonjs (~> 0.2.6)
less-rails (2.2.6)
actionpack (>= 3.1)
less (~> 2.2.0)
- libv8 (3.3.10.4)
+ libv8 (3.11.8.13)
+ libwebsocket (0.1.7.1)
+ addressable
+ websocket
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
lograge (0.1.2)
@@ -119,7 +132,7 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
- multi_json (1.3.7)
+ multi_json (1.5.0)
mysql2 (0.3.11)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
@@ -128,45 +141,47 @@ GEM
net-ssh (2.6.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
+ nokogiri (1.5.6)
orm_adapter (0.4.0)
polyglot (0.3.3)
- rack (1.4.1)
+ rack (1.4.3)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.9)
- actionmailer (= 3.2.9)
- actionpack (= 3.2.9)
- activerecord (= 3.2.9)
- activeresource (= 3.2.9)
- activesupport (= 3.2.9)
+ rails (3.2.11)
+ actionmailer (= 3.2.11)
+ actionpack (= 3.2.11)
+ activerecord (= 3.2.11)
+ activeresource (= 3.2.11)
+ activesupport (= 3.2.11)
bundler (~> 1.0)
- railties (= 3.2.9)
- railties (3.2.9)
- actionpack (= 3.2.9)
- activesupport (= 3.2.9)
+ railties (= 3.2.11)
+ railties (3.2.11)
+ actionpack (= 3.2.11)
+ activesupport (= 3.2.11)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rainbow (1.1.4)
raindrops (0.10.0)
- rake (10.0.2)
+ rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
+ ref (1.0.2)
rmagick (2.13.1)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
- rspec-core (2.12.0)
- rspec-expectations (2.12.0)
+ rspec-core (2.12.2)
+ rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
- rspec-mocks (2.12.0)
- rspec-rails (2.12.0)
+ rspec-mocks (2.12.1)
+ rspec-rails (2.12.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
@@ -183,14 +198,20 @@ GEM
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
+ rubyzip (0.9.9)
rvm-capistrano (1.2.7)
capistrano (>= 2.0.0)
- sass (3.2.3)
+ sass (3.2.5)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
- sprockets (2.2.1)
+ selenium-webdriver (2.27.2)
+ childprocess (>= 0.2.5)
+ libwebsocket (~> 0.1.3)
+ multi_json (~> 1.0)
+ rubyzip
+ sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
@@ -199,14 +220,15 @@ GEM
tabulous (1.3.0)
colored (~> 1.2.0)
rails (~> 3.0)
- therubyracer (0.10.2)
- libv8 (~> 3.3.10)
+ therubyracer (0.11.1)
+ libv8 (~> 3.11.8.7)
+ ref
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
- twitter-bootstrap-rails (2.1.6)
+ twitter-bootstrap-rails (2.2.0)
actionpack (>= 3.1)
execjs
railties (>= 3.1)
@@ -214,7 +236,7 @@ GEM
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
- unicorn (4.4.0)
+ unicorn (4.5.0)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
@@ -223,8 +245,11 @@ GEM
webmock (1.9.0)
addressable (>= 2.2.7)
crack (>= 0.1.7)
+ websocket (1.0.6)
will_paginate (3.0.3)
wirble (0.1.3)
+ xpath (1.0.0)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
@@ -237,6 +262,7 @@ DEPENDENCIES
capistrano
capistrano-ext
capistrano-unicorn!
+ capybara
carrierwave
coffee-rails (~> 3.2.1)
database_cleaner
@@ -253,7 +279,7 @@ DEPENDENCIES
less-rails
lograge
mysql2
- rails (= 3.2.9)
+ rails
rainbow
rmagick
rspec
View
1  app/assets/stylesheets/bootstrap_and_overrides.css.less
@@ -12,6 +12,7 @@
@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
+@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot#iefix");
// Font Awesome
@import "fontawesome";
View
13 app/models/user.rb
@@ -31,9 +31,18 @@ def title
before_create :create_specific_url
def create_specific_url
if email =~ /^(.*)@/
- internal_url = "#{$1}.heritage.io"
- specific_url = "#{$1}.heritage.io"
+ self.internal_url = "#{$1}.heritage.io"
+ self.specific_url = "#{$1}.heritage.io"
end
+
+ true
+ end
+
+ before_update :generate_permalink
+ def generate_permalink
+ return unless permalink.blank?
+
+ generate_permalink!
end
# Include default devise modules. Others available are:
View
4 app/views/stories/_thumbnails.html.erb
@@ -5,7 +5,9 @@
<% photo = story.photos.first %>
<li>
- <%= link_to(image_tag(photo.image_url(:thumb)), story_photo_url(story, photo.permalink || photo.id), :class => "thumbnail") %>
+ <%= link_to(image_tag(photo.image_url(:thumb), :width => 180, :height => 180),
+ story_photo_url(story, photo.permalink || photo.id),
+ :class => "thumbnail") %>
</li>
<% end %>
View
6 config/initializers/carrierwave.rb
@@ -0,0 +1,6 @@
+if Rails.env.test? or Rails.env.cucumber?
+ CarrierWave.configure do |config|
+ config.storage = :file
+ config.enable_processing = false
+ end
+end
View
50 spec/controllers/as/emails_controller_spec.rb
@@ -21,7 +21,7 @@
describe As::EmailsController do
# This should return the minimal set of attributes required to create a valid
- # As::Email. As you add validations to As::Email, be sure to
+ # Email. As you add validations to Email, be sure to
# update the return value of this method accordingly.
def valid_attributes
{ }
@@ -29,14 +29,14 @@ def valid_attributes
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
- # As::EmailsController. Be sure to keep this updated too.
+ # EmailsController. Be sure to keep this updated too.
def valid_session
{}
end
describe "GET index" do
it "assigns all as_emails as @as_emails" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
get :index, {}, valid_session
assigns(:as_emails).should eq([email])
end
@@ -44,7 +44,7 @@ def valid_session
describe "GET show" do
it "assigns the requested as_email as @as_email" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
get :show, {:id => email.to_param}, valid_session
assigns(:as_email).should eq(email)
end
@@ -53,13 +53,13 @@ def valid_session
describe "GET new" do
it "assigns a new as_email as @as_email" do
get :new, {}, valid_session
- assigns(:as_email).should be_a_new(As::Email)
+ assigns(:as_email).should be_a_new(Email)
end
end
describe "GET edit" do
it "assigns the requested as_email as @as_email" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
get :edit, {:id => email.to_param}, valid_session
assigns(:as_email).should eq(email)
end
@@ -67,35 +67,35 @@ def valid_session
describe "POST create" do
describe "with valid params" do
- it "creates a new As::Email" do
+ it "creates a new Email" do
expect {
post :create, {:as_email => valid_attributes}, valid_session
- }.to change(As::Email, :count).by(1)
+ }.to change(Email, :count).by(1)
end
it "assigns a newly created as_email as @as_email" do
post :create, {:as_email => valid_attributes}, valid_session
- assigns(:as_email).should be_a(As::Email)
+ assigns(:as_email).should be_a(Email)
assigns(:as_email).should be_persisted
end
it "redirects to the created as_email" do
post :create, {:as_email => valid_attributes}, valid_session
- response.should redirect_to(As::Email.last)
+ response.should redirect_to(Email.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved as_email as @as_email" do
# Trigger the behavior that occurs when invalid params are submitted
- As::Email.any_instance.stub(:save).and_return(false)
+ Email.any_instance.stub(:save).and_return(false)
post :create, {:as_email => { }}, valid_session
- assigns(:as_email).should be_a_new(As::Email)
+ assigns(:as_email).should be_a_new(Email)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
- As::Email.any_instance.stub(:save).and_return(false)
+ Email.any_instance.stub(:save).and_return(false)
post :create, {:as_email => { }}, valid_session
response.should render_template("new")
end
@@ -105,23 +105,23 @@ def valid_session
describe "PUT update" do
describe "with valid params" do
it "updates the requested as_email" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
# Assuming there are no other as_emails in the database, this
- # specifies that the As::Email created on the previous line
+ # specifies that the Email created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
- As::Email.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
+ Email.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
put :update, {:id => email.to_param, :as_email => { "these" => "params" }}, valid_session
end
it "assigns the requested as_email as @as_email" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
put :update, {:id => email.to_param, :as_email => valid_attributes}, valid_session
assigns(:as_email).should eq(email)
end
it "redirects to the as_email" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
put :update, {:id => email.to_param, :as_email => valid_attributes}, valid_session
response.should redirect_to(email)
end
@@ -129,17 +129,17 @@ def valid_session
describe "with invalid params" do
it "assigns the as_email as @as_email" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::Email.any_instance.stub(:save).and_return(false)
+ Email.any_instance.stub(:save).and_return(false)
put :update, {:id => email.to_param, :as_email => { }}, valid_session
assigns(:as_email).should eq(email)
end
it "re-renders the 'edit' template" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::Email.any_instance.stub(:save).and_return(false)
+ Email.any_instance.stub(:save).and_return(false)
put :update, {:id => email.to_param, :as_email => { }}, valid_session
response.should render_template("edit")
end
@@ -148,14 +148,14 @@ def valid_session
describe "DELETE destroy" do
it "destroys the requested as_email" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
expect {
delete :destroy, {:id => email.to_param}, valid_session
- }.to change(As::Email, :count).by(-1)
+ }.to change(Email, :count).by(-1)
end
it "redirects to the as_emails list" do
- email = As::Email.create! valid_attributes
+ email = Email.create! valid_attributes
delete :destroy, {:id => email.to_param}, valid_session
response.should redirect_to(as_emails_url)
end
View
50 spec/controllers/as/photos_controller_spec.rb
@@ -21,7 +21,7 @@
describe As::PhotosController do
# This should return the minimal set of attributes required to create a valid
- # As::Photo. As you add validations to As::Photo, be sure to
+ # Photo. As you add validations to Photo, be sure to
# update the return value of this method accordingly.
def valid_attributes
{ }
@@ -29,14 +29,14 @@ def valid_attributes
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
- # As::PhotosController. Be sure to keep this updated too.
+ # PhotosController. Be sure to keep this updated too.
def valid_session
{}
end
describe "GET index" do
it "assigns all as_photos as @as_photos" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
get :index, {}, valid_session
assigns(:as_photos).should eq([photo])
end
@@ -44,7 +44,7 @@ def valid_session
describe "GET show" do
it "assigns the requested as_photo as @as_photo" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
get :show, {:id => photo.to_param}, valid_session
assigns(:as_photo).should eq(photo)
end
@@ -53,13 +53,13 @@ def valid_session
describe "GET new" do
it "assigns a new as_photo as @as_photo" do
get :new, {}, valid_session
- assigns(:as_photo).should be_a_new(As::Photo)
+ assigns(:as_photo).should be_a_new(Photo)
end
end
describe "GET edit" do
it "assigns the requested as_photo as @as_photo" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
get :edit, {:id => photo.to_param}, valid_session
assigns(:as_photo).should eq(photo)
end
@@ -67,35 +67,35 @@ def valid_session
describe "POST create" do
describe "with valid params" do
- it "creates a new As::Photo" do
+ it "creates a new Photo" do
expect {
post :create, {:as_photo => valid_attributes}, valid_session
- }.to change(As::Photo, :count).by(1)
+ }.to change(Photo, :count).by(1)
end
it "assigns a newly created as_photo as @as_photo" do
post :create, {:as_photo => valid_attributes}, valid_session
- assigns(:as_photo).should be_a(As::Photo)
+ assigns(:as_photo).should be_a(Photo)
assigns(:as_photo).should be_persisted
end
it "redirects to the created as_photo" do
post :create, {:as_photo => valid_attributes}, valid_session
- response.should redirect_to(As::Photo.last)
+ response.should redirect_to(Photo.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved as_photo as @as_photo" do
# Trigger the behavior that occurs when invalid params are submitted
- As::Photo.any_instance.stub(:save).and_return(false)
+ Photo.any_instance.stub(:save).and_return(false)
post :create, {:as_photo => { }}, valid_session
- assigns(:as_photo).should be_a_new(As::Photo)
+ assigns(:as_photo).should be_a_new(Photo)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
- As::Photo.any_instance.stub(:save).and_return(false)
+ Photo.any_instance.stub(:save).and_return(false)
post :create, {:as_photo => { }}, valid_session
response.should render_template("new")
end
@@ -105,23 +105,23 @@ def valid_session
describe "PUT update" do
describe "with valid params" do
it "updates the requested as_photo" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
# Assuming there are no other as_photos in the database, this
- # specifies that the As::Photo created on the previous line
+ # specifies that the Photo created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
- As::Photo.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
+ Photo.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
put :update, {:id => photo.to_param, :as_photo => { "these" => "params" }}, valid_session
end
it "assigns the requested as_photo as @as_photo" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
put :update, {:id => photo.to_param, :as_photo => valid_attributes}, valid_session
assigns(:as_photo).should eq(photo)
end
it "redirects to the as_photo" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
put :update, {:id => photo.to_param, :as_photo => valid_attributes}, valid_session
response.should redirect_to(photo)
end
@@ -129,17 +129,17 @@ def valid_session
describe "with invalid params" do
it "assigns the as_photo as @as_photo" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::Photo.any_instance.stub(:save).and_return(false)
+ Photo.any_instance.stub(:save).and_return(false)
put :update, {:id => photo.to_param, :as_photo => { }}, valid_session
assigns(:as_photo).should eq(photo)
end
it "re-renders the 'edit' template" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::Photo.any_instance.stub(:save).and_return(false)
+ Photo.any_instance.stub(:save).and_return(false)
put :update, {:id => photo.to_param, :as_photo => { }}, valid_session
response.should render_template("edit")
end
@@ -148,14 +148,14 @@ def valid_session
describe "DELETE destroy" do
it "destroys the requested as_photo" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
expect {
delete :destroy, {:id => photo.to_param}, valid_session
- }.to change(As::Photo, :count).by(-1)
+ }.to change(Photo, :count).by(-1)
end
it "redirects to the as_photos list" do
- photo = As::Photo.create! valid_attributes
+ photo = Photo.create! valid_attributes
delete :destroy, {:id => photo.to_param}, valid_session
response.should redirect_to(as_photos_url)
end
View
48 spec/controllers/as/stories_controller_spec.rb
@@ -21,7 +21,7 @@
describe As::StoriesController do
# This should return the minimal set of attributes required to create a valid
- # As::Story. As you add validations to As::Story, be sure to
+ # Story. As you add validations to Story, be sure to
# update the return value of this method accordingly.
def valid_attributes
{ }
@@ -36,7 +36,7 @@ def valid_session
describe "GET index" do
it "assigns all as_stories as @as_stories" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
get :index, {}, valid_session
assigns(:as_stories).should eq([story])
end
@@ -44,7 +44,7 @@ def valid_session
describe "GET show" do
it "assigns the requested as_story as @as_story" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
get :show, {:id => story.to_param}, valid_session
assigns(:as_story).should eq(story)
end
@@ -53,13 +53,13 @@ def valid_session
describe "GET new" do
it "assigns a new as_story as @as_story" do
get :new, {}, valid_session
- assigns(:as_story).should be_a_new(As::Story)
+ assigns(:as_story).should be_a_new(Story)
end
end
describe "GET edit" do
it "assigns the requested as_story as @as_story" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
get :edit, {:id => story.to_param}, valid_session
assigns(:as_story).should eq(story)
end
@@ -67,35 +67,35 @@ def valid_session
describe "POST create" do
describe "with valid params" do
- it "creates a new As::Story" do
+ it "creates a new Story" do
expect {
post :create, {:as_story => valid_attributes}, valid_session
- }.to change(As::Story, :count).by(1)
+ }.to change(Story, :count).by(1)
end
it "assigns a newly created as_story as @as_story" do
post :create, {:as_story => valid_attributes}, valid_session
- assigns(:as_story).should be_a(As::Story)
+ assigns(:as_story).should be_a(Story)
assigns(:as_story).should be_persisted
end
it "redirects to the created as_story" do
post :create, {:as_story => valid_attributes}, valid_session
- response.should redirect_to(As::Story.last)
+ response.should redirect_to(Story.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved as_story as @as_story" do
# Trigger the behavior that occurs when invalid params are submitted
- As::Story.any_instance.stub(:save).and_return(false)
+ Story.any_instance.stub(:save).and_return(false)
post :create, {:as_story => { }}, valid_session
- assigns(:as_story).should be_a_new(As::Story)
+ assigns(:as_story).should be_a_new(Story)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
- As::Story.any_instance.stub(:save).and_return(false)
+ Story.any_instance.stub(:save).and_return(false)
post :create, {:as_story => { }}, valid_session
response.should render_template("new")
end
@@ -105,23 +105,23 @@ def valid_session
describe "PUT update" do
describe "with valid params" do
it "updates the requested as_story" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
# Assuming there are no other as_stories in the database, this
- # specifies that the As::Story created on the previous line
+ # specifies that the Story created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
- As::Story.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
+ Story.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
put :update, {:id => story.to_param, :as_story => { "these" => "params" }}, valid_session
end
it "assigns the requested as_story as @as_story" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
put :update, {:id => story.to_param, :as_story => valid_attributes}, valid_session
assigns(:as_story).should eq(story)
end
it "redirects to the as_story" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
put :update, {:id => story.to_param, :as_story => valid_attributes}, valid_session
response.should redirect_to(story)
end
@@ -129,17 +129,17 @@ def valid_session
describe "with invalid params" do
it "assigns the as_story as @as_story" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::Story.any_instance.stub(:save).and_return(false)
+ Story.any_instance.stub(:save).and_return(false)
put :update, {:id => story.to_param, :as_story => { }}, valid_session
assigns(:as_story).should eq(story)
end
it "re-renders the 'edit' template" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::Story.any_instance.stub(:save).and_return(false)
+ Story.any_instance.stub(:save).and_return(false)
put :update, {:id => story.to_param, :as_story => { }}, valid_session
response.should render_template("edit")
end
@@ -148,14 +148,14 @@ def valid_session
describe "DELETE destroy" do
it "destroys the requested as_story" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
expect {
delete :destroy, {:id => story.to_param}, valid_session
- }.to change(As::Story, :count).by(-1)
+ }.to change(Story, :count).by(-1)
end
it "redirects to the as_stories list" do
- story = As::Story.create! valid_attributes
+ story = Story.create! valid_attributes
delete :destroy, {:id => story.to_param}, valid_session
response.should redirect_to(as_stories_url)
end
View
50 spec/controllers/as/users_controller_spec.rb
@@ -21,7 +21,7 @@
describe As::UsersController do
# This should return the minimal set of attributes required to create a valid
- # As::User. As you add validations to As::User, be sure to
+ # User. As you add validations to User, be sure to
# update the return value of this method accordingly.
def valid_attributes
{ }
@@ -29,14 +29,14 @@ def valid_attributes
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
- # As::UsersController. Be sure to keep this updated too.
+ # UsersController. Be sure to keep this updated too.
def valid_session
{}
end
describe "GET index" do
it "assigns all as_users as @as_users" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
get :index, {}, valid_session
assigns(:as_users).should eq([user])
end
@@ -44,7 +44,7 @@ def valid_session
describe "GET show" do
it "assigns the requested as_user as @as_user" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
get :show, {:id => user.to_param}, valid_session
assigns(:as_user).should eq(user)
end
@@ -53,13 +53,13 @@ def valid_session
describe "GET new" do
it "assigns a new as_user as @as_user" do
get :new, {}, valid_session
- assigns(:as_user).should be_a_new(As::User)
+ assigns(:as_user).should be_a_new(User)
end
end
describe "GET edit" do
it "assigns the requested as_user as @as_user" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
get :edit, {:id => user.to_param}, valid_session
assigns(:as_user).should eq(user)
end
@@ -67,35 +67,35 @@ def valid_session
describe "POST create" do
describe "with valid params" do
- it "creates a new As::User" do
+ it "creates a new User" do
expect {
post :create, {:as_user => valid_attributes}, valid_session
- }.to change(As::User, :count).by(1)
+ }.to change(User, :count).by(1)
end
it "assigns a newly created as_user as @as_user" do
post :create, {:as_user => valid_attributes}, valid_session
- assigns(:as_user).should be_a(As::User)
+ assigns(:as_user).should be_a(User)
assigns(:as_user).should be_persisted
end
it "redirects to the created as_user" do
post :create, {:as_user => valid_attributes}, valid_session
- response.should redirect_to(As::User.last)
+ response.should redirect_to(User.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved as_user as @as_user" do
# Trigger the behavior that occurs when invalid params are submitted
- As::User.any_instance.stub(:save).and_return(false)
+ User.any_instance.stub(:save).and_return(false)
post :create, {:as_user => { }}, valid_session
- assigns(:as_user).should be_a_new(As::User)
+ assigns(:as_user).should be_a_new(User)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
- As::User.any_instance.stub(:save).and_return(false)
+ User.any_instance.stub(:save).and_return(false)
post :create, {:as_user => { }}, valid_session
response.should render_template("new")
end
@@ -105,23 +105,23 @@ def valid_session
describe "PUT update" do
describe "with valid params" do
it "updates the requested as_user" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
# Assuming there are no other as_users in the database, this
- # specifies that the As::User created on the previous line
+ # specifies that the User created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
- As::User.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
+ User.any_instance.should_receive(:update_attributes).with({ "these" => "params" })
put :update, {:id => user.to_param, :as_user => { "these" => "params" }}, valid_session
end
it "assigns the requested as_user as @as_user" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
put :update, {:id => user.to_param, :as_user => valid_attributes}, valid_session
assigns(:as_user).should eq(user)
end
it "redirects to the as_user" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
put :update, {:id => user.to_param, :as_user => valid_attributes}, valid_session
response.should redirect_to(user)
end
@@ -129,17 +129,17 @@ def valid_session
describe "with invalid params" do
it "assigns the as_user as @as_user" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::User.any_instance.stub(:save).and_return(false)
+ User.any_instance.stub(:save).and_return(false)
put :update, {:id => user.to_param, :as_user => { }}, valid_session
assigns(:as_user).should eq(user)
end
it "re-renders the 'edit' template" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
- As::User.any_instance.stub(:save).and_return(false)
+ User.any_instance.stub(:save).and_return(false)
put :update, {:id => user.to_param, :as_user => { }}, valid_session
response.should render_template("edit")
end
@@ -148,14 +148,14 @@ def valid_session
describe "DELETE destroy" do
it "destroys the requested as_user" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
expect {
delete :destroy, {:id => user.to_param}, valid_session
- }.to change(As::User, :count).by(-1)
+ }.to change(User, :count).by(-1)
end
it "redirects to the as_users list" do
- user = As::User.create! valid_attributes
+ user = User.create! valid_attributes
delete :destroy, {:id => user.to_param}, valid_session
response.should redirect_to(as_users_url)
end
View
9 spec/controllers/photos_controller_spec.rb
@@ -1,17 +1,22 @@
require 'spec_helper'
describe PhotosController do
+ before do
+ @user = FactoryGirl.create(:user)
+ @story = FactoryGirl.create(:story, :user => @user)
+ sign_in @user
+ end
describe "GET 'create'" do
it "returns http success" do
- get 'create'
+ get 'create', :story_id => @story, :format => 'js'
response.should be_success
end
end
describe "GET 'destroy'" do
it "returns http success" do
- get 'destroy'
+ get 'destroy', :story_id => @story, :format => 'js'
response.should be_success
end
end
View
19 spec/models/user_spec.rb
@@ -1,12 +1,29 @@
require 'spec_helper'
describe User do
+ before(:each) do
+ @new_user = FactoryGirl.create(:user, :name => nil)
+ end
+
+ it "should have nil permalinks" do
+ @new_user.permalink.should be_nil
+ end
+
+ it "should update user with permalink" do
+ @new_user.update_attribute(:name, Faker::Name.name)
+ @new_user.permalink.should_not be_nil
+ end
+
it "should create user with permalink" do
+ new_user = FactoryGirl.create(:user)
+ new_user.permalink.should_not be_nil
+ end
+ it "should create user with internal urls" do
+ @new_user.internal_url.should_not be_nil
end
# Because we use name for links in account/stories
it "should create user with names" do
-
end
end
View
11 spec/requests/as/as_users_spec.rb
@@ -2,7 +2,18 @@
describe "As::Users" do
describe "GET /as_users" do
+ before do
+ @user = FactoryGirl.create(:user)
+ end
+
it "works! (now write some real specs)" do
+ visit "/users/sign_in"
+
+ fill_in "Email", :with => @user.email
+ fill_in "Password", :with => "password"
+
+ click_button "Sign in"
+
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get as_users_path
response.status.should be(200)
View
2  spec/spec_helper.rb
@@ -3,12 +3,14 @@
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
+require 'capybara/rspec'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
+ config.include Devise::TestHelpers, :type => :controller
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
View
2  spec/views/as/emails/edit.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/emails/edit" do
before(:each) do
- @as_email = assign(:as_email, stub_model(As::Email))
+ @as_email = assign(:as_email, stub_model(Email))
end
it "renders the edit as_email form" do
View
4 spec/views/as/emails/index.html.erb_spec.rb
@@ -3,8 +3,8 @@
describe "as/emails/index" do
before(:each) do
assign(:as_emails, [
- stub_model(As::Email),
- stub_model(As::Email)
+ stub_model(Email),
+ stub_model(Email)
])
end
View
2  spec/views/as/emails/new.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/emails/new" do
before(:each) do
- assign(:as_email, stub_model(As::Email).as_new_record)
+ assign(:as_email, stub_model(Email).as_new_record)
end
it "renders new as_email form" do
View
2  spec/views/as/emails/show.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/emails/show" do
before(:each) do
- @as_email = assign(:as_email, stub_model(As::Email))
+ @as_email = assign(:as_email, stub_model(Email))
end
it "renders attributes in <p>" do
View
2  spec/views/as/stories/edit.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/stories/edit" do
before(:each) do
- @as_story = assign(:as_story, stub_model(As::Story))
+ @as_story = assign(:as_story, stub_model(Story))
end
it "renders the edit as_story form" do
View
4 spec/views/as/stories/index.html.erb_spec.rb
@@ -3,8 +3,8 @@
describe "as/stories/index" do
before(:each) do
assign(:as_stories, [
- stub_model(As::Story),
- stub_model(As::Story)
+ stub_model(Story),
+ stub_model(Story)
])
end
View
2  spec/views/as/stories/new.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/stories/new" do
before(:each) do
- assign(:as_story, stub_model(As::Story).as_new_record)
+ assign(:as_story, stub_model(Story).as_new_record)
end
it "renders new as_story form" do
View
2  spec/views/as/stories/show.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/stories/show" do
before(:each) do
- @as_story = assign(:as_story, stub_model(As::Story))
+ @as_story = assign(:as_story, stub_model(Story))
end
it "renders attributes in <p>" do
View
2  spec/views/as/users/edit.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/users/edit" do
before(:each) do
- @as_user = assign(:as_user, stub_model(As::User))
+ @as_user = assign(:as_user, stub_model(User))
end
it "renders the edit as_user form" do
View
4 spec/views/as/users/index.html.erb_spec.rb
@@ -3,8 +3,8 @@
describe "as/users/index" do
before(:each) do
assign(:as_users, [
- stub_model(As::User),
- stub_model(As::User)
+ stub_model(User),
+ stub_model(User)
])
end
View
2  spec/views/as/users/new.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/users/new" do
before(:each) do
- assign(:as_user, stub_model(As::User).as_new_record)
+ assign(:as_user, stub_model(User).as_new_record)
end
it "renders new as_user form" do
View
2  spec/views/as/users/show.html.erb_spec.rb
@@ -2,7 +2,7 @@
describe "as/users/show" do
before(:each) do
- @as_user = assign(:as_user, stub_model(As::User))
+ @as_user = assign(:as_user, stub_model(User))
end
it "renders attributes in <p>" do

No commit comments for this range

Something went wrong with that request. Please try again.