-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Fletcher + Tom Uebel
committed
Dec 27, 2012
1 parent
3447cb8
commit 018ff1f
Showing
15 changed files
with
694 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Feature: (#7551) New dash data throws error when the include_subworkstreams parameter is supplied | ||
|
||
Background: | ||
Given I am logged in | ||
And I am not an administrator | ||
|
||
Scenario: New dash data throws error | ||
Given I belong to a public workstream | ||
When I go to dash data | ||
Then I do not see an error screen |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Capybara::Driver::Webkit::Browser.class_eval do | ||
@@pid = nil | ||
|
||
def initialize(options = {}) | ||
@socket_class = options[:socket_class] || TCPSocket | ||
ensure_server | ||
connect | ||
end | ||
|
||
private | ||
|
||
def ensure_server; start_server unless server_running?; end | ||
def start_server | ||
server_path = File.expand_path("#{gem_path}/bin/webkit_server", __FILE__) | ||
@@pid = fork { exec(server_path) } | ||
at_exit { Process.kill("INT", @@pid) } | ||
end | ||
def gem_path; @gem_path ||= Gem.loaded_specs["capybara-webkit"].full_gem_path; end | ||
def server_running?; !@@pid.nil?; 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Webrat.module_eval do | ||
def self.session_class | ||
if Webrat.configuration.mode == :selenium | ||
Webrat::SeleniumSession | ||
elsif Webrat.configuration.mode == :webkit | ||
WebkitSession | ||
else | ||
Webrat::Session | ||
end | ||
end | ||
end | ||
|
||
Webrat::Scope.class_eval do | ||
# Eliminates response caching so ajax can work | ||
def dom # :nodoc: | ||
if @selector | ||
return scoped_dom | ||
else | ||
return page_dom | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Feature:(#6137) Browse Bettermeans only shows public workstreams | ||
|
||
Background: | ||
Given I am logged in | ||
And I am not an administrator | ||
|
||
Scenario: I can see any public workstreams | ||
Given I belong to a public workstream | ||
When I go to Browse Bettermeans | ||
Then I see it | ||
Given a public workstream that I do not belong to | ||
When I go to Browse Bettermeans | ||
Then I see it | ||
|
||
Scenario: I cannot see private workstreams even when I am a member | ||
Given a private workstream that I do not belong to | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
Given I belong to a private workstream | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
|
||
Scenario: I cannot see private workstreams that I do not belong to but Anonymous does | ||
Given a private workstream that I do not belong to | ||
But the anonymous user is a member | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
|
||
Scenario: Administrators cannot see any private workstreams | ||
Given I am an administrator | ||
And a private workstream that I do not belong to | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
Given I belong to a private workstream | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
|
||
Scenario: Anonymous users can see all public workstreams | ||
Given I am not logged in | ||
Given I belong to a public workstream | ||
When I go to Browse Bettermeans | ||
Then I see it | ||
Given a public workstream that I do not belong to | ||
When I go to Browse Bettermeans | ||
Then I see it | ||
|
||
Scenario: Anonymous users cannot see any private workstreams at all | ||
Given I am not logged in | ||
And a private workstream that I do not belong to | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
Given I belong to a private workstream | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
|
||
Scenario: It only shows root workstreams | ||
Given a public workstream that is a child of another public workstream | ||
When I go to Browse Bettermeans | ||
Then I do not see it | ||
|
||
Scenario: It only shows the top 10 workstreams | ||
Given there are more than 10 workstreams available | ||
When I go to Browse Bettermeans | ||
Then I only see 10 | ||
|
||
@ajax | ||
Scenario: I cannot see any private workstreams when I load more | ||
Given there are 10 workstreams available | ||
And a private workstream that I do not belong to | ||
And I belong to a private workstream | ||
When I go to Browse Bettermeans | ||
And I load more | ||
And I wait until loaded | ||
Then I only see 10 | ||
|
||
@ajax | ||
Scenario: I can see public workstreams when I load more | ||
Given there are 11 workstreams available | ||
When I go to Browse Bettermeans | ||
And I load more | ||
And I wait until loaded | ||
Then I see 11 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Given /^I am logged in$/ do | ||
Given "I am logged in as \"brian_dennehy\"" | ||
end | ||
|
||
Given /^I am logged in as "([^\"]*)"$/ do |username| | ||
@user = ensure_account username,username | ||
|
||
teardown { User.delete @user if @user } | ||
|
||
Then "Login in as #{username} with password #{username}" | ||
|
||
assert_not_contain "Invalid user or password" | ||
end | ||
|
||
Given /^I am not logged in$/ do | ||
visit "http://localhost:3000/logout" | ||
@user = User.anonymous | ||
end | ||
|
||
Given /^I am(\snot)? an administrator$/ do |not_an_adminstrator| | ||
is_admin = not_an_adminstrator.nil? or not_an_adminstrator | ||
@user.admin = is_admin | ||
@user.save! | ||
end | ||
|
||
Given /^Login in as ([^\"]*) with password ([^\"]*)$/ do |username, password| | ||
visit "http://localhost:3000/login" | ||
fill_in "username", :with => username | ||
fill_in "password", :with => password | ||
click_button "login" | ||
end | ||
|
||
When /^I go to Browse Bettermeans$/ do | ||
visit "http://localhost:3000/projects" | ||
@view = BrowseBettermeansView.new webrat_session | ||
end | ||
|
||
When /^I go to dash data$/ do | ||
the_project = projects.last | ||
visit "http://localhost:3000/projects/#{the_project.id}/new_dashdata?include_subworkstreams=true" | ||
end | ||
|
||
When /^I wait until/ do | ||
@view.wait_until_loaded | ||
end | ||
|
||
Then /^I do not see an error screen/ do | ||
webrat_session.response_body.should_not contain "Action Controller: Exception caught" | ||
end | ||
|
||
def ensure_account(username, password) | ||
result = User.find_by_login(username) | ||
|
||
result = create_account(username, password) unless result | ||
|
||
result | ||
end | ||
|
||
def create_account(username, password) | ||
new_user = User.new | ||
new_user.login = username | ||
new_user.firstname = username | ||
new_user.lastname = username | ||
new_user.password = password | ||
new_user.admin = false | ||
new_user.mail = "#{username}@xxx.com" | ||
|
||
new_user.save! | ||
|
||
new_user | ||
end |
Oops, something went wrong.