Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Passing rake

  • Loading branch information...
commit 865d8f13e80021d03f5d707dbe88cdf5e76eb5da 1 parent f2f243d
Mike Burns mike-burns authored jyurek committed
1  features/regenerating_styles.feature
View
@@ -3,7 +3,6 @@ Feature: Regenerating styles
Scenario: Adding a new style
Given I generate a new rails application
And I have made a simple avatar on the user model
- And I start the rails application
And I upload an avatar to the user model
When I add the following style to the user avatar:
"""
28 features/step_definitions/mvc_steps.rb
View
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/string'
+
Given /^I have made a simple avatar on the user model$/ do
run_simple(%{bundle exec #{generator_command} scaffold user})
run_simple(%{bundle exec #{generator_command} paperclip user avatar})
@@ -48,20 +50,23 @@ class User < ActiveRecord::Base
end
Then /^I see a missing large avatar on the user show page$/ do
- user = User.last
- user.should_not be_nil
- visit "/users/#{user.to_param}"
+ visit '/users'
+ click_link 'Show'
page.source =~ %r{img src="/([^"]+large[^"]+)\?.*"}
image_path = $1
image_path.should_not be_blank
- File.should_not be_exist(Rails.root.join('public',image_path))
+ in_current_dir do
+ File.should_not be_exist(File.join('public',image_path))
+ end
end
When /^I generate the "(.*?)" migration as follows:$/ do |migration_name, code|
run_simple(%{bundle exec ./script/rails generate migration #{migration_name}})
- migration_filename = Dir[Rails.root.join('db', 'migrate', "*#{migration_name}.rb")].first
+ migration_filename = in_current_dir do
+ Dir[File.join('db', 'migrate', "*#{migration_name}.rb")].first
+ end
write_file(migration_filename, <<-MIGRATION)
class #{migration_name.classify} < ActiveRecord::Migration
#{code}
@@ -74,7 +79,9 @@ class #{migration_name.classify} < ActiveRecord::Migration
end
When /^I run the down database migration$/ do
- migration_filename = Dir[Rails.root.join('db', 'migrate', '*')].sort.last
+ migration_filename = in_current_dir do
+ Dir[File.join('db', 'migrate', '*')].sort.last
+ end
migration_filename =~ %r{.*/(\d+)_[^/]+.rb}
version = $1
version.should_not be_blank
@@ -82,13 +89,14 @@ class #{migration_name.classify} < ActiveRecord::Migration
end
Then /^I see the large avatar on the user show page$/ do
- user = User.last
- user.should_not be_nil
- visit "/users/#{user.to_param}"
+ visit '/users'
+ click_link 'Show'
page.source =~ %r{img src="/([^"]+large[^"]+)\?.*"}
image_path = $1
image_path.should_not be_blank
- File.should be_exist(Rails.root.join('public',image_path))
+ in_current_dir do
+ File.should be_exist(File.join('public',image_path))
+ end
end
2  features/support/rails.rb
View
@@ -11,6 +11,8 @@
end
After do
+ RailsServer.stop
+
ORIGINAL_BUNDLE_VARS.each_pair do |key, value|
ENV[key] = value
end
Please sign in to comment.
Something went wrong with that request. Please try again.