Skip to content
Snippets Groups Projects
Commit 6b030fd4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

1.1pre1

parent 3a2b2733
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,7 +3,8 @@ module LoginMacros
@user = User.create(:email => "user#{User.count}@mail.com",
:name => "John Smith",
:password => "123456",
:password_confirmation => "123456")
:password_confirmation => "123456",
:skype => 'user_skype')
if role == :admin
@user.admin = true
Loading
Loading
Loading
Loading
@@ -21,17 +21,30 @@ RSpec::Matchers.define :be_denied_for do |user|
end
end
 
RSpec::Matchers.define :be_404_for do |user|
match do |url|
include UrlAccess
url_404?(user, url)
end
end
module UrlAccess
def url_allowed?(user, url)
emulate_user(user)
visit url
result = (current_path == url)
(page.status_code != 404 && current_path != new_user_session_path)
end
 
def url_denied?(user, url)
emulate_user(user)
visit url
result = (current_path != url)
(page.status_code == 404 || current_path == new_user_session_path)
end
def url_404?(user, url)
emulate_user(user)
visit url
page.status_code == 404
end
 
def emulate_user(user)
Loading
Loading
Loading
Loading
@@ -2,6 +2,10 @@ root_path = File.expand_path(File.dirname(__FILE__))
require File.join(root_path, "lib", "color")
include Color
 
def version
File.read("VERSION")
end
#
# ruby ./update.rb development # or test or production (default)
#
Loading
Loading
@@ -12,15 +16,29 @@ env = if envs.include?(ARGV[0])
"production"
end
 
puts green " == Update for ENV=#{env}"
puts yellow "== RAILS ENV | #{env}"
current_version = version
puts yellow "Your version is #{current_version}"
puts yellow "Check for new version: $ git pull origin 1x"
`git pull origin 1x` # pull from origin
 
# pull from github
`git pull`
# latest version
if version == current_version
puts yellow "You have a latest version"
else
puts green "Update to #{version}"
 
`bundle install`
 
# migrate db
# migrate db
if env == "development"
`bundle exec rake db:migrate RAILS_ENV=development`
`bundle exec rake db:migrate RAILS_ENV=test`
else
`bundle exec rake db:migrate RAILS_ENV=#{env}`
end
puts green "== Done! Now you can start/restart server"
end
 
 
puts green " == Done! Now you can start/restart server"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment