From 94a5654371812905c154f29cef393d42f13c5eaa Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Tue, 18 Feb 2014 18:16:28 -0500 Subject: Added the generate shell command. Please do not commit the generated files. --- app/views/matches/_form.html.erb | 17 +++++++++++++++++ app/views/matches/edit.html.erb | 6 ++++++ app/views/matches/index.html.erb | 25 +++++++++++++++++++++++++ app/views/matches/index.json.jbuilder | 4 ++++ app/views/matches/new.html.erb | 5 +++++ app/views/matches/show.html.erb | 4 ++++ app/views/matches/show.json.jbuilder | 1 + app/views/servers/_form.html.erb | 17 +++++++++++++++++ app/views/servers/edit.html.erb | 6 ++++++ app/views/servers/index.html.erb | 25 +++++++++++++++++++++++++ app/views/servers/index.json.jbuilder | 4 ++++ app/views/servers/new.html.erb | 5 +++++ app/views/servers/show.html.erb | 4 ++++ app/views/servers/show.json.jbuilder | 1 + app/views/teams/_form.html.erb | 17 +++++++++++++++++ app/views/teams/edit.html.erb | 6 ++++++ app/views/teams/index.html.erb | 25 +++++++++++++++++++++++++ app/views/teams/index.json.jbuilder | 4 ++++ app/views/teams/new.html.erb | 5 +++++ app/views/teams/show.html.erb | 4 ++++ app/views/teams/show.json.jbuilder | 1 + app/views/tournaments/_form.html.erb | 17 +++++++++++++++++ app/views/tournaments/edit.html.erb | 6 ++++++ app/views/tournaments/index.html.erb | 25 +++++++++++++++++++++++++ app/views/tournaments/index.json.jbuilder | 4 ++++ app/views/tournaments/new.html.erb | 5 +++++ app/views/tournaments/show.html.erb | 4 ++++ app/views/tournaments/show.json.jbuilder | 1 + app/views/users/_form.html.erb | 17 +++++++++++++++++ app/views/users/edit.html.erb | 6 ++++++ app/views/users/index.html.erb | 25 +++++++++++++++++++++++++ app/views/users/index.json.jbuilder | 4 ++++ app/views/users/new.html.erb | 5 +++++ app/views/users/show.html.erb | 4 ++++ app/views/users/show.json.jbuilder | 1 + 35 files changed, 310 insertions(+) create mode 100644 app/views/matches/_form.html.erb create mode 100644 app/views/matches/edit.html.erb create mode 100644 app/views/matches/index.html.erb create mode 100644 app/views/matches/index.json.jbuilder create mode 100644 app/views/matches/new.html.erb create mode 100644 app/views/matches/show.html.erb create mode 100644 app/views/matches/show.json.jbuilder create mode 100644 app/views/servers/_form.html.erb create mode 100644 app/views/servers/edit.html.erb create mode 100644 app/views/servers/index.html.erb create mode 100644 app/views/servers/index.json.jbuilder create mode 100644 app/views/servers/new.html.erb create mode 100644 app/views/servers/show.html.erb create mode 100644 app/views/servers/show.json.jbuilder create mode 100644 app/views/teams/_form.html.erb create mode 100644 app/views/teams/edit.html.erb create mode 100644 app/views/teams/index.html.erb create mode 100644 app/views/teams/index.json.jbuilder create mode 100644 app/views/teams/new.html.erb create mode 100644 app/views/teams/show.html.erb create mode 100644 app/views/teams/show.json.jbuilder create mode 100644 app/views/tournaments/_form.html.erb create mode 100644 app/views/tournaments/edit.html.erb create mode 100644 app/views/tournaments/index.html.erb create mode 100644 app/views/tournaments/index.json.jbuilder create mode 100644 app/views/tournaments/new.html.erb create mode 100644 app/views/tournaments/show.html.erb create mode 100644 app/views/tournaments/show.json.jbuilder create mode 100644 app/views/users/_form.html.erb create mode 100644 app/views/users/edit.html.erb create mode 100644 app/views/users/index.html.erb create mode 100644 app/views/users/index.json.jbuilder create mode 100644 app/views/users/new.html.erb create mode 100644 app/views/users/show.html.erb create mode 100644 app/views/users/show.json.jbuilder (limited to 'app/views') diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb new file mode 100644 index 0000000..c772c7f --- /dev/null +++ b/app/views/matches/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@match) do |f| %> + <% if @match.errors.any? %> +
+

<%= pluralize(@match.errors.count, "error") %> prohibited this match from being saved:

+ + +
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/matches/edit.html.erb b/app/views/matches/edit.html.erb new file mode 100644 index 0000000..38b7d70 --- /dev/null +++ b/app/views/matches/edit.html.erb @@ -0,0 +1,6 @@ +

Editing match

+ +<%= render 'form' %> + +<%= link_to 'Show', @match %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb new file mode 100644 index 0000000..22ae41e --- /dev/null +++ b/app/views/matches/index.html.erb @@ -0,0 +1,25 @@ +

Listing matches

+ + + + + + + + + + + + <% @matches.each do |match| %> + + + + + + <% end %> + +
<%= link_to 'Show', match %><%= link_to 'Edit', edit_match_path(match) %><%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Match', new_match_path %> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder new file mode 100644 index 0000000..08daa52 --- /dev/null +++ b/app/views/matches/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@matches) do |match| + json.extract! match, :id + json.url match_url(match, format: :json) +end diff --git a/app/views/matches/new.html.erb b/app/views/matches/new.html.erb new file mode 100644 index 0000000..bd4c78c --- /dev/null +++ b/app/views/matches/new.html.erb @@ -0,0 +1,5 @@ +

New match

+ +<%= render 'form' %> + +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb new file mode 100644 index 0000000..453985b --- /dev/null +++ b/app/views/matches/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_match_path(@match) %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder new file mode 100644 index 0000000..7190e4c --- /dev/null +++ b/app/views/matches/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @match, :id, :created_at, :updated_at diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb new file mode 100644 index 0000000..b08654b --- /dev/null +++ b/app/views/servers/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@server) do |f| %> + <% if @server.errors.any? %> +
+

<%= pluralize(@server.errors.count, "error") %> prohibited this server from being saved:

+ + +
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/servers/edit.html.erb b/app/views/servers/edit.html.erb new file mode 100644 index 0000000..a92cdb5 --- /dev/null +++ b/app/views/servers/edit.html.erb @@ -0,0 +1,6 @@ +

Editing server

+ +<%= render 'form' %> + +<%= link_to 'Show', @server %> | +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb new file mode 100644 index 0000000..f45d393 --- /dev/null +++ b/app/views/servers/index.html.erb @@ -0,0 +1,25 @@ +

Listing servers

+ + + + + + + + + + + + <% @servers.each do |server| %> + + + + + + <% end %> + +
<%= link_to 'Show', server %><%= link_to 'Edit', edit_server_path(server) %><%= link_to 'Destroy', server, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Server', new_server_path %> diff --git a/app/views/servers/index.json.jbuilder b/app/views/servers/index.json.jbuilder new file mode 100644 index 0000000..2776abc --- /dev/null +++ b/app/views/servers/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@servers) do |server| + json.extract! server, :id + json.url server_url(server, format: :json) +end diff --git a/app/views/servers/new.html.erb b/app/views/servers/new.html.erb new file mode 100644 index 0000000..0422009 --- /dev/null +++ b/app/views/servers/new.html.erb @@ -0,0 +1,5 @@ +

New server

+ +<%= render 'form' %> + +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb new file mode 100644 index 0000000..039cd8f --- /dev/null +++ b/app/views/servers/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_server_path(@server) %> | +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/show.json.jbuilder b/app/views/servers/show.json.jbuilder new file mode 100644 index 0000000..972b1c0 --- /dev/null +++ b/app/views/servers/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @server, :id, :created_at, :updated_at diff --git a/app/views/teams/_form.html.erb b/app/views/teams/_form.html.erb new file mode 100644 index 0000000..fd10129 --- /dev/null +++ b/app/views/teams/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@team) do |f| %> + <% if @team.errors.any? %> +
+

<%= pluralize(@team.errors.count, "error") %> prohibited this team from being saved:

+ + +
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/teams/edit.html.erb b/app/views/teams/edit.html.erb new file mode 100644 index 0000000..49858ad --- /dev/null +++ b/app/views/teams/edit.html.erb @@ -0,0 +1,6 @@ +

Editing team

+ +<%= render 'form' %> + +<%= link_to 'Show', @team %> | +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/index.html.erb b/app/views/teams/index.html.erb new file mode 100644 index 0000000..b077e10 --- /dev/null +++ b/app/views/teams/index.html.erb @@ -0,0 +1,25 @@ +

Listing teams

+ + + + + + + + + + + + <% @teams.each do |team| %> + + + + + + <% end %> + +
<%= link_to 'Show', team %><%= link_to 'Edit', edit_team_path(team) %><%= link_to 'Destroy', team, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Team', new_team_path %> diff --git a/app/views/teams/index.json.jbuilder b/app/views/teams/index.json.jbuilder new file mode 100644 index 0000000..b29428b --- /dev/null +++ b/app/views/teams/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@teams) do |team| + json.extract! team, :id + json.url team_url(team, format: :json) +end diff --git a/app/views/teams/new.html.erb b/app/views/teams/new.html.erb new file mode 100644 index 0000000..433d944 --- /dev/null +++ b/app/views/teams/new.html.erb @@ -0,0 +1,5 @@ +

New team

+ +<%= render 'form' %> + +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb new file mode 100644 index 0000000..5b18d33 --- /dev/null +++ b/app/views/teams/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_team_path(@team) %> | +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/show.json.jbuilder b/app/views/teams/show.json.jbuilder new file mode 100644 index 0000000..1538019 --- /dev/null +++ b/app/views/teams/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @team, :id, :created_at, :updated_at diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb new file mode 100644 index 0000000..8996266 --- /dev/null +++ b/app/views/tournaments/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@tournament) do |f| %> + <% if @tournament.errors.any? %> +
+

<%= pluralize(@tournament.errors.count, "error") %> prohibited this tournament from being saved:

+ + +
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/tournaments/edit.html.erb b/app/views/tournaments/edit.html.erb new file mode 100644 index 0000000..2913025 --- /dev/null +++ b/app/views/tournaments/edit.html.erb @@ -0,0 +1,6 @@ +

Editing tournament

+ +<%= render 'form' %> + +<%= link_to 'Show', @tournament %> | +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb new file mode 100644 index 0000000..7124111 --- /dev/null +++ b/app/views/tournaments/index.html.erb @@ -0,0 +1,25 @@ +

Listing tournaments

+ + + + + + + + + + + + <% @tournaments.each do |tournament| %> + + + + + + <% end %> + +
<%= link_to 'Show', tournament %><%= link_to 'Edit', edit_tournament_path(tournament) %><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Tournament', new_tournament_path %> diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder new file mode 100644 index 0000000..28d6960 --- /dev/null +++ b/app/views/tournaments/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@tournaments) do |tournament| + json.extract! tournament, :id + json.url tournament_url(tournament, format: :json) +end diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb new file mode 100644 index 0000000..2a60539 --- /dev/null +++ b/app/views/tournaments/new.html.erb @@ -0,0 +1,5 @@ +

New tournament

+ +<%= render 'form' %> + +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb new file mode 100644 index 0000000..2c280ba --- /dev/null +++ b/app/views/tournaments/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_tournament_path(@tournament) %> | +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder new file mode 100644 index 0000000..211799a --- /dev/null +++ b/app/views/tournaments/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @tournament, :id, :created_at, :updated_at diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb new file mode 100644 index 0000000..4835056 --- /dev/null +++ b/app/views/users/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@user) do |f| %> + <% if @user.errors.any? %> +
+

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

+ + +
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 0000000..99bd4cc --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,6 @@ +

Editing user

+ +<%= render 'form' %> + +<%= link_to 'Show', @user %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..24a2548 --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,25 @@ +

Listing users

+ + + + + + + + + + + + <% @users.each do |user| %> + + + + + + <% end %> + +
<%= link_to 'Show', user %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New User', new_user_path %> diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder new file mode 100644 index 0000000..6684a9c --- /dev/null +++ b/app/views/users/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@users) do |user| + json.extract! user, :id + json.url user_url(user, format: :json) +end diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 0000000..efc0404 --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,5 @@ +

New user

+ +<%= render 'form' %> + +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..32abeb0 --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_user_path(@user) %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder new file mode 100644 index 0000000..80ed63e --- /dev/null +++ b/app/views/users/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @user, :id, :created_at, :updated_at -- cgit v1.2.3-54-g00ecf From 96b97d691f6889004c38bef15411bc27e448fda1 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Tue, 18 Feb 2014 20:42:51 -0500 Subject: Changes to generate.sh --- app/assets/javascripts/alerts.js.coffee | 3 + app/assets/javascripts/main.js.coffee | 3 + app/assets/javascripts/pms.js.coffee | 3 + app/assets/javascripts/search.js.coffee | 3 + app/assets/stylesheets/alerts.css.scss | 3 + app/assets/stylesheets/main.css.scss | 3 + app/assets/stylesheets/pms.css.scss | 3 + app/assets/stylesheets/search.css.scss | 3 + app/controllers/alerts_controller.rb | 74 ++++++++++++++++++++++ app/controllers/main_controller.rb | 2 + app/controllers/matches_controller.rb | 2 +- app/controllers/pms_controller.rb | 74 ++++++++++++++++++++++ app/controllers/search_controller.rb | 2 + app/controllers/users_controller.rb | 2 +- app/helpers/alerts_helper.rb | 2 + app/helpers/main_helper.rb | 2 + app/helpers/pms_helper.rb | 2 + app/helpers/search_helper.rb | 2 + app/models/alert.rb | 2 + app/models/pm.rb | 2 + app/models/server_settings.rb | 2 + app/models/team_match_pair.rb | 2 + app/models/user_team_pair.rb | 2 + app/views/alerts/_form.html.erb | 25 ++++++++ app/views/alerts/edit.html.erb | 6 ++ app/views/alerts/index.html.erb | 29 +++++++++ app/views/alerts/index.json.jbuilder | 4 ++ app/views/alerts/new.html.erb | 5 ++ app/views/alerts/show.html.erb | 14 ++++ app/views/alerts/show.json.jbuilder | 1 + app/views/matches/_form.html.erb | 4 ++ app/views/matches/index.html.erb | 2 + app/views/matches/index.json.jbuilder | 2 +- app/views/matches/show.html.erb | 5 ++ app/views/matches/show.json.jbuilder | 2 +- app/views/pms/_form.html.erb | 29 +++++++++ app/views/pms/edit.html.erb | 6 ++ app/views/pms/index.html.erb | 31 +++++++++ app/views/pms/index.json.jbuilder | 4 ++ app/views/pms/new.html.erb | 5 ++ app/views/pms/show.html.erb | 19 ++++++ app/views/pms/show.json.jbuilder | 1 + app/views/users/_form.html.erb | 12 ++++ app/views/users/index.html.erb | 6 ++ app/views/users/index.json.jbuilder | 2 +- app/views/users/show.html.erb | 15 +++++ app/views/users/show.json.jbuilder | 2 +- config/routes.rb | 4 ++ db/migrate/20140304014722_create_servers.rb | 8 --- db/migrate/20140304014725_create_tournaments.rb | 8 --- db/migrate/20140304014727_create_matches.rb | 8 --- db/migrate/20140304014729_create_teams.rb | 8 --- db/migrate/20140304014731_create_users.rb | 8 --- db/migrate/20140304014738_create_servers.rb | 8 +++ db/migrate/20140304014740_create_tournaments.rb | 8 +++ db/migrate/20140304014742_create_matches.rb | 9 +++ db/migrate/20140304014745_create_teams.rb | 8 +++ db/migrate/20140304014747_create_users.rb | 11 ++++ .../20140304014749_create_user_team_pairs.rb | 10 +++ .../20140304014751_create_team_match_pairs.rb | 10 +++ db/migrate/20140304014753_create_alerts.rb | 10 +++ db/migrate/20140304014755_create_pms.rb | 11 ++++ .../20140304014757_create_server_settings.rb | 8 +++ db/schema.rb | 41 ------------ generate.sh | 15 +++-- test/controllers/alerts_controller_test.rb | 49 ++++++++++++++ test/controllers/main_controller_test.rb | 7 ++ test/controllers/matches_controller_test.rb | 4 +- test/controllers/pms_controller_test.rb | 49 ++++++++++++++ test/controllers/search_controller_test.rb | 7 ++ test/controllers/users_controller_test.rb | 4 +- test/fixtures/alerts.yml | 9 +++ test/fixtures/matches.yml | 14 ++-- test/fixtures/pms.yml | 11 ++++ test/fixtures/server_settings.yml | 11 ++++ test/fixtures/team_match_pairs.yml | 9 +++ test/fixtures/user_team_pairs.yml | 9 +++ test/fixtures/users.yml | 18 +++--- test/helpers/alerts_helper_test.rb | 4 ++ test/helpers/main_helper_test.rb | 4 ++ test/helpers/pms_helper_test.rb | 4 ++ test/helpers/search_helper_test.rb | 4 ++ test/models/alert_test.rb | 7 ++ test/models/pm_test.rb | 7 ++ test/models/server_settings_test.rb | 7 ++ test/models/team_match_pair_test.rb | 7 ++ test/models/user_team_pair_test.rb | 7 ++ 87 files changed, 761 insertions(+), 113 deletions(-) create mode 100644 app/assets/javascripts/alerts.js.coffee create mode 100644 app/assets/javascripts/main.js.coffee create mode 100644 app/assets/javascripts/pms.js.coffee create mode 100644 app/assets/javascripts/search.js.coffee create mode 100644 app/assets/stylesheets/alerts.css.scss create mode 100644 app/assets/stylesheets/main.css.scss create mode 100644 app/assets/stylesheets/pms.css.scss create mode 100644 app/assets/stylesheets/search.css.scss create mode 100644 app/controllers/alerts_controller.rb create mode 100644 app/controllers/main_controller.rb create mode 100644 app/controllers/pms_controller.rb create mode 100644 app/controllers/search_controller.rb create mode 100644 app/helpers/alerts_helper.rb create mode 100644 app/helpers/main_helper.rb create mode 100644 app/helpers/pms_helper.rb create mode 100644 app/helpers/search_helper.rb create mode 100644 app/models/alert.rb create mode 100644 app/models/pm.rb create mode 100644 app/models/server_settings.rb create mode 100644 app/models/team_match_pair.rb create mode 100644 app/models/user_team_pair.rb create mode 100644 app/views/alerts/_form.html.erb create mode 100644 app/views/alerts/edit.html.erb create mode 100644 app/views/alerts/index.html.erb create mode 100644 app/views/alerts/index.json.jbuilder create mode 100644 app/views/alerts/new.html.erb create mode 100644 app/views/alerts/show.html.erb create mode 100644 app/views/alerts/show.json.jbuilder create mode 100644 app/views/pms/_form.html.erb create mode 100644 app/views/pms/edit.html.erb create mode 100644 app/views/pms/index.html.erb create mode 100644 app/views/pms/index.json.jbuilder create mode 100644 app/views/pms/new.html.erb create mode 100644 app/views/pms/show.html.erb create mode 100644 app/views/pms/show.json.jbuilder delete mode 100644 db/migrate/20140304014722_create_servers.rb delete mode 100644 db/migrate/20140304014725_create_tournaments.rb delete mode 100644 db/migrate/20140304014727_create_matches.rb delete mode 100644 db/migrate/20140304014729_create_teams.rb delete mode 100644 db/migrate/20140304014731_create_users.rb create mode 100644 db/migrate/20140304014738_create_servers.rb create mode 100644 db/migrate/20140304014740_create_tournaments.rb create mode 100644 db/migrate/20140304014742_create_matches.rb create mode 100644 db/migrate/20140304014745_create_teams.rb create mode 100644 db/migrate/20140304014747_create_users.rb create mode 100644 db/migrate/20140304014749_create_user_team_pairs.rb create mode 100644 db/migrate/20140304014751_create_team_match_pairs.rb create mode 100644 db/migrate/20140304014753_create_alerts.rb create mode 100644 db/migrate/20140304014755_create_pms.rb create mode 100644 db/migrate/20140304014757_create_server_settings.rb delete mode 100644 db/schema.rb create mode 100644 test/controllers/alerts_controller_test.rb create mode 100644 test/controllers/main_controller_test.rb create mode 100644 test/controllers/pms_controller_test.rb create mode 100644 test/controllers/search_controller_test.rb create mode 100644 test/fixtures/alerts.yml create mode 100644 test/fixtures/pms.yml create mode 100644 test/fixtures/server_settings.yml create mode 100644 test/fixtures/team_match_pairs.yml create mode 100644 test/fixtures/user_team_pairs.yml create mode 100644 test/helpers/alerts_helper_test.rb create mode 100644 test/helpers/main_helper_test.rb create mode 100644 test/helpers/pms_helper_test.rb create mode 100644 test/helpers/search_helper_test.rb create mode 100644 test/models/alert_test.rb create mode 100644 test/models/pm_test.rb create mode 100644 test/models/server_settings_test.rb create mode 100644 test/models/team_match_pair_test.rb create mode 100644 test/models/user_team_pair_test.rb (limited to 'app/views') diff --git a/app/assets/javascripts/alerts.js.coffee b/app/assets/javascripts/alerts.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/alerts.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/main.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/pms.js.coffee b/app/assets/javascripts/pms.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/pms.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/search.js.coffee b/app/assets/javascripts/search.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/search.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/alerts.css.scss b/app/assets/stylesheets/alerts.css.scss new file mode 100644 index 0000000..c01a620 --- /dev/null +++ b/app/assets/stylesheets/alerts.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the alerts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/main.css.scss b/app/assets/stylesheets/main.css.scss new file mode 100644 index 0000000..a0d94c1 --- /dev/null +++ b/app/assets/stylesheets/main.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the main controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/pms.css.scss b/app/assets/stylesheets/pms.css.scss new file mode 100644 index 0000000..5106093 --- /dev/null +++ b/app/assets/stylesheets/pms.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the pms controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/search.css.scss b/app/assets/stylesheets/search.css.scss new file mode 100644 index 0000000..22fd394 --- /dev/null +++ b/app/assets/stylesheets/search.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the search controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/alerts_controller.rb b/app/controllers/alerts_controller.rb new file mode 100644 index 0000000..e6158f4 --- /dev/null +++ b/app/controllers/alerts_controller.rb @@ -0,0 +1,74 @@ +class AlertsController < ApplicationController + before_action :set_alert, only: [:show, :edit, :update, :destroy] + + # GET /alerts + # GET /alerts.json + def index + @alerts = Alert.all + end + + # GET /alerts/1 + # GET /alerts/1.json + def show + end + + # GET /alerts/new + def new + @alert = Alert.new + end + + # GET /alerts/1/edit + def edit + end + + # POST /alerts + # POST /alerts.json + def create + @alert = Alert.new(alert_params) + + respond_to do |format| + if @alert.save + format.html { redirect_to @alert, notice: 'Alert was successfully created.' } + format.json { render action: 'show', status: :created, location: @alert } + else + format.html { render action: 'new' } + format.json { render json: @alert.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /alerts/1 + # PATCH/PUT /alerts/1.json + def update + respond_to do |format| + if @alert.update(alert_params) + format.html { redirect_to @alert, notice: 'Alert was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @alert.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /alerts/1 + # DELETE /alerts/1.json + def destroy + @alert.destroy + respond_to do |format| + format.html { redirect_to alerts_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_alert + @alert = Alert.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def alert_params + params.require(:alert).permit(:author, :message) + end +end diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb new file mode 100644 index 0000000..6519d7b --- /dev/null +++ b/app/controllers/main_controller.rb @@ -0,0 +1,2 @@ +class MainController < ApplicationController +end diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 4c0c4e4..bb2a67a 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -69,6 +69,6 @@ class MatchesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def match_params - params[:match] + params.require(:match).permit(:tournament) end end diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb new file mode 100644 index 0000000..6eb94f9 --- /dev/null +++ b/app/controllers/pms_controller.rb @@ -0,0 +1,74 @@ +class PmsController < ApplicationController + before_action :set_pm, only: [:show, :edit, :update, :destroy] + + # GET /pms + # GET /pms.json + def index + @pms = Pm.all + end + + # GET /pms/1 + # GET /pms/1.json + def show + end + + # GET /pms/new + def new + @pm = Pm.new + end + + # GET /pms/1/edit + def edit + end + + # POST /pms + # POST /pms.json + def create + @pm = Pm.new(pm_params) + + respond_to do |format| + if @pm.save + format.html { redirect_to @pm, notice: 'Pm was successfully created.' } + format.json { render action: 'show', status: :created, location: @pm } + else + format.html { render action: 'new' } + format.json { render json: @pm.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /pms/1 + # PATCH/PUT /pms/1.json + def update + respond_to do |format| + if @pm.update(pm_params) + format.html { redirect_to @pm, notice: 'Pm was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @pm.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /pms/1 + # DELETE /pms/1.json + def destroy + @pm.destroy + respond_to do |format| + format.html { redirect_to pms_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_pm + @pm = Pm.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def pm_params + params.require(:pm).permit(:author, :recipient, :message) + end +end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb new file mode 100644 index 0000000..ee61487 --- /dev/null +++ b/app/controllers/search_controller.rb @@ -0,0 +1,2 @@ +class SearchController < ApplicationController +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index da49625..4db617e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -69,6 +69,6 @@ class UsersController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def user_params - params[:user] + params.require(:user).permit(:name, :pw_hash, :groups) end end diff --git a/app/helpers/alerts_helper.rb b/app/helpers/alerts_helper.rb new file mode 100644 index 0000000..20f5b50 --- /dev/null +++ b/app/helpers/alerts_helper.rb @@ -0,0 +1,2 @@ +module AlertsHelper +end diff --git a/app/helpers/main_helper.rb b/app/helpers/main_helper.rb new file mode 100644 index 0000000..826effe --- /dev/null +++ b/app/helpers/main_helper.rb @@ -0,0 +1,2 @@ +module MainHelper +end diff --git a/app/helpers/pms_helper.rb b/app/helpers/pms_helper.rb new file mode 100644 index 0000000..0188e59 --- /dev/null +++ b/app/helpers/pms_helper.rb @@ -0,0 +1,2 @@ +module PmsHelper +end diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb new file mode 100644 index 0000000..b3ce20a --- /dev/null +++ b/app/helpers/search_helper.rb @@ -0,0 +1,2 @@ +module SearchHelper +end diff --git a/app/models/alert.rb b/app/models/alert.rb new file mode 100644 index 0000000..e61a702 --- /dev/null +++ b/app/models/alert.rb @@ -0,0 +1,2 @@ +class Alert < ActiveRecord::Base +end diff --git a/app/models/pm.rb b/app/models/pm.rb new file mode 100644 index 0000000..24d6eb4 --- /dev/null +++ b/app/models/pm.rb @@ -0,0 +1,2 @@ +class Pm < ActiveRecord::Base +end diff --git a/app/models/server_settings.rb b/app/models/server_settings.rb new file mode 100644 index 0000000..7f49863 --- /dev/null +++ b/app/models/server_settings.rb @@ -0,0 +1,2 @@ +class ServerSettings < ActiveRecord::Base +end diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb new file mode 100644 index 0000000..24a4e86 --- /dev/null +++ b/app/models/team_match_pair.rb @@ -0,0 +1,2 @@ +class TeamMatchPair < ActiveRecord::Base +end diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb new file mode 100644 index 0000000..7694996 --- /dev/null +++ b/app/models/user_team_pair.rb @@ -0,0 +1,2 @@ +class UserTeamPair < ActiveRecord::Base +end diff --git a/app/views/alerts/_form.html.erb b/app/views/alerts/_form.html.erb new file mode 100644 index 0000000..f0da996 --- /dev/null +++ b/app/views/alerts/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@alert) do |f| %> + <% if @alert.errors.any? %> +
+

<%= pluralize(@alert.errors.count, "error") %> prohibited this alert from being saved:

+ +
    + <% @alert.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :author %>
+ <%= f.text_field :author %> +
+
+ <%= f.label :message %>
+ <%= f.text_area :message %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/alerts/edit.html.erb b/app/views/alerts/edit.html.erb new file mode 100644 index 0000000..ad99164 --- /dev/null +++ b/app/views/alerts/edit.html.erb @@ -0,0 +1,6 @@ +

Editing alert

+ +<%= render 'form' %> + +<%= link_to 'Show', @alert %> | +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/index.html.erb b/app/views/alerts/index.html.erb new file mode 100644 index 0000000..458b951 --- /dev/null +++ b/app/views/alerts/index.html.erb @@ -0,0 +1,29 @@ +

Listing alerts

+ + + + + + + + + + + + + + <% @alerts.each do |alert| %> + + + + + + + + <% end %> + +
AuthorMessage
<%= alert.author %><%= alert.message %><%= link_to 'Show', alert %><%= link_to 'Edit', edit_alert_path(alert) %><%= link_to 'Destroy', alert, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Alert', new_alert_path %> diff --git a/app/views/alerts/index.json.jbuilder b/app/views/alerts/index.json.jbuilder new file mode 100644 index 0000000..685157e --- /dev/null +++ b/app/views/alerts/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@alerts) do |alert| + json.extract! alert, :id, :author, :message + json.url alert_url(alert, format: :json) +end diff --git a/app/views/alerts/new.html.erb b/app/views/alerts/new.html.erb new file mode 100644 index 0000000..6d04589 --- /dev/null +++ b/app/views/alerts/new.html.erb @@ -0,0 +1,5 @@ +

New alert

+ +<%= render 'form' %> + +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/show.html.erb b/app/views/alerts/show.html.erb new file mode 100644 index 0000000..eeab7f7 --- /dev/null +++ b/app/views/alerts/show.html.erb @@ -0,0 +1,14 @@ +

<%= notice %>

+ +

+ Author: + <%= @alert.author %> +

+ +

+ Message: + <%= @alert.message %> +

+ +<%= link_to 'Edit', edit_alert_path(@alert) %> | +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/show.json.jbuilder b/app/views/alerts/show.json.jbuilder new file mode 100644 index 0000000..83fe24a --- /dev/null +++ b/app/views/alerts/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @alert, :id, :author, :message, :created_at, :updated_at diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index c772c7f..7d0a371 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -11,6 +11,10 @@ <% end %> +
+ <%= f.label :tournament %>
+ <%= f.text_field :tournament %> +
<%= f.submit %>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 22ae41e..d8122ac 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -3,6 +3,7 @@ + @@ -12,6 +13,7 @@ <% @matches.each do |match| %> + diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder index 08daa52..0839c83 100644 --- a/app/views/matches/index.json.jbuilder +++ b/app/views/matches/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@matches) do |match| - json.extract! match, :id + json.extract! match, :id, :tournament json.url match_url(match, format: :json) end diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 453985b..7bab721 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,4 +1,9 @@

<%= notice %>

+

+ Tournament: + <%= @match.tournament %> +

+ <%= link_to 'Edit', edit_match_path(@match) %> | <%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder index 7190e4c..a381f65 100644 --- a/app/views/matches/show.json.jbuilder +++ b/app/views/matches/show.json.jbuilder @@ -1 +1 @@ -json.extract! @match, :id, :created_at, :updated_at +json.extract! @match, :id, :tournament, :created_at, :updated_at diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb new file mode 100644 index 0000000..bbc6aee --- /dev/null +++ b/app/views/pms/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@pm) do |f| %> + <% if @pm.errors.any? %> +
+

<%= pluralize(@pm.errors.count, "error") %> prohibited this pm from being saved:

+ +
    + <% @pm.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :author %>
+ <%= f.text_field :author %> +
+
+ <%= f.label :recipient %>
+ <%= f.text_field :recipient %> +
+
+ <%= f.label :message %>
+ <%= f.text_area :message %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/pms/edit.html.erb b/app/views/pms/edit.html.erb new file mode 100644 index 0000000..074a4fd --- /dev/null +++ b/app/views/pms/edit.html.erb @@ -0,0 +1,6 @@ +

Editing pm

+ +<%= render 'form' %> + +<%= link_to 'Show', @pm %> | +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb new file mode 100644 index 0000000..cb7fe4b --- /dev/null +++ b/app/views/pms/index.html.erb @@ -0,0 +1,31 @@ +

Listing pms

+ +
Tournament
<%= match.tournament %> <%= link_to 'Show', match %> <%= link_to 'Edit', edit_match_path(match) %> <%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %>
+ + + + + + + + + + + + + <% @pms.each do |pm| %> + + + + + + + + + <% end %> + +
AuthorRecipientMessage
<%= pm.author %><%= pm.recipient %><%= pm.message %><%= link_to 'Show', pm %><%= link_to 'Edit', edit_pm_path(pm) %><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Pm', new_pm_path %> diff --git a/app/views/pms/index.json.jbuilder b/app/views/pms/index.json.jbuilder new file mode 100644 index 0000000..aebdc08 --- /dev/null +++ b/app/views/pms/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@pms) do |pm| + json.extract! pm, :id, :author, :recipient, :message + json.url pm_url(pm, format: :json) +end diff --git a/app/views/pms/new.html.erb b/app/views/pms/new.html.erb new file mode 100644 index 0000000..29e24ec --- /dev/null +++ b/app/views/pms/new.html.erb @@ -0,0 +1,5 @@ +

New pm

+ +<%= render 'form' %> + +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb new file mode 100644 index 0000000..5ee483f --- /dev/null +++ b/app/views/pms/show.html.erb @@ -0,0 +1,19 @@ +

<%= notice %>

+ +

+ Author: + <%= @pm.author %> +

+ +

+ Recipient: + <%= @pm.recipient %> +

+ +

+ Message: + <%= @pm.message %> +

+ +<%= link_to 'Edit', edit_pm_path(@pm) %> | +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.json.jbuilder b/app/views/pms/show.json.jbuilder new file mode 100644 index 0000000..651e78f --- /dev/null +++ b/app/views/pms/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @pm, :id, :author, :recipient, :message, :created_at, :updated_at diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 4835056..a7ead1b 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -11,6 +11,18 @@ <% end %> +
+ <%= f.label :name %>
+ <%= f.text_area :name %> +
+
+ <%= f.label :pw_hash %>
+ <%= f.text_field :pw_hash %> +
+
+ <%= f.label :groups %>
+ <%= f.text_field :groups %> +
<%= f.submit %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 24a2548..14739ae 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -3,6 +3,9 @@ + + + @@ -12,6 +15,9 @@ <% @users.each do |user| %> + + + diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder index 6684a9c..58c42c1 100644 --- a/app/views/users/index.json.jbuilder +++ b/app/views/users/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@users) do |user| - json.extract! user, :id + json.extract! user, :id, :name, :pw_hash, :groups json.url user_url(user, format: :json) end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 32abeb0..05150f5 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,4 +1,19 @@

<%= notice %>

+

+ Name: + <%= @user.name %> +

+ +

+ Pw hash: + <%= @user.pw_hash %> +

+ +

+ Groups: + <%= @user.groups %> +

+ <%= link_to 'Edit', edit_user_path(@user) %> | <%= link_to 'Back', users_path %> diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder index 80ed63e..968b383 100644 --- a/app/views/users/show.json.jbuilder +++ b/app/views/users/show.json.jbuilder @@ -1 +1 @@ -json.extract! @user, :id, :created_at, :updated_at +json.extract! @user, :id, :name, :pw_hash, :groups, :created_at, :updated_at diff --git a/config/routes.rb b/config/routes.rb index b954a33..f13c891 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,8 @@ Leaguer::Application.routes.draw do + resources :pms + + resources :alerts + resources :users resources :teams diff --git a/db/migrate/20140304014722_create_servers.rb b/db/migrate/20140304014722_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304014722_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014725_create_tournaments.rb b/db/migrate/20140304014725_create_tournaments.rb deleted file mode 100644 index 2095590..0000000 --- a/db/migrate/20140304014725_create_tournaments.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014727_create_matches.rb b/db/migrate/20140304014727_create_matches.rb deleted file mode 100644 index 1478e75..0000000 --- a/db/migrate/20140304014727_create_matches.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014729_create_teams.rb b/db/migrate/20140304014729_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304014729_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014731_create_users.rb b/db/migrate/20140304014731_create_users.rb deleted file mode 100644 index 163109f..0000000 --- a/db/migrate/20140304014731_create_users.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014738_create_servers.rb b/db/migrate/20140304014738_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304014738_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014740_create_tournaments.rb b/db/migrate/20140304014740_create_tournaments.rb new file mode 100644 index 0000000..2095590 --- /dev/null +++ b/db/migrate/20140304014740_create_tournaments.rb @@ -0,0 +1,8 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014742_create_matches.rb b/db/migrate/20140304014742_create_matches.rb new file mode 100644 index 0000000..288ce6a --- /dev/null +++ b/db/migrate/20140304014742_create_matches.rb @@ -0,0 +1,9 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.reference :tournament + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014745_create_teams.rb b/db/migrate/20140304014745_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304014745_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014747_create_users.rb b/db/migrate/20140304014747_create_users.rb new file mode 100644 index 0000000..3723908 --- /dev/null +++ b/db/migrate/20140304014747_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.text :name + t.varchar :pw_hash + t.int :groups + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014749_create_user_team_pairs.rb b/db/migrate/20140304014749_create_user_team_pairs.rb new file mode 100644 index 0000000..3b60212 --- /dev/null +++ b/db/migrate/20140304014749_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.reference :user + t.reference :team + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014751_create_team_match_pairs.rb b/db/migrate/20140304014751_create_team_match_pairs.rb new file mode 100644 index 0000000..c489495 --- /dev/null +++ b/db/migrate/20140304014751_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.reference :team + t.reference :match + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014753_create_alerts.rb b/db/migrate/20140304014753_create_alerts.rb new file mode 100644 index 0000000..6167f33 --- /dev/null +++ b/db/migrate/20140304014753_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.reference :author + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014755_create_pms.rb b/db/migrate/20140304014755_create_pms.rb new file mode 100644 index 0000000..f3b27fb --- /dev/null +++ b/db/migrate/20140304014755_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.reference :author + t.reference :recipient + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014757_create_server_settings.rb b/db/migrate/20140304014757_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304014757_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index 1f34ab7..0000000 --- a/db/schema.rb +++ /dev/null @@ -1,41 +0,0 @@ -# encoding: UTF-8 -# 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 that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 20140304014731) do - - create_table "matches", force: true do |t| - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "servers", force: true do |t| - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "teams", force: true do |t| - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "tournaments", force: true do |t| - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "users", force: true do |t| - t.datetime "created_at" - t.datetime "updated_at" - end - -end diff --git a/generate.sh b/generate.sh index 95f00cc..28d1936 100755 --- a/generate.sh +++ b/generate.sh @@ -7,12 +7,19 @@ # # - +set -x bundle exec rails generate scaffold server bundle exec rails generate scaffold tournament -bundle exec rails generate scaffold match -bundle exec rails generate scaffold team -bundle exec rails generate scaffold user +bundle exec rails generate scaffold match tournament:reference +bundle exec rails generate scaffold team +bundle exec rails generate scaffold user name:text pw_hash:varchar groups:int +bundle exec rails generate model user_team_pair user:reference team:reference +bundle exec rails generate model team_match_pair team:reference match:reference +bundle exec rails generate scaffold alert author:reference message:text +bundle exec rails generate scaffold pm author:reference recipient:reference message:text +bundle exec rails generate model server_settings +bundle exec rails generate controller search +bundle exec rails generate controller main bundle exec rake db:drop RAILS_ENV=development bundle exec rake db:migrate RAILS_ENV=development #bundle exec rails generate scaffold diff --git a/test/controllers/alerts_controller_test.rb b/test/controllers/alerts_controller_test.rb new file mode 100644 index 0000000..29e58e9 --- /dev/null +++ b/test/controllers/alerts_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class AlertsControllerTest < ActionController::TestCase + setup do + @alert = alerts(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:alerts) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create alert" do + assert_difference('Alert.count') do + post :create, alert: { author: @alert.author, message: @alert.message } + end + + assert_redirected_to alert_path(assigns(:alert)) + end + + test "should show alert" do + get :show, id: @alert + assert_response :success + end + + test "should get edit" do + get :edit, id: @alert + assert_response :success + end + + test "should update alert" do + patch :update, id: @alert, alert: { author: @alert.author, message: @alert.message } + assert_redirected_to alert_path(assigns(:alert)) + end + + test "should destroy alert" do + assert_difference('Alert.count', -1) do + delete :destroy, id: @alert + end + + assert_redirected_to alerts_path + end +end diff --git a/test/controllers/main_controller_test.rb b/test/controllers/main_controller_test.rb new file mode 100644 index 0000000..b7ec6bf --- /dev/null +++ b/test/controllers/main_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MainControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb index 353ff4b..629622b 100644 --- a/test/controllers/matches_controller_test.rb +++ b/test/controllers/matches_controller_test.rb @@ -18,7 +18,7 @@ class MatchesControllerTest < ActionController::TestCase test "should create match" do assert_difference('Match.count') do - post :create, match: { } + post :create, match: { tournament: @match.tournament } end assert_redirected_to match_path(assigns(:match)) @@ -35,7 +35,7 @@ class MatchesControllerTest < ActionController::TestCase end test "should update match" do - patch :update, id: @match, match: { } + patch :update, id: @match, match: { tournament: @match.tournament } assert_redirected_to match_path(assigns(:match)) end diff --git a/test/controllers/pms_controller_test.rb b/test/controllers/pms_controller_test.rb new file mode 100644 index 0000000..ccbe7b1 --- /dev/null +++ b/test/controllers/pms_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class PmsControllerTest < ActionController::TestCase + setup do + @pm = pms(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:pms) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create pm" do + assert_difference('Pm.count') do + post :create, pm: { author: @pm.author, message: @pm.message, recipient: @pm.recipient } + end + + assert_redirected_to pm_path(assigns(:pm)) + end + + test "should show pm" do + get :show, id: @pm + assert_response :success + end + + test "should get edit" do + get :edit, id: @pm + assert_response :success + end + + test "should update pm" do + patch :update, id: @pm, pm: { author: @pm.author, message: @pm.message, recipient: @pm.recipient } + assert_redirected_to pm_path(assigns(:pm)) + end + + test "should destroy pm" do + assert_difference('Pm.count', -1) do + delete :destroy, id: @pm + end + + assert_redirected_to pms_path + end +end diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb new file mode 100644 index 0000000..bfbf22d --- /dev/null +++ b/test/controllers/search_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SearchControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 846e74c..8bcd10b 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -18,7 +18,7 @@ class UsersControllerTest < ActionController::TestCase test "should create user" do assert_difference('User.count') do - post :create, user: { } + post :create, user: { groups: @user.groups, name: @user.name, pw_hash: @user.pw_hash } end assert_redirected_to user_path(assigns(:user)) @@ -35,7 +35,7 @@ class UsersControllerTest < ActionController::TestCase end test "should update user" do - patch :update, id: @user, user: { } + patch :update, id: @user, user: { groups: @user.groups, name: @user.name, pw_hash: @user.pw_hash } assert_redirected_to user_path(assigns(:user)) end diff --git a/test/fixtures/alerts.yml b/test/fixtures/alerts.yml new file mode 100644 index 0000000..92ee1b0 --- /dev/null +++ b/test/fixtures/alerts.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + author: + message: MyText + +two: + author: + message: MyText diff --git a/test/fixtures/matches.yml b/test/fixtures/matches.yml index 937a0c0..48c08a5 100644 --- a/test/fixtures/matches.yml +++ b/test/fixtures/matches.yml @@ -1,11 +1,7 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -# This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below -# -one: {} -# column: value -# -two: {} -# column: value +one: + tournament: + +two: + tournament: diff --git a/test/fixtures/pms.yml b/test/fixtures/pms.yml new file mode 100644 index 0000000..4ad9af3 --- /dev/null +++ b/test/fixtures/pms.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + author: + recipient: + message: MyText + +two: + author: + recipient: + message: MyText diff --git a/test/fixtures/server_settings.yml b/test/fixtures/server_settings.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/server_settings.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/team_match_pairs.yml b/test/fixtures/team_match_pairs.yml new file mode 100644 index 0000000..1a81ab4 --- /dev/null +++ b/test/fixtures/team_match_pairs.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + team: + match: + +two: + team: + match: diff --git a/test/fixtures/user_team_pairs.yml b/test/fixtures/user_team_pairs.yml new file mode 100644 index 0000000..bda8bd3 --- /dev/null +++ b/test/fixtures/user_team_pairs.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + user: + team: + +two: + user: + team: diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 937a0c0..02ffdbb 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -1,11 +1,11 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -# This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below -# -one: {} -# column: value -# -two: {} -# column: value +one: + name: MyText + pw_hash: + groups: + +two: + name: MyText + pw_hash: + groups: diff --git a/test/helpers/alerts_helper_test.rb b/test/helpers/alerts_helper_test.rb new file mode 100644 index 0000000..1d9079d --- /dev/null +++ b/test/helpers/alerts_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class AlertsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/main_helper_test.rb b/test/helpers/main_helper_test.rb new file mode 100644 index 0000000..22da3c4 --- /dev/null +++ b/test/helpers/main_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class MainHelperTest < ActionView::TestCase +end diff --git a/test/helpers/pms_helper_test.rb b/test/helpers/pms_helper_test.rb new file mode 100644 index 0000000..af80f10 --- /dev/null +++ b/test/helpers/pms_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class PmsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/search_helper_test.rb b/test/helpers/search_helper_test.rb new file mode 100644 index 0000000..3034163 --- /dev/null +++ b/test/helpers/search_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SearchHelperTest < ActionView::TestCase +end diff --git a/test/models/alert_test.rb b/test/models/alert_test.rb new file mode 100644 index 0000000..b59c65e --- /dev/null +++ b/test/models/alert_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class AlertTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/pm_test.rb b/test/models/pm_test.rb new file mode 100644 index 0000000..e7f6b8f --- /dev/null +++ b/test/models/pm_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PmTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/server_settings_test.rb b/test/models/server_settings_test.rb new file mode 100644 index 0000000..470b316 --- /dev/null +++ b/test/models/server_settings_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ServerSettingsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/team_match_pair_test.rb b/test/models/team_match_pair_test.rb new file mode 100644 index 0000000..c250b3c --- /dev/null +++ b/test/models/team_match_pair_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TeamMatchPairTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_team_pair_test.rb b/test/models/user_team_pair_test.rb new file mode 100644 index 0000000..55f5c58 --- /dev/null +++ b/test/models/user_team_pair_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTeamPairTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end -- cgit v1.2.3-54-g00ecf From cd1fabe40ca4d290df33a2590f3a1f2072103972 Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Thu, 20 Feb 2014 17:13:51 -0500 Subject: fix datatype names in generate.sh --- app/controllers/alerts_controller.rb | 2 +- app/controllers/matches_controller.rb | 2 +- app/controllers/pms_controller.rb | 2 +- app/models/alert.rb | 1 + app/models/match.rb | 1 + app/models/pm.rb | 2 + app/models/team_match_pair.rb | 2 + app/models/user_team_pair.rb | 2 + app/views/alerts/_form.html.erb | 4 +- app/views/alerts/index.json.jbuilder | 2 +- app/views/alerts/show.json.jbuilder | 2 +- app/views/matches/_form.html.erb | 4 +- app/views/matches/index.json.jbuilder | 2 +- app/views/matches/show.json.jbuilder | 2 +- app/views/pms/_form.html.erb | 8 +- app/views/pms/index.json.jbuilder | 2 +- app/views/pms/show.json.jbuilder | 2 +- app/views/users/_form.html.erb | 4 +- db/migrate/20140304014808_create_servers.rb | 8 -- db/migrate/20140304014810_create_tournaments.rb | 8 -- db/migrate/20140304014812_create_matches.rb | 9 --- db/migrate/20140304014814_create_teams.rb | 8 -- db/migrate/20140304014816_create_users.rb | 11 --- .../20140304014819_create_user_team_pairs.rb | 10 --- .../20140304014821_create_team_match_pairs.rb | 10 --- db/migrate/20140304014823_create_alerts.rb | 10 --- db/migrate/20140304014825_create_pms.rb | 11 --- .../20140304014827_create_server_settings.rb | 8 -- db/migrate/20140304014838_create_servers.rb | 8 ++ db/migrate/20140304014840_create_tournaments.rb | 8 ++ db/migrate/20140304014842_create_matches.rb | 9 +++ db/migrate/20140304014844_create_teams.rb | 8 ++ db/migrate/20140304014846_create_users.rb | 11 +++ .../20140304014848_create_user_team_pairs.rb | 10 +++ .../20140304014850_create_team_match_pairs.rb | 10 +++ db/migrate/20140304014852_create_alerts.rb | 10 +++ db/migrate/20140304014855_create_pms.rb | 11 +++ .../20140304014857_create_server_settings.rb | 8 ++ db/schema.rb | 92 ++++++++++++++++++++++ generate.sh | 12 +-- test/controllers/alerts_controller_test.rb | 4 +- test/controllers/matches_controller_test.rb | 4 +- test/controllers/pms_controller_test.rb | 4 +- test/fixtures/alerts.yml | 4 +- test/fixtures/matches.yml | 4 +- test/fixtures/pms.yml | 8 +- test/fixtures/team_match_pairs.yml | 8 +- test/fixtures/user_team_pairs.yml | 8 +- test/fixtures/users.yml | 8 +- 49 files changed, 244 insertions(+), 144 deletions(-) delete mode 100644 db/migrate/20140304014808_create_servers.rb delete mode 100644 db/migrate/20140304014810_create_tournaments.rb delete mode 100644 db/migrate/20140304014812_create_matches.rb delete mode 100644 db/migrate/20140304014814_create_teams.rb delete mode 100644 db/migrate/20140304014816_create_users.rb delete mode 100644 db/migrate/20140304014819_create_user_team_pairs.rb delete mode 100644 db/migrate/20140304014821_create_team_match_pairs.rb delete mode 100644 db/migrate/20140304014823_create_alerts.rb delete mode 100644 db/migrate/20140304014825_create_pms.rb delete mode 100644 db/migrate/20140304014827_create_server_settings.rb create mode 100644 db/migrate/20140304014838_create_servers.rb create mode 100644 db/migrate/20140304014840_create_tournaments.rb create mode 100644 db/migrate/20140304014842_create_matches.rb create mode 100644 db/migrate/20140304014844_create_teams.rb create mode 100644 db/migrate/20140304014846_create_users.rb create mode 100644 db/migrate/20140304014848_create_user_team_pairs.rb create mode 100644 db/migrate/20140304014850_create_team_match_pairs.rb create mode 100644 db/migrate/20140304014852_create_alerts.rb create mode 100644 db/migrate/20140304014855_create_pms.rb create mode 100644 db/migrate/20140304014857_create_server_settings.rb create mode 100644 db/schema.rb (limited to 'app/views') diff --git a/app/controllers/alerts_controller.rb b/app/controllers/alerts_controller.rb index e6158f4..873e9b7 100644 --- a/app/controllers/alerts_controller.rb +++ b/app/controllers/alerts_controller.rb @@ -69,6 +69,6 @@ class AlertsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def alert_params - params.require(:alert).permit(:author, :message) + params.require(:alert).permit(:author_id, :message) end end diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index bb2a67a..e9f3c5a 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -69,6 +69,6 @@ class MatchesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def match_params - params.require(:match).permit(:tournament) + params.require(:match).permit(:tournament_id) end end diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb index 6eb94f9..5dd0d69 100644 --- a/app/controllers/pms_controller.rb +++ b/app/controllers/pms_controller.rb @@ -69,6 +69,6 @@ class PmsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def pm_params - params.require(:pm).permit(:author, :recipient, :message) + params.require(:pm).permit(:author_id, :recipient_id, :message) end end diff --git a/app/models/alert.rb b/app/models/alert.rb index e61a702..343c269 100644 --- a/app/models/alert.rb +++ b/app/models/alert.rb @@ -1,2 +1,3 @@ class Alert < ActiveRecord::Base + belongs_to :author end diff --git a/app/models/match.rb b/app/models/match.rb index 0836114..533435a 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -1,2 +1,3 @@ class Match < ActiveRecord::Base + belongs_to :tournament end diff --git a/app/models/pm.rb b/app/models/pm.rb index 24d6eb4..ab5af3b 100644 --- a/app/models/pm.rb +++ b/app/models/pm.rb @@ -1,2 +1,4 @@ class Pm < ActiveRecord::Base + belongs_to :author + belongs_to :recipient end diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb index 24a4e86..85f8eaa 100644 --- a/app/models/team_match_pair.rb +++ b/app/models/team_match_pair.rb @@ -1,2 +1,4 @@ class TeamMatchPair < ActiveRecord::Base + belongs_to :team + belongs_to :match end diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb index 7694996..c55dc2e 100644 --- a/app/models/user_team_pair.rb +++ b/app/models/user_team_pair.rb @@ -1,2 +1,4 @@ class UserTeamPair < ActiveRecord::Base + belongs_to :user + belongs_to :team end diff --git a/app/views/alerts/_form.html.erb b/app/views/alerts/_form.html.erb index f0da996..b60eaf2 100644 --- a/app/views/alerts/_form.html.erb +++ b/app/views/alerts/_form.html.erb @@ -12,8 +12,8 @@ <% end %>
- <%= f.label :author %>
- <%= f.text_field :author %> + <%= f.label :author_id %>
+ <%= f.text_field :author_id %>
<%= f.label :message %>
diff --git a/app/views/alerts/index.json.jbuilder b/app/views/alerts/index.json.jbuilder index 685157e..0911a5c 100644 --- a/app/views/alerts/index.json.jbuilder +++ b/app/views/alerts/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@alerts) do |alert| - json.extract! alert, :id, :author, :message + json.extract! alert, :id, :author_id, :message json.url alert_url(alert, format: :json) end diff --git a/app/views/alerts/show.json.jbuilder b/app/views/alerts/show.json.jbuilder index 83fe24a..95481eb 100644 --- a/app/views/alerts/show.json.jbuilder +++ b/app/views/alerts/show.json.jbuilder @@ -1 +1 @@ -json.extract! @alert, :id, :author, :message, :created_at, :updated_at +json.extract! @alert, :id, :author_id, :message, :created_at, :updated_at diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index 7d0a371..34494c3 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -12,8 +12,8 @@ <% end %>
- <%= f.label :tournament %>
- <%= f.text_field :tournament %> + <%= f.label :tournament_id %>
+ <%= f.text_field :tournament_id %>
<%= f.submit %> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder index 0839c83..c8ada7a 100644 --- a/app/views/matches/index.json.jbuilder +++ b/app/views/matches/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@matches) do |match| - json.extract! match, :id, :tournament + json.extract! match, :id, :tournament_id json.url match_url(match, format: :json) end diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder index a381f65..2e45395 100644 --- a/app/views/matches/show.json.jbuilder +++ b/app/views/matches/show.json.jbuilder @@ -1 +1 @@ -json.extract! @match, :id, :tournament, :created_at, :updated_at +json.extract! @match, :id, :tournament_id, :created_at, :updated_at diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb index bbc6aee..480e308 100644 --- a/app/views/pms/_form.html.erb +++ b/app/views/pms/_form.html.erb @@ -12,12 +12,12 @@ <% end %>
- <%= f.label :author %>
- <%= f.text_field :author %> + <%= f.label :author_id %>
+ <%= f.text_field :author_id %>
- <%= f.label :recipient %>
- <%= f.text_field :recipient %> + <%= f.label :recipient_id %>
+ <%= f.text_field :recipient_id %>
<%= f.label :message %>
diff --git a/app/views/pms/index.json.jbuilder b/app/views/pms/index.json.jbuilder index aebdc08..fcfca84 100644 --- a/app/views/pms/index.json.jbuilder +++ b/app/views/pms/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@pms) do |pm| - json.extract! pm, :id, :author, :recipient, :message + json.extract! pm, :id, :author_id, :recipient_id, :message json.url pm_url(pm, format: :json) end diff --git a/app/views/pms/show.json.jbuilder b/app/views/pms/show.json.jbuilder index 651e78f..94252e9 100644 --- a/app/views/pms/show.json.jbuilder +++ b/app/views/pms/show.json.jbuilder @@ -1 +1 @@ -json.extract! @pm, :id, :author, :recipient, :message, :created_at, :updated_at +json.extract! @pm, :id, :author_id, :recipient_id, :message, :created_at, :updated_at diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index a7ead1b..2d1ad24 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -17,11 +17,11 @@
<%= f.label :pw_hash %>
- <%= f.text_field :pw_hash %> + <%= f.text_area :pw_hash %>
<%= f.label :groups %>
- <%= f.text_field :groups %> + <%= f.number_field :groups %>
<%= f.submit %> diff --git a/db/migrate/20140304014808_create_servers.rb b/db/migrate/20140304014808_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304014808_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014810_create_tournaments.rb b/db/migrate/20140304014810_create_tournaments.rb deleted file mode 100644 index 2095590..0000000 --- a/db/migrate/20140304014810_create_tournaments.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014812_create_matches.rb b/db/migrate/20140304014812_create_matches.rb deleted file mode 100644 index 288ce6a..0000000 --- a/db/migrate/20140304014812_create_matches.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.reference :tournament - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014814_create_teams.rb b/db/migrate/20140304014814_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304014814_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014816_create_users.rb b/db/migrate/20140304014816_create_users.rb deleted file mode 100644 index 3723908..0000000 --- a/db/migrate/20140304014816_create_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.text :name - t.varchar :pw_hash - t.int :groups - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014819_create_user_team_pairs.rb b/db/migrate/20140304014819_create_user_team_pairs.rb deleted file mode 100644 index 3b60212..0000000 --- a/db/migrate/20140304014819_create_user_team_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUserTeamPairs < ActiveRecord::Migration - def change - create_table :user_team_pairs do |t| - t.reference :user - t.reference :team - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014821_create_team_match_pairs.rb b/db/migrate/20140304014821_create_team_match_pairs.rb deleted file mode 100644 index c489495..0000000 --- a/db/migrate/20140304014821_create_team_match_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTeamMatchPairs < ActiveRecord::Migration - def change - create_table :team_match_pairs do |t| - t.reference :team - t.reference :match - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014823_create_alerts.rb b/db/migrate/20140304014823_create_alerts.rb deleted file mode 100644 index 6167f33..0000000 --- a/db/migrate/20140304014823_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.reference :author - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014825_create_pms.rb b/db/migrate/20140304014825_create_pms.rb deleted file mode 100644 index f3b27fb..0000000 --- a/db/migrate/20140304014825_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.reference :author - t.reference :recipient - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014827_create_server_settings.rb b/db/migrate/20140304014827_create_server_settings.rb deleted file mode 100644 index dfdd91b..0000000 --- a/db/migrate/20140304014827_create_server_settings.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServerSettings < ActiveRecord::Migration - def change - create_table :server_settings do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014838_create_servers.rb b/db/migrate/20140304014838_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304014838_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014840_create_tournaments.rb b/db/migrate/20140304014840_create_tournaments.rb new file mode 100644 index 0000000..2095590 --- /dev/null +++ b/db/migrate/20140304014840_create_tournaments.rb @@ -0,0 +1,8 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014842_create_matches.rb b/db/migrate/20140304014842_create_matches.rb new file mode 100644 index 0000000..6c0c157 --- /dev/null +++ b/db/migrate/20140304014842_create_matches.rb @@ -0,0 +1,9 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014844_create_teams.rb b/db/migrate/20140304014844_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304014844_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014846_create_users.rb b/db/migrate/20140304014846_create_users.rb new file mode 100644 index 0000000..6a500e5 --- /dev/null +++ b/db/migrate/20140304014846_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.text :name + t.text :pw_hash + t.integer :groups + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014848_create_user_team_pairs.rb b/db/migrate/20140304014848_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304014848_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014850_create_team_match_pairs.rb b/db/migrate/20140304014850_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304014850_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014852_create_alerts.rb b/db/migrate/20140304014852_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304014852_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014855_create_pms.rb b/db/migrate/20140304014855_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304014855_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304014857_create_server_settings.rb b/db/migrate/20140304014857_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304014857_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..88dfa1a --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,92 @@ +# encoding: UTF-8 +# 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 that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20140304014857) do + + create_table "alerts", force: true do |t| + t.integer "author_id" + t.text "message" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "alerts", ["author_id"], name: "index_alerts_on_author_id" + + create_table "matches", force: true do |t| + t.integer "tournament_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "matches", ["tournament_id"], name: "index_matches_on_tournament_id" + + create_table "pms", force: true do |t| + t.integer "author_id" + t.integer "recipient_id" + t.text "message" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "pms", ["author_id"], name: "index_pms_on_author_id" + add_index "pms", ["recipient_id"], name: "index_pms_on_recipient_id" + + create_table "server_settings", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "servers", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "team_match_pairs", force: true do |t| + t.integer "team_id" + t.integer "match_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "team_match_pairs", ["match_id"], name: "index_team_match_pairs_on_match_id" + add_index "team_match_pairs", ["team_id"], name: "index_team_match_pairs_on_team_id" + + create_table "teams", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "tournaments", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "user_team_pairs", force: true do |t| + t.integer "user_id" + t.integer "team_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "user_team_pairs", ["team_id"], name: "index_user_team_pairs_on_team_id" + add_index "user_team_pairs", ["user_id"], name: "index_user_team_pairs_on_user_id" + + create_table "users", force: true do |t| + t.text "name" + t.text "pw_hash" + t.integer "groups" + t.datetime "created_at" + t.datetime "updated_at" + end + +end diff --git a/generate.sh b/generate.sh index 28d1936..666869c 100755 --- a/generate.sh +++ b/generate.sh @@ -10,13 +10,13 @@ set -x bundle exec rails generate scaffold server bundle exec rails generate scaffold tournament -bundle exec rails generate scaffold match tournament:reference +bundle exec rails generate scaffold match tournament:references bundle exec rails generate scaffold team -bundle exec rails generate scaffold user name:text pw_hash:varchar groups:int -bundle exec rails generate model user_team_pair user:reference team:reference -bundle exec rails generate model team_match_pair team:reference match:reference -bundle exec rails generate scaffold alert author:reference message:text -bundle exec rails generate scaffold pm author:reference recipient:reference message:text +bundle exec rails generate scaffold user name:text pw_hash:text groups:integer +bundle exec rails generate model user_team_pair user:references team:references +bundle exec rails generate model team_match_pair team:references match:references +bundle exec rails generate scaffold alert author:references message:text +bundle exec rails generate scaffold pm author:references recipient:references message:text bundle exec rails generate model server_settings bundle exec rails generate controller search bundle exec rails generate controller main diff --git a/test/controllers/alerts_controller_test.rb b/test/controllers/alerts_controller_test.rb index 29e58e9..4a5d911 100644 --- a/test/controllers/alerts_controller_test.rb +++ b/test/controllers/alerts_controller_test.rb @@ -18,7 +18,7 @@ class AlertsControllerTest < ActionController::TestCase test "should create alert" do assert_difference('Alert.count') do - post :create, alert: { author: @alert.author, message: @alert.message } + post :create, alert: { author_id: @alert.author_id, message: @alert.message } end assert_redirected_to alert_path(assigns(:alert)) @@ -35,7 +35,7 @@ class AlertsControllerTest < ActionController::TestCase end test "should update alert" do - patch :update, id: @alert, alert: { author: @alert.author, message: @alert.message } + patch :update, id: @alert, alert: { author_id: @alert.author_id, message: @alert.message } assert_redirected_to alert_path(assigns(:alert)) end diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb index 629622b..75c9dcf 100644 --- a/test/controllers/matches_controller_test.rb +++ b/test/controllers/matches_controller_test.rb @@ -18,7 +18,7 @@ class MatchesControllerTest < ActionController::TestCase test "should create match" do assert_difference('Match.count') do - post :create, match: { tournament: @match.tournament } + post :create, match: { tournament_id: @match.tournament_id } end assert_redirected_to match_path(assigns(:match)) @@ -35,7 +35,7 @@ class MatchesControllerTest < ActionController::TestCase end test "should update match" do - patch :update, id: @match, match: { tournament: @match.tournament } + patch :update, id: @match, match: { tournament_id: @match.tournament_id } assert_redirected_to match_path(assigns(:match)) end diff --git a/test/controllers/pms_controller_test.rb b/test/controllers/pms_controller_test.rb index ccbe7b1..18b2449 100644 --- a/test/controllers/pms_controller_test.rb +++ b/test/controllers/pms_controller_test.rb @@ -18,7 +18,7 @@ class PmsControllerTest < ActionController::TestCase test "should create pm" do assert_difference('Pm.count') do - post :create, pm: { author: @pm.author, message: @pm.message, recipient: @pm.recipient } + post :create, pm: { author_id: @pm.author_id, message: @pm.message, recipient_id: @pm.recipient_id } end assert_redirected_to pm_path(assigns(:pm)) @@ -35,7 +35,7 @@ class PmsControllerTest < ActionController::TestCase end test "should update pm" do - patch :update, id: @pm, pm: { author: @pm.author, message: @pm.message, recipient: @pm.recipient } + patch :update, id: @pm, pm: { author_id: @pm.author_id, message: @pm.message, recipient_id: @pm.recipient_id } assert_redirected_to pm_path(assigns(:pm)) end diff --git a/test/fixtures/alerts.yml b/test/fixtures/alerts.yml index 92ee1b0..52959af 100644 --- a/test/fixtures/alerts.yml +++ b/test/fixtures/alerts.yml @@ -1,9 +1,9 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - author: + author_id: message: MyText two: - author: + author_id: message: MyText diff --git a/test/fixtures/matches.yml b/test/fixtures/matches.yml index 48c08a5..0356cee 100644 --- a/test/fixtures/matches.yml +++ b/test/fixtures/matches.yml @@ -1,7 +1,7 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - tournament: + tournament_id: two: - tournament: + tournament_id: diff --git a/test/fixtures/pms.yml b/test/fixtures/pms.yml index 4ad9af3..f77e727 100644 --- a/test/fixtures/pms.yml +++ b/test/fixtures/pms.yml @@ -1,11 +1,11 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - author: - recipient: + author_id: + recipient_id: message: MyText two: - author: - recipient: + author_id: + recipient_id: message: MyText diff --git a/test/fixtures/team_match_pairs.yml b/test/fixtures/team_match_pairs.yml index 1a81ab4..5f9cf2f 100644 --- a/test/fixtures/team_match_pairs.yml +++ b/test/fixtures/team_match_pairs.yml @@ -1,9 +1,9 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - team: - match: + team_id: + match_id: two: - team: - match: + team_id: + match_id: diff --git a/test/fixtures/user_team_pairs.yml b/test/fixtures/user_team_pairs.yml index bda8bd3..a76036f 100644 --- a/test/fixtures/user_team_pairs.yml +++ b/test/fixtures/user_team_pairs.yml @@ -1,9 +1,9 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - user: - team: + user_id: + team_id: two: - user: - team: + user_id: + team_id: diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 02ffdbb..9f593bc 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -2,10 +2,10 @@ one: name: MyText - pw_hash: - groups: + pw_hash: MyText + groups: 1 two: name: MyText - pw_hash: - groups: + pw_hash: MyText + groups: 1 -- cgit v1.2.3-54-g00ecf From 3a7b14f4a51c0fdb8b71720f361a0a8ccf080325 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 27 Feb 2014 16:59:04 -0500 Subject: add game types --- app/assets/javascripts/games.js.coffee | 3 + app/assets/stylesheets/games.css.scss | 3 + app/controllers/games_controller.rb | 74 ++++++++++++++++++++++ app/helpers/games_helper.rb | 2 + app/models/game.rb | 2 + app/models/game_attribute.rb | 3 + app/views/games/_form.html.erb | 21 ++++++ app/views/games/edit.html.erb | 6 ++ app/views/games/index.html.erb | 27 ++++++++ app/views/games/index.json.jbuilder | 4 ++ app/views/games/new.html.erb | 5 ++ app/views/games/show.html.erb | 9 +++ app/views/games/show.json.jbuilder | 1 + config/routes.rb | 2 + db/migrate/20140304014940_create_servers.rb | 8 --- db/migrate/20140304014942_create_tournaments.rb | 8 --- db/migrate/20140304014944_create_matches.rb | 9 --- db/migrate/20140304014946_create_teams.rb | 8 --- db/migrate/20140304014948_create_users.rb | 11 ---- .../20140304014950_create_user_team_pairs.rb | 10 --- .../20140304014952_create_team_match_pairs.rb | 10 --- db/migrate/20140304014954_create_alerts.rb | 10 --- db/migrate/20140304014957_create_pms.rb | 11 ---- .../20140304014959_create_server_settings.rb | 8 --- .../20140304015005_create_tournament_options.rb | 8 --- db/migrate/20140304015013_create_servers.rb | 8 +++ db/migrate/20140304015015_create_tournaments.rb | 8 +++ db/migrate/20140304015017_create_matches.rb | 9 +++ db/migrate/20140304015019_create_teams.rb | 8 +++ db/migrate/20140304015021_create_users.rb | 11 ++++ .../20140304015023_create_user_team_pairs.rb | 10 +++ .../20140304015026_create_team_match_pairs.rb | 10 +++ db/migrate/20140304015028_create_alerts.rb | 10 +++ db/migrate/20140304015030_create_pms.rb | 11 ++++ db/migrate/20140304015032_create_games.rb | 9 +++ .../20140304015034_create_game_attributes.rb | 11 ++++ .../20140304015036_create_server_settings.rb | 8 +++ .../20140304015042_create_tournament_options.rb | 8 +++ db/schema.rb | 18 +++++- generate.sh | 4 +- test/controllers/games_controller_test.rb | 49 ++++++++++++++ test/fixtures/game_attributes.yml | 11 ++++ test/fixtures/games.yml | 7 ++ test/helpers/games_helper_test.rb | 4 ++ test/models/game_attribute_test.rb | 7 ++ test/models/game_test.rb | 7 ++ 46 files changed, 388 insertions(+), 103 deletions(-) create mode 100644 app/assets/javascripts/games.js.coffee create mode 100644 app/assets/stylesheets/games.css.scss create mode 100644 app/controllers/games_controller.rb create mode 100644 app/helpers/games_helper.rb create mode 100644 app/models/game.rb create mode 100644 app/models/game_attribute.rb create mode 100644 app/views/games/_form.html.erb create mode 100644 app/views/games/edit.html.erb create mode 100644 app/views/games/index.html.erb create mode 100644 app/views/games/index.json.jbuilder create mode 100644 app/views/games/new.html.erb create mode 100644 app/views/games/show.html.erb create mode 100644 app/views/games/show.json.jbuilder delete mode 100644 db/migrate/20140304014940_create_servers.rb delete mode 100644 db/migrate/20140304014942_create_tournaments.rb delete mode 100644 db/migrate/20140304014944_create_matches.rb delete mode 100644 db/migrate/20140304014946_create_teams.rb delete mode 100644 db/migrate/20140304014948_create_users.rb delete mode 100644 db/migrate/20140304014950_create_user_team_pairs.rb delete mode 100644 db/migrate/20140304014952_create_team_match_pairs.rb delete mode 100644 db/migrate/20140304014954_create_alerts.rb delete mode 100644 db/migrate/20140304014957_create_pms.rb delete mode 100644 db/migrate/20140304014959_create_server_settings.rb delete mode 100644 db/migrate/20140304015005_create_tournament_options.rb create mode 100644 db/migrate/20140304015013_create_servers.rb create mode 100644 db/migrate/20140304015015_create_tournaments.rb create mode 100644 db/migrate/20140304015017_create_matches.rb create mode 100644 db/migrate/20140304015019_create_teams.rb create mode 100644 db/migrate/20140304015021_create_users.rb create mode 100644 db/migrate/20140304015023_create_user_team_pairs.rb create mode 100644 db/migrate/20140304015026_create_team_match_pairs.rb create mode 100644 db/migrate/20140304015028_create_alerts.rb create mode 100644 db/migrate/20140304015030_create_pms.rb create mode 100644 db/migrate/20140304015032_create_games.rb create mode 100644 db/migrate/20140304015034_create_game_attributes.rb create mode 100644 db/migrate/20140304015036_create_server_settings.rb create mode 100644 db/migrate/20140304015042_create_tournament_options.rb create mode 100644 test/controllers/games_controller_test.rb create mode 100644 test/fixtures/game_attributes.yml create mode 100644 test/fixtures/games.yml create mode 100644 test/helpers/games_helper_test.rb create mode 100644 test/models/game_attribute_test.rb create mode 100644 test/models/game_test.rb (limited to 'app/views') diff --git a/app/assets/javascripts/games.js.coffee b/app/assets/javascripts/games.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/games.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/games.css.scss b/app/assets/stylesheets/games.css.scss new file mode 100644 index 0000000..db1b7bc --- /dev/null +++ b/app/assets/stylesheets/games.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the games controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb new file mode 100644 index 0000000..0a9d8e8 --- /dev/null +++ b/app/controllers/games_controller.rb @@ -0,0 +1,74 @@ +class GamesController < ApplicationController + before_action :set_game, only: [:show, :edit, :update, :destroy] + + # GET /games + # GET /games.json + def index + @games = Game.all + end + + # GET /games/1 + # GET /games/1.json + def show + end + + # GET /games/new + def new + @game = Game.new + end + + # GET /games/1/edit + def edit + end + + # POST /games + # POST /games.json + def create + @game = Game.new(game_params) + + respond_to do |format| + if @game.save + format.html { redirect_to @game, notice: 'Game was successfully created.' } + format.json { render action: 'show', status: :created, location: @game } + else + format.html { render action: 'new' } + format.json { render json: @game.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /games/1 + # PATCH/PUT /games/1.json + def update + respond_to do |format| + if @game.update(game_params) + format.html { redirect_to @game, notice: 'Game was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @game.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /games/1 + # DELETE /games/1.json + def destroy + @game.destroy + respond_to do |format| + format.html { redirect_to games_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_game + @game = Game.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def game_params + params.require(:game).permit(:name) + end +end diff --git a/app/helpers/games_helper.rb b/app/helpers/games_helper.rb new file mode 100644 index 0000000..2ef8c1f --- /dev/null +++ b/app/helpers/games_helper.rb @@ -0,0 +1,2 @@ +module GamesHelper +end diff --git a/app/models/game.rb b/app/models/game.rb new file mode 100644 index 0000000..a181c26 --- /dev/null +++ b/app/models/game.rb @@ -0,0 +1,2 @@ +class Game < ActiveRecord::Base +end diff --git a/app/models/game_attribute.rb b/app/models/game_attribute.rb new file mode 100644 index 0000000..c12723b --- /dev/null +++ b/app/models/game_attribute.rb @@ -0,0 +1,3 @@ +class GameAttribute < ActiveRecord::Base + belongs_to :game +end diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb new file mode 100644 index 0000000..0bbdd1f --- /dev/null +++ b/app/views/games/_form.html.erb @@ -0,0 +1,21 @@ +<%= form_for(@game) do |f| %> + <% if @game.errors.any? %> +
+

<%= pluralize(@game.errors.count, "error") %> prohibited this game from being saved:

+ +
    + <% @game.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_area :name %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/games/edit.html.erb b/app/views/games/edit.html.erb new file mode 100644 index 0000000..d72bd2e --- /dev/null +++ b/app/views/games/edit.html.erb @@ -0,0 +1,6 @@ +

Editing game

+ +<%= render 'form' %> + +<%= link_to 'Show', @game %> | +<%= link_to 'Back', games_path %> diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb new file mode 100644 index 0000000..27d47b6 --- /dev/null +++ b/app/views/games/index.html.erb @@ -0,0 +1,27 @@ +

Listing games

+ +
NamePw hashGroups
<%= user.name %><%= user.pw_hash %><%= user.groups %> <%= link_to 'Show', user %> <%= link_to 'Edit', edit_user_path(user) %> <%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
+ + + + + + + + + + + <% @games.each do |game| %> + + + + + + + <% end %> + +
Name
<%= game.name %><%= link_to 'Show', game %><%= link_to 'Edit', edit_game_path(game) %><%= link_to 'Destroy', game, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Game', new_game_path %> diff --git a/app/views/games/index.json.jbuilder b/app/views/games/index.json.jbuilder new file mode 100644 index 0000000..90f4236 --- /dev/null +++ b/app/views/games/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@games) do |game| + json.extract! game, :id, :name + json.url game_url(game, format: :json) +end diff --git a/app/views/games/new.html.erb b/app/views/games/new.html.erb new file mode 100644 index 0000000..ab95f70 --- /dev/null +++ b/app/views/games/new.html.erb @@ -0,0 +1,5 @@ +

New game

+ +<%= render 'form' %> + +<%= link_to 'Back', games_path %> diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb new file mode 100644 index 0000000..20d374f --- /dev/null +++ b/app/views/games/show.html.erb @@ -0,0 +1,9 @@ +

<%= notice %>

+ +

+ Name: + <%= @game.name %> +

+ +<%= link_to 'Edit', edit_game_path(@game) %> | +<%= link_to 'Back', games_path %> diff --git a/app/views/games/show.json.jbuilder b/app/views/games/show.json.jbuilder new file mode 100644 index 0000000..a4d8d1c --- /dev/null +++ b/app/views/games/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @game, :id, :name, :created_at, :updated_at diff --git a/config/routes.rb b/config/routes.rb index f13c891..3412005 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ Leaguer::Application.routes.draw do + resources :games + resources :pms resources :alerts diff --git a/db/migrate/20140304014940_create_servers.rb b/db/migrate/20140304014940_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304014940_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014942_create_tournaments.rb b/db/migrate/20140304014942_create_tournaments.rb deleted file mode 100644 index 2095590..0000000 --- a/db/migrate/20140304014942_create_tournaments.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014944_create_matches.rb b/db/migrate/20140304014944_create_matches.rb deleted file mode 100644 index 6c0c157..0000000 --- a/db/migrate/20140304014944_create_matches.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.references :tournament, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014946_create_teams.rb b/db/migrate/20140304014946_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304014946_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014948_create_users.rb b/db/migrate/20140304014948_create_users.rb deleted file mode 100644 index 6a500e5..0000000 --- a/db/migrate/20140304014948_create_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.text :name - t.text :pw_hash - t.integer :groups - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014950_create_user_team_pairs.rb b/db/migrate/20140304014950_create_user_team_pairs.rb deleted file mode 100644 index 2c492ac..0000000 --- a/db/migrate/20140304014950_create_user_team_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUserTeamPairs < ActiveRecord::Migration - def change - create_table :user_team_pairs do |t| - t.references :user, index: true - t.references :team, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014952_create_team_match_pairs.rb b/db/migrate/20140304014952_create_team_match_pairs.rb deleted file mode 100644 index 8fac07e..0000000 --- a/db/migrate/20140304014952_create_team_match_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTeamMatchPairs < ActiveRecord::Migration - def change - create_table :team_match_pairs do |t| - t.references :team, index: true - t.references :match, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014954_create_alerts.rb b/db/migrate/20140304014954_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140304014954_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.references :author, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014957_create_pms.rb b/db/migrate/20140304014957_create_pms.rb deleted file mode 100644 index 93bb5c6..0000000 --- a/db/migrate/20140304014957_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.references :author, index: true - t.references :recipient, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304014959_create_server_settings.rb b/db/migrate/20140304014959_create_server_settings.rb deleted file mode 100644 index dfdd91b..0000000 --- a/db/migrate/20140304014959_create_server_settings.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServerSettings < ActiveRecord::Migration - def change - create_table :server_settings do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015005_create_tournament_options.rb b/db/migrate/20140304015005_create_tournament_options.rb deleted file mode 100644 index d2df22e..0000000 --- a/db/migrate/20140304015005_create_tournament_options.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentOptions < ActiveRecord::Migration - def change - create_table :tournament_options do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015013_create_servers.rb b/db/migrate/20140304015013_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304015013_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015015_create_tournaments.rb b/db/migrate/20140304015015_create_tournaments.rb new file mode 100644 index 0000000..2095590 --- /dev/null +++ b/db/migrate/20140304015015_create_tournaments.rb @@ -0,0 +1,8 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015017_create_matches.rb b/db/migrate/20140304015017_create_matches.rb new file mode 100644 index 0000000..6c0c157 --- /dev/null +++ b/db/migrate/20140304015017_create_matches.rb @@ -0,0 +1,9 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015019_create_teams.rb b/db/migrate/20140304015019_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304015019_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015021_create_users.rb b/db/migrate/20140304015021_create_users.rb new file mode 100644 index 0000000..6a500e5 --- /dev/null +++ b/db/migrate/20140304015021_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.text :name + t.text :pw_hash + t.integer :groups + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015023_create_user_team_pairs.rb b/db/migrate/20140304015023_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304015023_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015026_create_team_match_pairs.rb b/db/migrate/20140304015026_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304015026_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015028_create_alerts.rb b/db/migrate/20140304015028_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304015028_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015030_create_pms.rb b/db/migrate/20140304015030_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304015030_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015032_create_games.rb b/db/migrate/20140304015032_create_games.rb new file mode 100644 index 0000000..fc54709 --- /dev/null +++ b/db/migrate/20140304015032_create_games.rb @@ -0,0 +1,9 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.text :name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015034_create_game_attributes.rb b/db/migrate/20140304015034_create_game_attributes.rb new file mode 100644 index 0000000..b63f134 --- /dev/null +++ b/db/migrate/20140304015034_create_game_attributes.rb @@ -0,0 +1,11 @@ +class CreateGameAttributes < ActiveRecord::Migration + def change + create_table :game_attributes do |t| + t.references :game, index: true + t.text :key + t.integer :type + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015036_create_server_settings.rb b/db/migrate/20140304015036_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304015036_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015042_create_tournament_options.rb b/db/migrate/20140304015042_create_tournament_options.rb new file mode 100644 index 0000000..d2df22e --- /dev/null +++ b/db/migrate/20140304015042_create_tournament_options.rb @@ -0,0 +1,8 @@ +class CreateTournamentOptions < ActiveRecord::Migration + def change + create_table :tournament_options do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 9d307ae..86afd1b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140304015005) do +ActiveRecord::Schema.define(version: 20140304015042) do create_table "alerts", force: true do |t| t.integer "author_id" @@ -22,6 +22,22 @@ ActiveRecord::Schema.define(version: 20140304015005) do add_index "alerts", ["author_id"], name: "index_alerts_on_author_id" + create_table "game_attributes", force: true do |t| + t.integer "game_id" + t.text "key" + t.integer "type" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "game_attributes", ["game_id"], name: "index_game_attributes_on_game_id" + + create_table "games", force: true do |t| + t.text "name" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "matches", force: true do |t| t.integer "tournament_id" t.datetime "created_at" diff --git a/generate.sh b/generate.sh index 52d0f90..7dbb444 100755 --- a/generate.sh +++ b/generate.sh @@ -5,7 +5,7 @@ # bundle exec rails server # # To Clear the Generated Files: -# +# git clean -df # set -x @@ -18,6 +18,8 @@ bundle exec rails generate model user_team_pair user:references team:references bundle exec rails generate model team_match_pair team:references match:references bundle exec rails generate scaffold alert author:references message:text bundle exec rails generate scaffold pm author:references recipient:references message:text +bundle exec rails generate scaffold game name:text +bundle exec rails generate model game_attribute game:references key:text type:integer bundle exec rails generate model server_settings bundle exec rails generate controller search bundle exec rails generate controller main diff --git a/test/controllers/games_controller_test.rb b/test/controllers/games_controller_test.rb new file mode 100644 index 0000000..420758e --- /dev/null +++ b/test/controllers/games_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class GamesControllerTest < ActionController::TestCase + setup do + @game = games(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:games) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create game" do + assert_difference('Game.count') do + post :create, game: { name: @game.name } + end + + assert_redirected_to game_path(assigns(:game)) + end + + test "should show game" do + get :show, id: @game + assert_response :success + end + + test "should get edit" do + get :edit, id: @game + assert_response :success + end + + test "should update game" do + patch :update, id: @game, game: { name: @game.name } + assert_redirected_to game_path(assigns(:game)) + end + + test "should destroy game" do + assert_difference('Game.count', -1) do + delete :destroy, id: @game + end + + assert_redirected_to games_path + end +end diff --git a/test/fixtures/game_attributes.yml b/test/fixtures/game_attributes.yml new file mode 100644 index 0000000..eff7212 --- /dev/null +++ b/test/fixtures/game_attributes.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + game_id: + key: MyText + type: 1 + +two: + game_id: + key: MyText + type: 1 diff --git a/test/fixtures/games.yml b/test/fixtures/games.yml new file mode 100644 index 0000000..ce6f466 --- /dev/null +++ b/test/fixtures/games.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyText + +two: + name: MyText diff --git a/test/helpers/games_helper_test.rb b/test/helpers/games_helper_test.rb new file mode 100644 index 0000000..449a85c --- /dev/null +++ b/test/helpers/games_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class GamesHelperTest < ActionView::TestCase +end diff --git a/test/models/game_attribute_test.rb b/test/models/game_attribute_test.rb new file mode 100644 index 0000000..13c6e65 --- /dev/null +++ b/test/models/game_attribute_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GameAttributeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/game_test.rb b/test/models/game_test.rb new file mode 100644 index 0000000..2cab36e --- /dev/null +++ b/test/models/game_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GameTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end -- cgit v1.2.3-54-g00ecf From de40ec53e8b80d8d880214183f19ea93172a0026 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 27 Feb 2014 17:02:10 -0500 Subject: give tournaments a game type --- app/controllers/tournaments_controller.rb | 2 +- app/models/tournament.rb | 1 + app/views/tournaments/_form.html.erb | 4 ++++ app/views/tournaments/index.html.erb | 2 ++ app/views/tournaments/index.json.jbuilder | 2 +- app/views/tournaments/show.html.erb | 5 +++++ app/views/tournaments/show.json.jbuilder | 2 +- db/migrate/20140304015013_create_servers.rb | 8 -------- db/migrate/20140304015015_create_tournaments.rb | 8 -------- db/migrate/20140304015017_create_matches.rb | 9 --------- db/migrate/20140304015019_create_teams.rb | 8 -------- db/migrate/20140304015021_create_users.rb | 11 ----------- db/migrate/20140304015023_create_user_team_pairs.rb | 10 ---------- db/migrate/20140304015026_create_team_match_pairs.rb | 10 ---------- db/migrate/20140304015028_create_alerts.rb | 10 ---------- db/migrate/20140304015030_create_pms.rb | 11 ----------- db/migrate/20140304015032_create_games.rb | 9 --------- db/migrate/20140304015034_create_game_attributes.rb | 11 ----------- db/migrate/20140304015036_create_server_settings.rb | 8 -------- db/migrate/20140304015042_create_tournament_options.rb | 8 -------- db/migrate/20140304015051_create_servers.rb | 8 ++++++++ db/migrate/20140304015053_create_tournaments.rb | 9 +++++++++ db/migrate/20140304015055_create_matches.rb | 9 +++++++++ db/migrate/20140304015057_create_teams.rb | 8 ++++++++ db/migrate/20140304015059_create_users.rb | 11 +++++++++++ db/migrate/20140304015102_create_user_team_pairs.rb | 10 ++++++++++ db/migrate/20140304015104_create_team_match_pairs.rb | 10 ++++++++++ db/migrate/20140304015106_create_alerts.rb | 10 ++++++++++ db/migrate/20140304015108_create_pms.rb | 11 +++++++++++ db/migrate/20140304015110_create_games.rb | 9 +++++++++ db/migrate/20140304015112_create_game_attributes.rb | 11 +++++++++++ db/migrate/20140304015114_create_server_settings.rb | 8 ++++++++ db/migrate/20140304015120_create_tournament_options.rb | 8 ++++++++ db/schema.rb | 5 ++++- generate.sh | 2 +- test/controllers/tournaments_controller_test.rb | 4 ++-- test/fixtures/tournaments.yml | 14 +++++--------- 37 files changed, 149 insertions(+), 137 deletions(-) delete mode 100644 db/migrate/20140304015013_create_servers.rb delete mode 100644 db/migrate/20140304015015_create_tournaments.rb delete mode 100644 db/migrate/20140304015017_create_matches.rb delete mode 100644 db/migrate/20140304015019_create_teams.rb delete mode 100644 db/migrate/20140304015021_create_users.rb delete mode 100644 db/migrate/20140304015023_create_user_team_pairs.rb delete mode 100644 db/migrate/20140304015026_create_team_match_pairs.rb delete mode 100644 db/migrate/20140304015028_create_alerts.rb delete mode 100644 db/migrate/20140304015030_create_pms.rb delete mode 100644 db/migrate/20140304015032_create_games.rb delete mode 100644 db/migrate/20140304015034_create_game_attributes.rb delete mode 100644 db/migrate/20140304015036_create_server_settings.rb delete mode 100644 db/migrate/20140304015042_create_tournament_options.rb create mode 100644 db/migrate/20140304015051_create_servers.rb create mode 100644 db/migrate/20140304015053_create_tournaments.rb create mode 100644 db/migrate/20140304015055_create_matches.rb create mode 100644 db/migrate/20140304015057_create_teams.rb create mode 100644 db/migrate/20140304015059_create_users.rb create mode 100644 db/migrate/20140304015102_create_user_team_pairs.rb create mode 100644 db/migrate/20140304015104_create_team_match_pairs.rb create mode 100644 db/migrate/20140304015106_create_alerts.rb create mode 100644 db/migrate/20140304015108_create_pms.rb create mode 100644 db/migrate/20140304015110_create_games.rb create mode 100644 db/migrate/20140304015112_create_game_attributes.rb create mode 100644 db/migrate/20140304015114_create_server_settings.rb create mode 100644 db/migrate/20140304015120_create_tournament_options.rb (limited to 'app/views') diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index ea3857c..720305f 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -69,6 +69,6 @@ class TournamentsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def tournament_params - params[:tournament] + params.require(:tournament).permit(:game_id) end end diff --git a/app/models/tournament.rb b/app/models/tournament.rb index da3da0e..cc915a0 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -1,2 +1,3 @@ class Tournament < ActiveRecord::Base + belongs_to :game end diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index 8996266..1fd63e9 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -11,6 +11,10 @@ <% end %> +
+ <%= f.label :game_id %>
+ <%= f.text_field :game_id %> +
<%= f.submit %>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb index 7124111..ad2b7cf 100644 --- a/app/views/tournaments/index.html.erb +++ b/app/views/tournaments/index.html.erb @@ -3,6 +3,7 @@ + @@ -12,6 +13,7 @@ <% @tournaments.each do |tournament| %> + diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder index 28d6960..e6f3b49 100644 --- a/app/views/tournaments/index.json.jbuilder +++ b/app/views/tournaments/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@tournaments) do |tournament| - json.extract! tournament, :id + json.extract! tournament, :id, :game_id json.url tournament_url(tournament, format: :json) end diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 2c280ba..30df788 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -1,4 +1,9 @@

<%= notice %>

+

+ Game: + <%= @tournament.game %> +

+ <%= link_to 'Edit', edit_tournament_path(@tournament) %> | <%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder index 211799a..0fe65a6 100644 --- a/app/views/tournaments/show.json.jbuilder +++ b/app/views/tournaments/show.json.jbuilder @@ -1 +1 @@ -json.extract! @tournament, :id, :created_at, :updated_at +json.extract! @tournament, :id, :game_id, :created_at, :updated_at diff --git a/db/migrate/20140304015013_create_servers.rb b/db/migrate/20140304015013_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304015013_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015015_create_tournaments.rb b/db/migrate/20140304015015_create_tournaments.rb deleted file mode 100644 index 2095590..0000000 --- a/db/migrate/20140304015015_create_tournaments.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015017_create_matches.rb b/db/migrate/20140304015017_create_matches.rb deleted file mode 100644 index 6c0c157..0000000 --- a/db/migrate/20140304015017_create_matches.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.references :tournament, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015019_create_teams.rb b/db/migrate/20140304015019_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304015019_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015021_create_users.rb b/db/migrate/20140304015021_create_users.rb deleted file mode 100644 index 6a500e5..0000000 --- a/db/migrate/20140304015021_create_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.text :name - t.text :pw_hash - t.integer :groups - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015023_create_user_team_pairs.rb b/db/migrate/20140304015023_create_user_team_pairs.rb deleted file mode 100644 index 2c492ac..0000000 --- a/db/migrate/20140304015023_create_user_team_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUserTeamPairs < ActiveRecord::Migration - def change - create_table :user_team_pairs do |t| - t.references :user, index: true - t.references :team, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015026_create_team_match_pairs.rb b/db/migrate/20140304015026_create_team_match_pairs.rb deleted file mode 100644 index 8fac07e..0000000 --- a/db/migrate/20140304015026_create_team_match_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTeamMatchPairs < ActiveRecord::Migration - def change - create_table :team_match_pairs do |t| - t.references :team, index: true - t.references :match, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015028_create_alerts.rb b/db/migrate/20140304015028_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140304015028_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.references :author, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015030_create_pms.rb b/db/migrate/20140304015030_create_pms.rb deleted file mode 100644 index 93bb5c6..0000000 --- a/db/migrate/20140304015030_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.references :author, index: true - t.references :recipient, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015032_create_games.rb b/db/migrate/20140304015032_create_games.rb deleted file mode 100644 index fc54709..0000000 --- a/db/migrate/20140304015032_create_games.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateGames < ActiveRecord::Migration - def change - create_table :games do |t| - t.text :name - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015034_create_game_attributes.rb b/db/migrate/20140304015034_create_game_attributes.rb deleted file mode 100644 index b63f134..0000000 --- a/db/migrate/20140304015034_create_game_attributes.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateGameAttributes < ActiveRecord::Migration - def change - create_table :game_attributes do |t| - t.references :game, index: true - t.text :key - t.integer :type - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015036_create_server_settings.rb b/db/migrate/20140304015036_create_server_settings.rb deleted file mode 100644 index dfdd91b..0000000 --- a/db/migrate/20140304015036_create_server_settings.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServerSettings < ActiveRecord::Migration - def change - create_table :server_settings do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015042_create_tournament_options.rb b/db/migrate/20140304015042_create_tournament_options.rb deleted file mode 100644 index d2df22e..0000000 --- a/db/migrate/20140304015042_create_tournament_options.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentOptions < ActiveRecord::Migration - def change - create_table :tournament_options do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015051_create_servers.rb b/db/migrate/20140304015051_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304015051_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015053_create_tournaments.rb b/db/migrate/20140304015053_create_tournaments.rb new file mode 100644 index 0000000..36fcf7e --- /dev/null +++ b/db/migrate/20140304015053_create_tournaments.rb @@ -0,0 +1,9 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + t.references :game, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015055_create_matches.rb b/db/migrate/20140304015055_create_matches.rb new file mode 100644 index 0000000..6c0c157 --- /dev/null +++ b/db/migrate/20140304015055_create_matches.rb @@ -0,0 +1,9 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015057_create_teams.rb b/db/migrate/20140304015057_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304015057_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015059_create_users.rb b/db/migrate/20140304015059_create_users.rb new file mode 100644 index 0000000..6a500e5 --- /dev/null +++ b/db/migrate/20140304015059_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.text :name + t.text :pw_hash + t.integer :groups + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015102_create_user_team_pairs.rb b/db/migrate/20140304015102_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304015102_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015104_create_team_match_pairs.rb b/db/migrate/20140304015104_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304015104_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015106_create_alerts.rb b/db/migrate/20140304015106_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304015106_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015108_create_pms.rb b/db/migrate/20140304015108_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304015108_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015110_create_games.rb b/db/migrate/20140304015110_create_games.rb new file mode 100644 index 0000000..fc54709 --- /dev/null +++ b/db/migrate/20140304015110_create_games.rb @@ -0,0 +1,9 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.text :name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015112_create_game_attributes.rb b/db/migrate/20140304015112_create_game_attributes.rb new file mode 100644 index 0000000..b63f134 --- /dev/null +++ b/db/migrate/20140304015112_create_game_attributes.rb @@ -0,0 +1,11 @@ +class CreateGameAttributes < ActiveRecord::Migration + def change + create_table :game_attributes do |t| + t.references :game, index: true + t.text :key + t.integer :type + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015114_create_server_settings.rb b/db/migrate/20140304015114_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304015114_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015120_create_tournament_options.rb b/db/migrate/20140304015120_create_tournament_options.rb new file mode 100644 index 0000000..d2df22e --- /dev/null +++ b/db/migrate/20140304015120_create_tournament_options.rb @@ -0,0 +1,8 @@ +class CreateTournamentOptions < ActiveRecord::Migration + def change + create_table :tournament_options do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 86afd1b..7681cfc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140304015042) do +ActiveRecord::Schema.define(version: 20140304015120) do create_table "alerts", force: true do |t| t.integer "author_id" @@ -88,10 +88,13 @@ ActiveRecord::Schema.define(version: 20140304015042) do end create_table "tournaments", force: true do |t| + t.integer "game_id" t.datetime "created_at" t.datetime "updated_at" end + add_index "tournaments", ["game_id"], name: "index_tournaments_on_game_id" + create_table "user_team_pairs", force: true do |t| t.integer "user_id" t.integer "team_id" diff --git a/generate.sh b/generate.sh index 7dbb444..b384813 100755 --- a/generate.sh +++ b/generate.sh @@ -10,7 +10,7 @@ set -x bundle exec rails generate scaffold server -bundle exec rails generate scaffold tournament +bundle exec rails generate scaffold tournament game:references bundle exec rails generate scaffold match tournament:references bundle exec rails generate scaffold team bundle exec rails generate scaffold user name:text pw_hash:text groups:integer diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb index 9363bdf..bdbbfac 100644 --- a/test/controllers/tournaments_controller_test.rb +++ b/test/controllers/tournaments_controller_test.rb @@ -18,7 +18,7 @@ class TournamentsControllerTest < ActionController::TestCase test "should create tournament" do assert_difference('Tournament.count') do - post :create, tournament: { } + post :create, tournament: { game_id: @tournament.game_id } end assert_redirected_to tournament_path(assigns(:tournament)) @@ -35,7 +35,7 @@ class TournamentsControllerTest < ActionController::TestCase end test "should update tournament" do - patch :update, id: @tournament, tournament: { } + patch :update, id: @tournament, tournament: { game_id: @tournament.game_id } assert_redirected_to tournament_path(assigns(:tournament)) end diff --git a/test/fixtures/tournaments.yml b/test/fixtures/tournaments.yml index 937a0c0..4cba7ca 100644 --- a/test/fixtures/tournaments.yml +++ b/test/fixtures/tournaments.yml @@ -1,11 +1,7 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -# This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately -# below each fixture, per the syntax in the comments below -# -one: {} -# column: value -# -two: {} -# column: value +one: + game_id: + +two: + game_id: -- cgit v1.2.3-54-g00ecf From f3f17dcd9755020276062caae7c0677eff88cb2f Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Thu, 27 Feb 2014 17:41:59 -0500 Subject: Added the Games Attributes stuff. --- app/controllers/games_controller.rb | 2 +- app/views/games/_form.html.erb | 16 ++++++++++++++++ app/views/games/index.html.erb | 8 ++++++++ app/views/games/index.json.jbuilder | 2 +- app/views/games/show.html.erb | 20 ++++++++++++++++++++ app/views/games/show.json.jbuilder | 2 +- db/migrate/20140304015051_create_servers.rb | 8 -------- db/migrate/20140304015053_create_tournaments.rb | 9 --------- db/migrate/20140304015055_create_matches.rb | 9 --------- db/migrate/20140304015057_create_teams.rb | 8 -------- db/migrate/20140304015059_create_users.rb | 11 ----------- db/migrate/20140304015102_create_user_team_pairs.rb | 10 ---------- db/migrate/20140304015104_create_team_match_pairs.rb | 10 ---------- db/migrate/20140304015106_create_alerts.rb | 10 ---------- db/migrate/20140304015108_create_pms.rb | 11 ----------- db/migrate/20140304015110_create_games.rb | 9 --------- db/migrate/20140304015112_create_game_attributes.rb | 11 ----------- db/migrate/20140304015114_create_server_settings.rb | 8 -------- .../20140304015120_create_tournament_options.rb | 8 -------- db/migrate/20140304015129_create_servers.rb | 8 ++++++++ db/migrate/20140304015131_create_tournaments.rb | 9 +++++++++ db/migrate/20140304015133_create_matches.rb | 9 +++++++++ db/migrate/20140304015135_create_teams.rb | 8 ++++++++ db/migrate/20140304015137_create_users.rb | 11 +++++++++++ db/migrate/20140304015139_create_user_team_pairs.rb | 10 ++++++++++ db/migrate/20140304015141_create_team_match_pairs.rb | 10 ++++++++++ db/migrate/20140304015144_create_alerts.rb | 10 ++++++++++ db/migrate/20140304015146_create_pms.rb | 11 +++++++++++ db/migrate/20140304015148_create_games.rb | 13 +++++++++++++ db/migrate/20140304015150_create_game_attributes.rb | 11 +++++++++++ db/migrate/20140304015152_create_server_settings.rb | 8 ++++++++ .../20140304015158_create_tournament_options.rb | 8 ++++++++ db/schema.rb | 6 +++++- generate.sh | 2 +- test/controllers/games_controller_test.rb | 4 ++-- test/fixtures/games.yml | 8 ++++++++ 36 files changed, 189 insertions(+), 129 deletions(-) delete mode 100644 db/migrate/20140304015051_create_servers.rb delete mode 100644 db/migrate/20140304015053_create_tournaments.rb delete mode 100644 db/migrate/20140304015055_create_matches.rb delete mode 100644 db/migrate/20140304015057_create_teams.rb delete mode 100644 db/migrate/20140304015059_create_users.rb delete mode 100644 db/migrate/20140304015102_create_user_team_pairs.rb delete mode 100644 db/migrate/20140304015104_create_team_match_pairs.rb delete mode 100644 db/migrate/20140304015106_create_alerts.rb delete mode 100644 db/migrate/20140304015108_create_pms.rb delete mode 100644 db/migrate/20140304015110_create_games.rb delete mode 100644 db/migrate/20140304015112_create_game_attributes.rb delete mode 100644 db/migrate/20140304015114_create_server_settings.rb delete mode 100644 db/migrate/20140304015120_create_tournament_options.rb create mode 100644 db/migrate/20140304015129_create_servers.rb create mode 100644 db/migrate/20140304015131_create_tournaments.rb create mode 100644 db/migrate/20140304015133_create_matches.rb create mode 100644 db/migrate/20140304015135_create_teams.rb create mode 100644 db/migrate/20140304015137_create_users.rb create mode 100644 db/migrate/20140304015139_create_user_team_pairs.rb create mode 100644 db/migrate/20140304015141_create_team_match_pairs.rb create mode 100644 db/migrate/20140304015144_create_alerts.rb create mode 100644 db/migrate/20140304015146_create_pms.rb create mode 100644 db/migrate/20140304015148_create_games.rb create mode 100644 db/migrate/20140304015150_create_game_attributes.rb create mode 100644 db/migrate/20140304015152_create_server_settings.rb create mode 100644 db/migrate/20140304015158_create_tournament_options.rb (limited to 'app/views') diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 0a9d8e8..4ecff17 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -69,6 +69,6 @@ class GamesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def game_params - params.require(:game).permit(:name) + params.require(:game).permit(:name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams) end end diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb index 0bbdd1f..8941c59 100644 --- a/app/views/games/_form.html.erb +++ b/app/views/games/_form.html.erb @@ -15,6 +15,22 @@ <%= f.label :name %>
<%= f.text_area :name %> +
+ <%= f.label :players_per_team %>
+ <%= f.number_field :players_per_team %> +
+
+ <%= f.label :teams_per_match %>
+ <%= f.number_field :teams_per_match %> +
+
+ <%= f.label :set_rounds %>
+ <%= f.number_field :set_rounds %> +
+
+ <%= f.label :randomized_teams %>
+ <%= f.number_field :randomized_teams %> +
<%= f.submit %>
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb index 27d47b6..ccd0f63 100644 --- a/app/views/games/index.html.erb +++ b/app/views/games/index.html.erb @@ -4,6 +4,10 @@
+ + + + @@ -14,6 +18,10 @@ <% @games.each do |game| %> + + + + diff --git a/app/views/games/index.json.jbuilder b/app/views/games/index.json.jbuilder index 90f4236..7e5c1a1 100644 --- a/app/views/games/index.json.jbuilder +++ b/app/views/games/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@games) do |game| - json.extract! game, :id, :name + json.extract! game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams json.url game_url(game, format: :json) end diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb index 20d374f..7986016 100644 --- a/app/views/games/show.html.erb +++ b/app/views/games/show.html.erb @@ -5,5 +5,25 @@ <%= @game.name %>

+

+ Players per team: + <%= @game.players_per_team %> +

+ +

+ Teams per match: + <%= @game.teams_per_match %> +

+ +

+ Set rounds: + <%= @game.set_rounds %> +

+ +

+ Randomized teams: + <%= @game.randomized_teams %> +

+ <%= link_to 'Edit', edit_game_path(@game) %> | <%= link_to 'Back', games_path %> diff --git a/app/views/games/show.json.jbuilder b/app/views/games/show.json.jbuilder index a4d8d1c..1a2d0c7 100644 --- a/app/views/games/show.json.jbuilder +++ b/app/views/games/show.json.jbuilder @@ -1 +1 @@ -json.extract! @game, :id, :name, :created_at, :updated_at +json.extract! @game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at diff --git a/db/migrate/20140304015051_create_servers.rb b/db/migrate/20140304015051_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304015051_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015053_create_tournaments.rb b/db/migrate/20140304015053_create_tournaments.rb deleted file mode 100644 index 36fcf7e..0000000 --- a/db/migrate/20140304015053_create_tournaments.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - t.references :game, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015055_create_matches.rb b/db/migrate/20140304015055_create_matches.rb deleted file mode 100644 index 6c0c157..0000000 --- a/db/migrate/20140304015055_create_matches.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.references :tournament, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015057_create_teams.rb b/db/migrate/20140304015057_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304015057_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015059_create_users.rb b/db/migrate/20140304015059_create_users.rb deleted file mode 100644 index 6a500e5..0000000 --- a/db/migrate/20140304015059_create_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.text :name - t.text :pw_hash - t.integer :groups - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015102_create_user_team_pairs.rb b/db/migrate/20140304015102_create_user_team_pairs.rb deleted file mode 100644 index 2c492ac..0000000 --- a/db/migrate/20140304015102_create_user_team_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUserTeamPairs < ActiveRecord::Migration - def change - create_table :user_team_pairs do |t| - t.references :user, index: true - t.references :team, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015104_create_team_match_pairs.rb b/db/migrate/20140304015104_create_team_match_pairs.rb deleted file mode 100644 index 8fac07e..0000000 --- a/db/migrate/20140304015104_create_team_match_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTeamMatchPairs < ActiveRecord::Migration - def change - create_table :team_match_pairs do |t| - t.references :team, index: true - t.references :match, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015106_create_alerts.rb b/db/migrate/20140304015106_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140304015106_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.references :author, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015108_create_pms.rb b/db/migrate/20140304015108_create_pms.rb deleted file mode 100644 index 93bb5c6..0000000 --- a/db/migrate/20140304015108_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.references :author, index: true - t.references :recipient, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015110_create_games.rb b/db/migrate/20140304015110_create_games.rb deleted file mode 100644 index fc54709..0000000 --- a/db/migrate/20140304015110_create_games.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateGames < ActiveRecord::Migration - def change - create_table :games do |t| - t.text :name - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015112_create_game_attributes.rb b/db/migrate/20140304015112_create_game_attributes.rb deleted file mode 100644 index b63f134..0000000 --- a/db/migrate/20140304015112_create_game_attributes.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateGameAttributes < ActiveRecord::Migration - def change - create_table :game_attributes do |t| - t.references :game, index: true - t.text :key - t.integer :type - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015114_create_server_settings.rb b/db/migrate/20140304015114_create_server_settings.rb deleted file mode 100644 index dfdd91b..0000000 --- a/db/migrate/20140304015114_create_server_settings.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServerSettings < ActiveRecord::Migration - def change - create_table :server_settings do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015120_create_tournament_options.rb b/db/migrate/20140304015120_create_tournament_options.rb deleted file mode 100644 index d2df22e..0000000 --- a/db/migrate/20140304015120_create_tournament_options.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentOptions < ActiveRecord::Migration - def change - create_table :tournament_options do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015129_create_servers.rb b/db/migrate/20140304015129_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304015129_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015131_create_tournaments.rb b/db/migrate/20140304015131_create_tournaments.rb new file mode 100644 index 0000000..36fcf7e --- /dev/null +++ b/db/migrate/20140304015131_create_tournaments.rb @@ -0,0 +1,9 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + t.references :game, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015133_create_matches.rb b/db/migrate/20140304015133_create_matches.rb new file mode 100644 index 0000000..6c0c157 --- /dev/null +++ b/db/migrate/20140304015133_create_matches.rb @@ -0,0 +1,9 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015135_create_teams.rb b/db/migrate/20140304015135_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304015135_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015137_create_users.rb b/db/migrate/20140304015137_create_users.rb new file mode 100644 index 0000000..6a500e5 --- /dev/null +++ b/db/migrate/20140304015137_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.text :name + t.text :pw_hash + t.integer :groups + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015139_create_user_team_pairs.rb b/db/migrate/20140304015139_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304015139_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015141_create_team_match_pairs.rb b/db/migrate/20140304015141_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304015141_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015144_create_alerts.rb b/db/migrate/20140304015144_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304015144_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015146_create_pms.rb b/db/migrate/20140304015146_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304015146_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015148_create_games.rb b/db/migrate/20140304015148_create_games.rb new file mode 100644 index 0000000..59d4ef0 --- /dev/null +++ b/db/migrate/20140304015148_create_games.rb @@ -0,0 +1,13 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.text :name + t.integer :players_per_team + t.integer :teams_per_match + t.integer :set_rounds + t.integer :randomized_teams + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015150_create_game_attributes.rb b/db/migrate/20140304015150_create_game_attributes.rb new file mode 100644 index 0000000..b63f134 --- /dev/null +++ b/db/migrate/20140304015150_create_game_attributes.rb @@ -0,0 +1,11 @@ +class CreateGameAttributes < ActiveRecord::Migration + def change + create_table :game_attributes do |t| + t.references :game, index: true + t.text :key + t.integer :type + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015152_create_server_settings.rb b/db/migrate/20140304015152_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304015152_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015158_create_tournament_options.rb b/db/migrate/20140304015158_create_tournament_options.rb new file mode 100644 index 0000000..d2df22e --- /dev/null +++ b/db/migrate/20140304015158_create_tournament_options.rb @@ -0,0 +1,8 @@ +class CreateTournamentOptions < ActiveRecord::Migration + def change + create_table :tournament_options do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 7681cfc..42417f4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140304015120) do +ActiveRecord::Schema.define(version: 20140304015158) do create_table "alerts", force: true do |t| t.integer "author_id" @@ -34,6 +34,10 @@ ActiveRecord::Schema.define(version: 20140304015120) do create_table "games", force: true do |t| t.text "name" + t.integer "players_per_team" + t.integer "teams_per_match" + t.integer "set_rounds" + t.integer "randomized_teams" t.datetime "created_at" t.datetime "updated_at" end diff --git a/generate.sh b/generate.sh index b384813..77d6cb9 100755 --- a/generate.sh +++ b/generate.sh @@ -18,7 +18,7 @@ bundle exec rails generate model user_team_pair user:references team:references bundle exec rails generate model team_match_pair team:references match:references bundle exec rails generate scaffold alert author:references message:text bundle exec rails generate scaffold pm author:references recipient:references message:text -bundle exec rails generate scaffold game name:text +bundle exec rails generate scaffold game name:text players_per_team:integer teams_per_match:integer set_rounds:integer randomized_teams:integer bundle exec rails generate model game_attribute game:references key:text type:integer bundle exec rails generate model server_settings bundle exec rails generate controller search diff --git a/test/controllers/games_controller_test.rb b/test/controllers/games_controller_test.rb index 420758e..95c3145 100644 --- a/test/controllers/games_controller_test.rb +++ b/test/controllers/games_controller_test.rb @@ -18,7 +18,7 @@ class GamesControllerTest < ActionController::TestCase test "should create game" do assert_difference('Game.count') do - post :create, game: { name: @game.name } + post :create, game: { name: @game.name, players_per_team: @game.players_per_team, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds, teams_per_match: @game.teams_per_match } end assert_redirected_to game_path(assigns(:game)) @@ -35,7 +35,7 @@ class GamesControllerTest < ActionController::TestCase end test "should update game" do - patch :update, id: @game, game: { name: @game.name } + patch :update, id: @game, game: { name: @game.name, players_per_team: @game.players_per_team, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds, teams_per_match: @game.teams_per_match } assert_redirected_to game_path(assigns(:game)) end diff --git a/test/fixtures/games.yml b/test/fixtures/games.yml index ce6f466..3068527 100644 --- a/test/fixtures/games.yml +++ b/test/fixtures/games.yml @@ -2,6 +2,14 @@ one: name: MyText + players_per_team: 1 + teams_per_match: 1 + set_rounds: 1 + randomized_teams: 1 two: name: MyText + players_per_team: 1 + teams_per_match: 1 + set_rounds: 1 + randomized_teams: 1 -- cgit v1.2.3-54-g00ecf From 2eb242f3e5b1f1ab66d84556cabcad965fe387aa Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sat, 1 Mar 2014 20:23:29 -0500 Subject: changed the user section of the generate --- app/controllers/users_controller.rb | 72 ---------------------- app/models/tournament_option.rb | 2 + app/models/tournament_options.rb | 2 - app/views/users/_form.html.erb | 29 --------- app/views/users/edit.html.erb | 6 -- app/views/users/index.html.erb | 31 ---------- app/views/users/index.json.jbuilder | 4 -- app/views/users/new.html.erb | 5 -- app/views/users/show.html.erb | 19 ------ app/views/users/show.json.jbuilder | 1 - config/routes.rb | 2 - db/migrate/20140304015447_create_servers.rb | 8 --- db/migrate/20140304015449_create_tournaments.rb | 9 --- db/migrate/20140304015452_create_matches.rb | 9 --- db/migrate/20140304015454_create_teams.rb | 8 --- db/migrate/20140304015456_create_users.rb | 11 ---- .../20140304015458_create_user_team_pairs.rb | 10 --- .../20140304015500_create_team_match_pairs.rb | 10 --- db/migrate/20140304015502_create_alerts.rb | 10 --- db/migrate/20140304015505_create_pms.rb | 11 ---- db/migrate/20140304015507_create_games.rb | 13 ---- .../20140304015509_create_game_attributes.rb | 11 ---- .../20140304015511_create_server_settings.rb | 8 --- .../20140304015517_create_tournament_options.rb | 8 --- db/migrate/20140304015527_create_servers.rb | 8 +++ db/migrate/20140304015530_create_tournaments.rb | 9 +++ db/migrate/20140304015532_create_matches.rb | 9 +++ db/migrate/20140304015534_create_teams.rb | 8 +++ db/migrate/20140304015538_create_users.rb | 11 ++++ .../20140304015540_create_user_team_pairs.rb | 10 +++ .../20140304015542_create_team_match_pairs.rb | 10 +++ db/migrate/20140304015544_create_alerts.rb | 10 +++ db/migrate/20140304015547_create_pms.rb | 11 ++++ db/migrate/20140304015549_create_games.rb | 13 ++++ .../20140304015551_create_game_attributes.rb | 11 ++++ .../20140304015553_create_server_settings.rb | 8 +++ .../20140304015559_create_tournament_options.rb | 8 +++ db/schema.rb | 8 +-- generate.sh | 32 +++++----- test/controllers/users_controller_test.rb | 48 +-------------- test/fixtures/users.yml | 12 ++-- test/models/tournament_option_test.rb | 7 +++ test/models/tournament_options_test.rb | 7 --- 43 files changed, 165 insertions(+), 374 deletions(-) create mode 100644 app/models/tournament_option.rb delete mode 100644 app/models/tournament_options.rb delete mode 100644 app/views/users/_form.html.erb delete mode 100644 app/views/users/edit.html.erb delete mode 100644 app/views/users/index.html.erb delete mode 100644 app/views/users/index.json.jbuilder delete mode 100644 app/views/users/new.html.erb delete mode 100644 app/views/users/show.html.erb delete mode 100644 app/views/users/show.json.jbuilder delete mode 100644 db/migrate/20140304015447_create_servers.rb delete mode 100644 db/migrate/20140304015449_create_tournaments.rb delete mode 100644 db/migrate/20140304015452_create_matches.rb delete mode 100644 db/migrate/20140304015454_create_teams.rb delete mode 100644 db/migrate/20140304015456_create_users.rb delete mode 100644 db/migrate/20140304015458_create_user_team_pairs.rb delete mode 100644 db/migrate/20140304015500_create_team_match_pairs.rb delete mode 100644 db/migrate/20140304015502_create_alerts.rb delete mode 100644 db/migrate/20140304015505_create_pms.rb delete mode 100644 db/migrate/20140304015507_create_games.rb delete mode 100644 db/migrate/20140304015509_create_game_attributes.rb delete mode 100644 db/migrate/20140304015511_create_server_settings.rb delete mode 100644 db/migrate/20140304015517_create_tournament_options.rb create mode 100644 db/migrate/20140304015527_create_servers.rb create mode 100644 db/migrate/20140304015530_create_tournaments.rb create mode 100644 db/migrate/20140304015532_create_matches.rb create mode 100644 db/migrate/20140304015534_create_teams.rb create mode 100644 db/migrate/20140304015538_create_users.rb create mode 100644 db/migrate/20140304015540_create_user_team_pairs.rb create mode 100644 db/migrate/20140304015542_create_team_match_pairs.rb create mode 100644 db/migrate/20140304015544_create_alerts.rb create mode 100644 db/migrate/20140304015547_create_pms.rb create mode 100644 db/migrate/20140304015549_create_games.rb create mode 100644 db/migrate/20140304015551_create_game_attributes.rb create mode 100644 db/migrate/20140304015553_create_server_settings.rb create mode 100644 db/migrate/20140304015559_create_tournament_options.rb create mode 100644 test/models/tournament_option_test.rb delete mode 100644 test/models/tournament_options_test.rb (limited to 'app/views') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4db617e..3e74dea 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,74 +1,2 @@ class UsersController < ApplicationController - before_action :set_user, only: [:show, :edit, :update, :destroy] - - # GET /users - # GET /users.json - def index - @users = User.all - end - - # GET /users/1 - # GET /users/1.json - def show - end - - # GET /users/new - def new - @user = User.new - end - - # GET /users/1/edit - def edit - end - - # POST /users - # POST /users.json - def create - @user = User.new(user_params) - - respond_to do |format| - if @user.save - format.html { redirect_to @user, notice: 'User was successfully created.' } - format.json { render action: 'show', status: :created, location: @user } - else - format.html { render action: 'new' } - format.json { render json: @user.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /users/1 - # PATCH/PUT /users/1.json - def update - respond_to do |format| - if @user.update(user_params) - format.html { redirect_to @user, notice: 'User was successfully updated.' } - format.json { head :no_content } - else - format.html { render action: 'edit' } - format.json { render json: @user.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /users/1 - # DELETE /users/1.json - def destroy - @user.destroy - respond_to do |format| - format.html { redirect_to users_url } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_user - @user = User.find(params[:id]) - end - - # Never trust parameters from the scary internet, only allow the white list through. - def user_params - params.require(:user).permit(:name, :pw_hash, :groups) - end end diff --git a/app/models/tournament_option.rb b/app/models/tournament_option.rb new file mode 100644 index 0000000..950b351 --- /dev/null +++ b/app/models/tournament_option.rb @@ -0,0 +1,2 @@ +class TournamentOption < ActiveRecord::Base +end diff --git a/app/models/tournament_options.rb b/app/models/tournament_options.rb deleted file mode 100644 index 8ed6433..0000000 --- a/app/models/tournament_options.rb +++ /dev/null @@ -1,2 +0,0 @@ -class TournamentOptions < ActiveRecord::Base -end diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb deleted file mode 100644 index 2d1ad24..0000000 --- a/app/views/users/_form.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<%= form_for(@user) do |f| %> - <% if @user.errors.any? %> -
-

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

- -
    - <% @user.errors.full_messages.each do |msg| %> -
  • <%= msg %>
  • - <% end %> -
-
- <% end %> - -
- <%= f.label :name %>
- <%= f.text_area :name %> -
-
- <%= f.label :pw_hash %>
- <%= f.text_area :pw_hash %> -
-
- <%= f.label :groups %>
- <%= f.number_field :groups %> -
-
- <%= f.submit %> -
-<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb deleted file mode 100644 index 99bd4cc..0000000 --- a/app/views/users/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing user

- -<%= render 'form' %> - -<%= link_to 'Show', @user %> | -<%= link_to 'Back', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb deleted file mode 100644 index 14739ae..0000000 --- a/app/views/users/index.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -

Listing users

- -
Game
<%= tournament.game %> <%= link_to 'Show', tournament %> <%= link_to 'Edit', edit_tournament_path(tournament) %> <%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %>
NamePlayers per teamTeams per matchSet roundsRandomized teams
<%= game.name %><%= game.players_per_team %><%= game.teams_per_match %><%= game.set_rounds %><%= game.randomized_teams %> <%= link_to 'Show', game %> <%= link_to 'Edit', edit_game_path(game) %> <%= link_to 'Destroy', game, method: :delete, data: { confirm: 'Are you sure?' } %>
- - - - - - - - - - - - - <% @users.each do |user| %> - - - - - - - - - <% end %> - -
NamePw hashGroups
<%= user.name %><%= user.pw_hash %><%= user.groups %><%= link_to 'Show', user %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New User', new_user_path %> diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder deleted file mode 100644 index 58c42c1..0000000 --- a/app/views/users/index.json.jbuilder +++ /dev/null @@ -1,4 +0,0 @@ -json.array!(@users) do |user| - json.extract! user, :id, :name, :pw_hash, :groups - json.url user_url(user, format: :json) -end diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb deleted file mode 100644 index efc0404..0000000 --- a/app/views/users/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New user

- -<%= render 'form' %> - -<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb deleted file mode 100644 index 05150f5..0000000 --- a/app/views/users/show.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -

<%= notice %>

- -

- Name: - <%= @user.name %> -

- -

- Pw hash: - <%= @user.pw_hash %> -

- -

- Groups: - <%= @user.groups %> -

- -<%= link_to 'Edit', edit_user_path(@user) %> | -<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder deleted file mode 100644 index 968b383..0000000 --- a/app/views/users/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.extract! @user, :id, :name, :pw_hash, :groups, :created_at, :updated_at diff --git a/config/routes.rb b/config/routes.rb index 3412005..149c321 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,8 +5,6 @@ Leaguer::Application.routes.draw do resources :alerts - resources :users - resources :teams resources :matches diff --git a/db/migrate/20140304015447_create_servers.rb b/db/migrate/20140304015447_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304015447_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015449_create_tournaments.rb b/db/migrate/20140304015449_create_tournaments.rb deleted file mode 100644 index 36fcf7e..0000000 --- a/db/migrate/20140304015449_create_tournaments.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - t.references :game, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015452_create_matches.rb b/db/migrate/20140304015452_create_matches.rb deleted file mode 100644 index 6c0c157..0000000 --- a/db/migrate/20140304015452_create_matches.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.references :tournament, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015454_create_teams.rb b/db/migrate/20140304015454_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304015454_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015456_create_users.rb b/db/migrate/20140304015456_create_users.rb deleted file mode 100644 index 6a500e5..0000000 --- a/db/migrate/20140304015456_create_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.text :name - t.text :pw_hash - t.integer :groups - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015458_create_user_team_pairs.rb b/db/migrate/20140304015458_create_user_team_pairs.rb deleted file mode 100644 index 2c492ac..0000000 --- a/db/migrate/20140304015458_create_user_team_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUserTeamPairs < ActiveRecord::Migration - def change - create_table :user_team_pairs do |t| - t.references :user, index: true - t.references :team, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015500_create_team_match_pairs.rb b/db/migrate/20140304015500_create_team_match_pairs.rb deleted file mode 100644 index 8fac07e..0000000 --- a/db/migrate/20140304015500_create_team_match_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTeamMatchPairs < ActiveRecord::Migration - def change - create_table :team_match_pairs do |t| - t.references :team, index: true - t.references :match, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015502_create_alerts.rb b/db/migrate/20140304015502_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140304015502_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.references :author, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015505_create_pms.rb b/db/migrate/20140304015505_create_pms.rb deleted file mode 100644 index 93bb5c6..0000000 --- a/db/migrate/20140304015505_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.references :author, index: true - t.references :recipient, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015507_create_games.rb b/db/migrate/20140304015507_create_games.rb deleted file mode 100644 index 59d4ef0..0000000 --- a/db/migrate/20140304015507_create_games.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateGames < ActiveRecord::Migration - def change - create_table :games do |t| - t.text :name - t.integer :players_per_team - t.integer :teams_per_match - t.integer :set_rounds - t.integer :randomized_teams - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015509_create_game_attributes.rb b/db/migrate/20140304015509_create_game_attributes.rb deleted file mode 100644 index b63f134..0000000 --- a/db/migrate/20140304015509_create_game_attributes.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateGameAttributes < ActiveRecord::Migration - def change - create_table :game_attributes do |t| - t.references :game, index: true - t.text :key - t.integer :type - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015511_create_server_settings.rb b/db/migrate/20140304015511_create_server_settings.rb deleted file mode 100644 index dfdd91b..0000000 --- a/db/migrate/20140304015511_create_server_settings.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServerSettings < ActiveRecord::Migration - def change - create_table :server_settings do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015517_create_tournament_options.rb b/db/migrate/20140304015517_create_tournament_options.rb deleted file mode 100644 index d2df22e..0000000 --- a/db/migrate/20140304015517_create_tournament_options.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentOptions < ActiveRecord::Migration - def change - create_table :tournament_options do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304015527_create_servers.rb b/db/migrate/20140304015527_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304015527_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015530_create_tournaments.rb b/db/migrate/20140304015530_create_tournaments.rb new file mode 100644 index 0000000..36fcf7e --- /dev/null +++ b/db/migrate/20140304015530_create_tournaments.rb @@ -0,0 +1,9 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + t.references :game, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015532_create_matches.rb b/db/migrate/20140304015532_create_matches.rb new file mode 100644 index 0000000..6c0c157 --- /dev/null +++ b/db/migrate/20140304015532_create_matches.rb @@ -0,0 +1,9 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015534_create_teams.rb b/db/migrate/20140304015534_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304015534_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015538_create_users.rb b/db/migrate/20140304015538_create_users.rb new file mode 100644 index 0000000..f0986d4 --- /dev/null +++ b/db/migrate/20140304015538_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :user_name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015540_create_user_team_pairs.rb b/db/migrate/20140304015540_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304015540_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015542_create_team_match_pairs.rb b/db/migrate/20140304015542_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304015542_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015544_create_alerts.rb b/db/migrate/20140304015544_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304015544_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015547_create_pms.rb b/db/migrate/20140304015547_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304015547_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015549_create_games.rb b/db/migrate/20140304015549_create_games.rb new file mode 100644 index 0000000..59d4ef0 --- /dev/null +++ b/db/migrate/20140304015549_create_games.rb @@ -0,0 +1,13 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.text :name + t.integer :players_per_team + t.integer :teams_per_match + t.integer :set_rounds + t.integer :randomized_teams + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015551_create_game_attributes.rb b/db/migrate/20140304015551_create_game_attributes.rb new file mode 100644 index 0000000..b63f134 --- /dev/null +++ b/db/migrate/20140304015551_create_game_attributes.rb @@ -0,0 +1,11 @@ +class CreateGameAttributes < ActiveRecord::Migration + def change + create_table :game_attributes do |t| + t.references :game, index: true + t.text :key + t.integer :type + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015553_create_server_settings.rb b/db/migrate/20140304015553_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304015553_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304015559_create_tournament_options.rb b/db/migrate/20140304015559_create_tournament_options.rb new file mode 100644 index 0000000..d2df22e --- /dev/null +++ b/db/migrate/20140304015559_create_tournament_options.rb @@ -0,0 +1,8 @@ +class CreateTournamentOptions < ActiveRecord::Migration + def change + create_table :tournament_options do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 41dac9e..7d4d50e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140304015517) do +ActiveRecord::Schema.define(version: 20140304015559) do create_table "alerts", force: true do |t| t.integer "author_id" @@ -110,9 +110,9 @@ ActiveRecord::Schema.define(version: 20140304015517) do add_index "user_team_pairs", ["user_id"], name: "index_user_team_pairs_on_user_id" create_table "users", force: true do |t| - t.text "name" - t.text "pw_hash" - t.integer "groups" + t.string "name" + t.string "email" + t.string "user_name" t.datetime "created_at" t.datetime "updated_at" end diff --git a/generate.sh b/generate.sh index 07a7688..2bf027a 100755 --- a/generate.sh +++ b/generate.sh @@ -10,25 +10,27 @@ # To Clear the Generated Files: # git clean -df # +NOTEST='--skip-test-unit' set -x -bundle exec rails generate scaffold server -bundle exec rails generate scaffold tournament game:references -bundle exec rails generate scaffold match tournament:references -bundle exec rails generate scaffold team -bundle exec rails generate scaffold user name:text pw_hash:text groups:integer -bundle exec rails generate model user_team_pair user:references team:references -bundle exec rails generate model team_match_pair team:references match:references -bundle exec rails generate scaffold alert author:references message:text -bundle exec rails generate scaffold pm author:references recipient:references message:text -bundle exec rails generate scaffold game name:text players_per_team:integer teams_per_match:integer set_rounds:integer randomized_teams:integer -bundle exec rails generate model game_attribute game:references key:text type:integer -bundle exec rails generate model server_settings -bundle exec rails generate controller search -bundle exec rails generate controller main +bundle exec rails generate scaffold server $NOTEST +bundle exec rails generate scaffold tournament game:references $NOTEST +bundle exec rails generate scaffold match tournament:references $NOTEST +bundle exec rails generate scaffold team $NOTEST +bundle exec rails generate controller users $NOTEST +bundle exec rails generate model user name:string email:string user_name:string $NOTEST +bundle exec rails generate model user_team_pair user:references team:references $NOTEST +bundle exec rails generate model team_match_pair team:references match:references $NOTEST +bundle exec rails generate scaffold alert author:references message:text $NOTEST +bundle exec rails generate scaffold pm author:references recipient:references message:text $NOTEST +bundle exec rails generate scaffold game name:text players_per_team:integer teams_per_match:integer set_rounds:integer randomized_teams:integer $NOTEST +bundle exec rails generate model game_attribute game:references key:text type:integer $NOTEST +bundle exec rails generate model server_settings $NOTEST +bundle exec rails generate controller search $NOTEST +bundle exec rails generate controller main $NOTEST #for the tournament controller to generate options -bundle exec rails generate model tournament_options +bundle exec rails generate model tournament_option $NOTEST bundle exec rake db:drop RAILS_ENV=development bundle exec rake db:migrate RAILS_ENV=development diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 8bcd10b..d23f182 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -1,49 +1,7 @@ require 'test_helper' class UsersControllerTest < ActionController::TestCase - setup do - @user = users(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:users) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create user" do - assert_difference('User.count') do - post :create, user: { groups: @user.groups, name: @user.name, pw_hash: @user.pw_hash } - end - - assert_redirected_to user_path(assigns(:user)) - end - - test "should show user" do - get :show, id: @user - assert_response :success - end - - test "should get edit" do - get :edit, id: @user - assert_response :success - end - - test "should update user" do - patch :update, id: @user, user: { groups: @user.groups, name: @user.name, pw_hash: @user.pw_hash } - assert_redirected_to user_path(assigns(:user)) - end - - test "should destroy user" do - assert_difference('User.count', -1) do - delete :destroy, id: @user - end - - assert_redirected_to users_path - end + # test "the truth" do + # assert true + # end end diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 9f593bc..ea3e874 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -1,11 +1,11 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - name: MyText - pw_hash: MyText - groups: 1 + name: MyString + email: MyString + user_name: MyString two: - name: MyText - pw_hash: MyText - groups: 1 + name: MyString + email: MyString + user_name: MyString diff --git a/test/models/tournament_option_test.rb b/test/models/tournament_option_test.rb new file mode 100644 index 0000000..8fa9628 --- /dev/null +++ b/test/models/tournament_option_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TournamentOptionTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/tournament_options_test.rb b/test/models/tournament_options_test.rb deleted file mode 100644 index 7677fae..0000000 --- a/test/models/tournament_options_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class TournamentOptionsTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end -- cgit v1.2.3-54-g00ecf From eaf3d3cddf418c560c9619f722ea1dbc5d6cc61a Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 15:59:50 -0500 Subject: currently adding Session controller and view --- Gemfile.lock | 8 -- app/assets/javascripts/alerts.js.coffee | 3 + app/assets/javascripts/games.js.coffee | 3 + app/assets/javascripts/main.js.coffee | 3 + app/assets/javascripts/matches.js.coffee | 3 + app/assets/javascripts/pms.js.coffee | 3 + app/assets/javascripts/search.js.coffee | 3 + app/assets/javascripts/servers.js.coffee | 3 + app/assets/javascripts/sessions.js.coffee | 3 + app/assets/javascripts/static.js.coffee | 3 + app/assets/javascripts/teams.js.coffee | 3 + app/assets/javascripts/tournaments.js.coffee | 3 + app/assets/javascripts/users.js.coffee | 3 + app/assets/stylesheets/alerts.css.scss | 3 + app/assets/stylesheets/games.css.scss | 3 + app/assets/stylesheets/main.css.scss | 3 + app/assets/stylesheets/matches.css.scss | 3 + app/assets/stylesheets/pms.css.scss | 3 + app/assets/stylesheets/scaffolds.css.scss | 69 +++++++++ app/assets/stylesheets/search.css.scss | 3 + app/assets/stylesheets/servers.css.scss | 3 + app/assets/stylesheets/sessions.css.scss | 3 + app/assets/stylesheets/static.css.scss | 3 + app/assets/stylesheets/teams.css.scss | 3 + app/assets/stylesheets/tournaments.css.scss | 3 + app/assets/stylesheets/users.css.scss | 3 + app/controllers/alerts_controller.rb | 74 ++++++++++ app/controllers/games_controller.rb | 74 ++++++++++ app/controllers/main_controller.rb | 2 + app/controllers/matches_controller.rb | 74 ++++++++++ app/controllers/pms_controller.rb | 74 ++++++++++ app/controllers/search_controller.rb | 2 + app/controllers/servers_controller.rb | 74 ++++++++++ app/controllers/sessions_controller.rb | 2 + app/controllers/static_controller.rb | 2 + app/controllers/teams_controller.rb | 74 ++++++++++ app/controllers/tournaments_controller.rb | 74 ++++++++++ app/controllers/users_controller.rb | 2 + app/helpers/alerts_helper.rb | 2 + app/helpers/games_helper.rb | 2 + app/helpers/main_helper.rb | 2 + app/helpers/matches_helper.rb | 2 + app/helpers/pms_helper.rb | 2 + app/helpers/search_helper.rb | 2 + app/helpers/servers_helper.rb | 2 + app/helpers/sessions_helper.rb | 2 + app/helpers/static_helper.rb | 2 + app/helpers/teams_helper.rb | 2 + app/helpers/tournaments_helper.rb | 2 + app/helpers/users_helper.rb | 2 + app/models/alert.rb | 3 + app/models/game.rb | 2 + app/models/game_attribute.rb | 3 + app/models/match.rb | 3 + app/models/pm.rb | 4 + app/models/server.rb | 2 + app/models/server_settings.rb | 2 + app/models/team.rb | 2 + app/models/team_match_pair.rb | 4 + app/models/tournament.rb | 3 + app/models/tournament_option.rb | 2 + app/models/user.rb | 2 + app/models/user_team_pair.rb | 4 + app/views/alerts/_form.html.erb | 25 ++++ app/views/alerts/edit.html.erb | 6 + app/views/alerts/index.html.erb | 29 ++++ app/views/alerts/index.json.jbuilder | 4 + app/views/alerts/new.html.erb | 5 + app/views/alerts/show.html.erb | 14 ++ app/views/alerts/show.json.jbuilder | 1 + app/views/games/_form.html.erb | 37 +++++ app/views/games/edit.html.erb | 6 + app/views/games/index.html.erb | 35 +++++ app/views/games/index.json.jbuilder | 4 + app/views/games/new.html.erb | 5 + app/views/games/show.html.erb | 29 ++++ app/views/games/show.json.jbuilder | 1 + app/views/matches/_form.html.erb | 21 +++ app/views/matches/edit.html.erb | 6 + app/views/matches/index.html.erb | 27 ++++ app/views/matches/index.json.jbuilder | 4 + app/views/matches/new.html.erb | 5 + app/views/matches/show.html.erb | 9 ++ app/views/matches/show.json.jbuilder | 1 + app/views/pms/_form.html.erb | 29 ++++ app/views/pms/edit.html.erb | 6 + app/views/pms/index.html.erb | 31 ++++ app/views/pms/index.json.jbuilder | 4 + app/views/pms/new.html.erb | 5 + app/views/pms/show.html.erb | 19 +++ app/views/pms/show.json.jbuilder | 1 + app/views/servers/_form.html.erb | 17 +++ app/views/servers/edit.html.erb | 6 + app/views/servers/index.html.erb | 25 ++++ app/views/servers/index.json.jbuilder | 4 + app/views/servers/new.html.erb | 5 + app/views/servers/show.html.erb | 4 + app/views/servers/show.json.jbuilder | 1 + app/views/teams/_form.html.erb | 17 +++ app/views/teams/edit.html.erb | 6 + app/views/teams/index.html.erb | 25 ++++ app/views/teams/index.json.jbuilder | 4 + app/views/teams/new.html.erb | 5 + app/views/teams/show.html.erb | 4 + app/views/teams/show.json.jbuilder | 1 + app/views/tournaments/_form.html.erb | 21 +++ app/views/tournaments/edit.html.erb | 6 + app/views/tournaments/index.html.erb | 27 ++++ app/views/tournaments/index.json.jbuilder | 4 + app/views/tournaments/new.html.erb | 5 + app/views/tournaments/show.html.erb | 9 ++ app/views/tournaments/show.json.jbuilder | 1 + config/routes.rb | 14 ++ db/migrate/20140304020217_create_servers.rb | 8 ++ db/migrate/20140304020219_create_tournaments.rb | 9 ++ db/migrate/20140304020221_create_matches.rb | 9 ++ db/migrate/20140304020224_create_teams.rb | 8 ++ db/migrate/20140304020230_create_users.rb | 11 ++ .../20140304020233_create_user_team_pairs.rb | 10 ++ .../20140304020235_create_team_match_pairs.rb | 10 ++ db/migrate/20140304020237_create_alerts.rb | 10 ++ db/migrate/20140304020239_create_pms.rb | 11 ++ db/migrate/20140304020242_create_games.rb | 13 ++ .../20140304020244_create_game_attributes.rb | 11 ++ .../20140304020246_create_server_settings.rb | 8 ++ .../20140304020255_create_tournament_options.rb | 8 ++ db/schema.rb | 120 ++++++++++++++++ generate.sh | 1 + spec/controllers/alerts_controller_spec.rb | 160 +++++++++++++++++++++ spec/controllers/games_controller_spec.rb | 160 +++++++++++++++++++++ spec/controllers/main_controller_spec.rb | 5 + spec/controllers/matches_controller_spec.rb | 160 +++++++++++++++++++++ spec/controllers/pms_controller_spec.rb | 160 +++++++++++++++++++++ spec/controllers/search_controller_spec.rb | 5 + spec/controllers/servers_controller_spec.rb | 160 +++++++++++++++++++++ spec/controllers/sessions_controller_spec.rb | 5 + spec/controllers/static_controller_spec.rb | 5 + spec/controllers/teams_controller_spec.rb | 160 +++++++++++++++++++++ spec/controllers/tournaments_controller_spec.rb | 160 +++++++++++++++++++++ spec/controllers/users_controller_spec.rb | 5 + spec/helpers/alerts_helper_spec.rb | 15 ++ spec/helpers/games_helper_spec.rb | 15 ++ spec/helpers/main_helper_spec.rb | 15 ++ spec/helpers/matches_helper_spec.rb | 15 ++ spec/helpers/pms_helper_spec.rb | 15 ++ spec/helpers/search_helper_spec.rb | 15 ++ spec/helpers/servers_helper_spec.rb | 15 ++ spec/helpers/sessions_helper_spec.rb | 15 ++ spec/helpers/static_helper_spec.rb | 15 ++ spec/helpers/teams_helper_spec.rb | 15 ++ spec/helpers/tournaments_helper_spec.rb | 15 ++ spec/helpers/users_helper_spec.rb | 15 ++ spec/models/alert_spec.rb | 5 + spec/models/game_attribute_spec.rb | 5 + spec/models/game_spec.rb | 5 + spec/models/match_spec.rb | 5 + spec/models/pm_spec.rb | 5 + spec/models/server_settings_spec.rb | 5 + spec/models/server_spec.rb | 5 + spec/models/team_match_pair_spec.rb | 5 + spec/models/team_spec.rb | 5 + spec/models/tournament_option_spec.rb | 5 + spec/models/tournament_spec.rb | 5 + spec/models/user_spec.rb | 5 + spec/models/user_team_pair_spec.rb | 5 + spec/requests/alerts_spec.rb | 11 ++ spec/requests/games_spec.rb | 11 ++ spec/requests/matches_spec.rb | 11 ++ spec/requests/pms_spec.rb | 11 ++ spec/requests/servers_spec.rb | 11 ++ spec/requests/teams_spec.rb | 11 ++ spec/requests/tournaments_spec.rb | 11 ++ spec/routing/alerts_routing_spec.rb | 35 +++++ spec/routing/games_routing_spec.rb | 35 +++++ spec/routing/matches_routing_spec.rb | 35 +++++ spec/routing/pms_routing_spec.rb | 35 +++++ spec/routing/servers_routing_spec.rb | 35 +++++ spec/routing/teams_routing_spec.rb | 35 +++++ spec/routing/tournaments_routing_spec.rb | 35 +++++ spec/views/alerts/edit.html.erb_spec.rb | 20 +++ spec/views/alerts/index.html.erb_spec.rb | 23 +++ spec/views/alerts/new.html.erb_spec.rb | 20 +++ spec/views/alerts/show.html.erb_spec.rb | 17 +++ spec/views/games/edit.html.erb_spec.rb | 26 ++++ spec/views/games/index.html.erb_spec.rb | 32 +++++ spec/views/games/new.html.erb_spec.rb | 26 ++++ spec/views/games/show.html.erb_spec.rb | 23 +++ spec/views/matches/edit.html.erb_spec.rb | 18 +++ spec/views/matches/index.html.erb_spec.rb | 20 +++ spec/views/matches/new.html.erb_spec.rb | 18 +++ spec/views/matches/show.html.erb_spec.rb | 15 ++ spec/views/pms/edit.html.erb_spec.rb | 22 +++ spec/views/pms/index.html.erb_spec.rb | 26 ++++ spec/views/pms/new.html.erb_spec.rb | 22 +++ spec/views/pms/show.html.erb_spec.rb | 19 +++ spec/views/servers/edit.html.erb_spec.rb | 15 ++ spec/views/servers/index.html.erb_spec.rb | 15 ++ spec/views/servers/new.html.erb_spec.rb | 15 ++ spec/views/servers/show.html.erb_spec.rb | 12 ++ spec/views/teams/edit.html.erb_spec.rb | 15 ++ spec/views/teams/index.html.erb_spec.rb | 15 ++ spec/views/teams/new.html.erb_spec.rb | 15 ++ spec/views/teams/show.html.erb_spec.rb | 12 ++ spec/views/tournaments/edit.html.erb_spec.rb | 18 +++ spec/views/tournaments/index.html.erb_spec.rb | 20 +++ spec/views/tournaments/new.html.erb_spec.rb | 18 +++ spec/views/tournaments/show.html.erb_spec.rb | 15 ++ 207 files changed, 3800 insertions(+), 8 deletions(-) create mode 100644 app/assets/javascripts/alerts.js.coffee create mode 100644 app/assets/javascripts/games.js.coffee create mode 100644 app/assets/javascripts/main.js.coffee create mode 100644 app/assets/javascripts/matches.js.coffee create mode 100644 app/assets/javascripts/pms.js.coffee create mode 100644 app/assets/javascripts/search.js.coffee create mode 100644 app/assets/javascripts/servers.js.coffee create mode 100644 app/assets/javascripts/sessions.js.coffee create mode 100644 app/assets/javascripts/static.js.coffee create mode 100644 app/assets/javascripts/teams.js.coffee create mode 100644 app/assets/javascripts/tournaments.js.coffee create mode 100644 app/assets/javascripts/users.js.coffee create mode 100644 app/assets/stylesheets/alerts.css.scss create mode 100644 app/assets/stylesheets/games.css.scss create mode 100644 app/assets/stylesheets/main.css.scss create mode 100644 app/assets/stylesheets/matches.css.scss create mode 100644 app/assets/stylesheets/pms.css.scss create mode 100644 app/assets/stylesheets/scaffolds.css.scss create mode 100644 app/assets/stylesheets/search.css.scss create mode 100644 app/assets/stylesheets/servers.css.scss create mode 100644 app/assets/stylesheets/sessions.css.scss create mode 100644 app/assets/stylesheets/static.css.scss create mode 100644 app/assets/stylesheets/teams.css.scss create mode 100644 app/assets/stylesheets/tournaments.css.scss create mode 100644 app/assets/stylesheets/users.css.scss create mode 100644 app/controllers/alerts_controller.rb create mode 100644 app/controllers/games_controller.rb create mode 100644 app/controllers/main_controller.rb create mode 100644 app/controllers/matches_controller.rb create mode 100644 app/controllers/pms_controller.rb create mode 100644 app/controllers/search_controller.rb create mode 100644 app/controllers/servers_controller.rb create mode 100644 app/controllers/sessions_controller.rb create mode 100644 app/controllers/static_controller.rb create mode 100644 app/controllers/teams_controller.rb create mode 100644 app/controllers/tournaments_controller.rb create mode 100644 app/controllers/users_controller.rb create mode 100644 app/helpers/alerts_helper.rb create mode 100644 app/helpers/games_helper.rb create mode 100644 app/helpers/main_helper.rb create mode 100644 app/helpers/matches_helper.rb create mode 100644 app/helpers/pms_helper.rb create mode 100644 app/helpers/search_helper.rb create mode 100644 app/helpers/servers_helper.rb create mode 100644 app/helpers/sessions_helper.rb create mode 100644 app/helpers/static_helper.rb create mode 100644 app/helpers/teams_helper.rb create mode 100644 app/helpers/tournaments_helper.rb create mode 100644 app/helpers/users_helper.rb create mode 100644 app/models/alert.rb create mode 100644 app/models/game.rb create mode 100644 app/models/game_attribute.rb create mode 100644 app/models/match.rb create mode 100644 app/models/pm.rb create mode 100644 app/models/server.rb create mode 100644 app/models/server_settings.rb create mode 100644 app/models/team.rb create mode 100644 app/models/team_match_pair.rb create mode 100644 app/models/tournament.rb create mode 100644 app/models/tournament_option.rb create mode 100644 app/models/user.rb create mode 100644 app/models/user_team_pair.rb create mode 100644 app/views/alerts/_form.html.erb create mode 100644 app/views/alerts/edit.html.erb create mode 100644 app/views/alerts/index.html.erb create mode 100644 app/views/alerts/index.json.jbuilder create mode 100644 app/views/alerts/new.html.erb create mode 100644 app/views/alerts/show.html.erb create mode 100644 app/views/alerts/show.json.jbuilder create mode 100644 app/views/games/_form.html.erb create mode 100644 app/views/games/edit.html.erb create mode 100644 app/views/games/index.html.erb create mode 100644 app/views/games/index.json.jbuilder create mode 100644 app/views/games/new.html.erb create mode 100644 app/views/games/show.html.erb create mode 100644 app/views/games/show.json.jbuilder create mode 100644 app/views/matches/_form.html.erb create mode 100644 app/views/matches/edit.html.erb create mode 100644 app/views/matches/index.html.erb create mode 100644 app/views/matches/index.json.jbuilder create mode 100644 app/views/matches/new.html.erb create mode 100644 app/views/matches/show.html.erb create mode 100644 app/views/matches/show.json.jbuilder create mode 100644 app/views/pms/_form.html.erb create mode 100644 app/views/pms/edit.html.erb create mode 100644 app/views/pms/index.html.erb create mode 100644 app/views/pms/index.json.jbuilder create mode 100644 app/views/pms/new.html.erb create mode 100644 app/views/pms/show.html.erb create mode 100644 app/views/pms/show.json.jbuilder create mode 100644 app/views/servers/_form.html.erb create mode 100644 app/views/servers/edit.html.erb create mode 100644 app/views/servers/index.html.erb create mode 100644 app/views/servers/index.json.jbuilder create mode 100644 app/views/servers/new.html.erb create mode 100644 app/views/servers/show.html.erb create mode 100644 app/views/servers/show.json.jbuilder create mode 100644 app/views/teams/_form.html.erb create mode 100644 app/views/teams/edit.html.erb create mode 100644 app/views/teams/index.html.erb create mode 100644 app/views/teams/index.json.jbuilder create mode 100644 app/views/teams/new.html.erb create mode 100644 app/views/teams/show.html.erb create mode 100644 app/views/teams/show.json.jbuilder create mode 100644 app/views/tournaments/_form.html.erb create mode 100644 app/views/tournaments/edit.html.erb create mode 100644 app/views/tournaments/index.html.erb create mode 100644 app/views/tournaments/index.json.jbuilder create mode 100644 app/views/tournaments/new.html.erb create mode 100644 app/views/tournaments/show.html.erb create mode 100644 app/views/tournaments/show.json.jbuilder create mode 100644 db/migrate/20140304020217_create_servers.rb create mode 100644 db/migrate/20140304020219_create_tournaments.rb create mode 100644 db/migrate/20140304020221_create_matches.rb create mode 100644 db/migrate/20140304020224_create_teams.rb create mode 100644 db/migrate/20140304020230_create_users.rb create mode 100644 db/migrate/20140304020233_create_user_team_pairs.rb create mode 100644 db/migrate/20140304020235_create_team_match_pairs.rb create mode 100644 db/migrate/20140304020237_create_alerts.rb create mode 100644 db/migrate/20140304020239_create_pms.rb create mode 100644 db/migrate/20140304020242_create_games.rb create mode 100644 db/migrate/20140304020244_create_game_attributes.rb create mode 100644 db/migrate/20140304020246_create_server_settings.rb create mode 100644 db/migrate/20140304020255_create_tournament_options.rb create mode 100644 db/schema.rb create mode 100644 spec/controllers/alerts_controller_spec.rb create mode 100644 spec/controllers/games_controller_spec.rb create mode 100644 spec/controllers/main_controller_spec.rb create mode 100644 spec/controllers/matches_controller_spec.rb create mode 100644 spec/controllers/pms_controller_spec.rb create mode 100644 spec/controllers/search_controller_spec.rb create mode 100644 spec/controllers/servers_controller_spec.rb create mode 100644 spec/controllers/sessions_controller_spec.rb create mode 100644 spec/controllers/static_controller_spec.rb create mode 100644 spec/controllers/teams_controller_spec.rb create mode 100644 spec/controllers/tournaments_controller_spec.rb create mode 100644 spec/controllers/users_controller_spec.rb create mode 100644 spec/helpers/alerts_helper_spec.rb create mode 100644 spec/helpers/games_helper_spec.rb create mode 100644 spec/helpers/main_helper_spec.rb create mode 100644 spec/helpers/matches_helper_spec.rb create mode 100644 spec/helpers/pms_helper_spec.rb create mode 100644 spec/helpers/search_helper_spec.rb create mode 100644 spec/helpers/servers_helper_spec.rb create mode 100644 spec/helpers/sessions_helper_spec.rb create mode 100644 spec/helpers/static_helper_spec.rb create mode 100644 spec/helpers/teams_helper_spec.rb create mode 100644 spec/helpers/tournaments_helper_spec.rb create mode 100644 spec/helpers/users_helper_spec.rb create mode 100644 spec/models/alert_spec.rb create mode 100644 spec/models/game_attribute_spec.rb create mode 100644 spec/models/game_spec.rb create mode 100644 spec/models/match_spec.rb create mode 100644 spec/models/pm_spec.rb create mode 100644 spec/models/server_settings_spec.rb create mode 100644 spec/models/server_spec.rb create mode 100644 spec/models/team_match_pair_spec.rb create mode 100644 spec/models/team_spec.rb create mode 100644 spec/models/tournament_option_spec.rb create mode 100644 spec/models/tournament_spec.rb create mode 100644 spec/models/user_spec.rb create mode 100644 spec/models/user_team_pair_spec.rb create mode 100644 spec/requests/alerts_spec.rb create mode 100644 spec/requests/games_spec.rb create mode 100644 spec/requests/matches_spec.rb create mode 100644 spec/requests/pms_spec.rb create mode 100644 spec/requests/servers_spec.rb create mode 100644 spec/requests/teams_spec.rb create mode 100644 spec/requests/tournaments_spec.rb create mode 100644 spec/routing/alerts_routing_spec.rb create mode 100644 spec/routing/games_routing_spec.rb create mode 100644 spec/routing/matches_routing_spec.rb create mode 100644 spec/routing/pms_routing_spec.rb create mode 100644 spec/routing/servers_routing_spec.rb create mode 100644 spec/routing/teams_routing_spec.rb create mode 100644 spec/routing/tournaments_routing_spec.rb create mode 100644 spec/views/alerts/edit.html.erb_spec.rb create mode 100644 spec/views/alerts/index.html.erb_spec.rb create mode 100644 spec/views/alerts/new.html.erb_spec.rb create mode 100644 spec/views/alerts/show.html.erb_spec.rb create mode 100644 spec/views/games/edit.html.erb_spec.rb create mode 100644 spec/views/games/index.html.erb_spec.rb create mode 100644 spec/views/games/new.html.erb_spec.rb create mode 100644 spec/views/games/show.html.erb_spec.rb create mode 100644 spec/views/matches/edit.html.erb_spec.rb create mode 100644 spec/views/matches/index.html.erb_spec.rb create mode 100644 spec/views/matches/new.html.erb_spec.rb create mode 100644 spec/views/matches/show.html.erb_spec.rb create mode 100644 spec/views/pms/edit.html.erb_spec.rb create mode 100644 spec/views/pms/index.html.erb_spec.rb create mode 100644 spec/views/pms/new.html.erb_spec.rb create mode 100644 spec/views/pms/show.html.erb_spec.rb create mode 100644 spec/views/servers/edit.html.erb_spec.rb create mode 100644 spec/views/servers/index.html.erb_spec.rb create mode 100644 spec/views/servers/new.html.erb_spec.rb create mode 100644 spec/views/servers/show.html.erb_spec.rb create mode 100644 spec/views/teams/edit.html.erb_spec.rb create mode 100644 spec/views/teams/index.html.erb_spec.rb create mode 100644 spec/views/teams/new.html.erb_spec.rb create mode 100644 spec/views/teams/show.html.erb_spec.rb create mode 100644 spec/views/tournaments/edit.html.erb_spec.rb create mode 100644 spec/views/tournaments/index.html.erb_spec.rb create mode 100644 spec/views/tournaments/new.html.erb_spec.rb create mode 100644 spec/views/tournaments/show.html.erb_spec.rb (limited to 'app/views') diff --git a/Gemfile.lock b/Gemfile.lock index 9de990e..9dd0199 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,11 +26,7 @@ GEM thread_safe (~> 0.1) tzinfo (~> 0.3.37) arel (4.0.2) -<<<<<<< HEAD atomic (1.1.15) -======= - atomic (1.1.14) ->>>>>>> 699bd065c06689a159c11ac3aacef6b34001617c bcrypt-ruby (3.1.2) bootstrap-sass (3.1.1.0) sass (~> 3.2) @@ -119,11 +115,7 @@ GEM multi_json (~> 1.0) rubyzip (< 1.0.0) websocket (~> 1.0.4) -<<<<<<< HEAD sprockets (2.11.0) -======= - sprockets (2.10.1) ->>>>>>> 699bd065c06689a159c11ac3aacef6b34001617c hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) diff --git a/app/assets/javascripts/alerts.js.coffee b/app/assets/javascripts/alerts.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/alerts.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/games.js.coffee b/app/assets/javascripts/games.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/games.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/main.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/matches.js.coffee b/app/assets/javascripts/matches.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/matches.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/pms.js.coffee b/app/assets/javascripts/pms.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/pms.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/search.js.coffee b/app/assets/javascripts/search.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/search.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/servers.js.coffee b/app/assets/javascripts/servers.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/servers.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/sessions.js.coffee b/app/assets/javascripts/sessions.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/sessions.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/static.js.coffee b/app/assets/javascripts/static.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/static.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/teams.js.coffee b/app/assets/javascripts/teams.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/teams.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/tournaments.js.coffee b/app/assets/javascripts/tournaments.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/tournaments.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/users.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/alerts.css.scss b/app/assets/stylesheets/alerts.css.scss new file mode 100644 index 0000000..c01a620 --- /dev/null +++ b/app/assets/stylesheets/alerts.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the alerts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/games.css.scss b/app/assets/stylesheets/games.css.scss new file mode 100644 index 0000000..db1b7bc --- /dev/null +++ b/app/assets/stylesheets/games.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the games controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/main.css.scss b/app/assets/stylesheets/main.css.scss new file mode 100644 index 0000000..a0d94c1 --- /dev/null +++ b/app/assets/stylesheets/main.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the main controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/matches.css.scss b/app/assets/stylesheets/matches.css.scss new file mode 100644 index 0000000..4c396e3 --- /dev/null +++ b/app/assets/stylesheets/matches.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the matches controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/pms.css.scss b/app/assets/stylesheets/pms.css.scss new file mode 100644 index 0000000..5106093 --- /dev/null +++ b/app/assets/stylesheets/pms.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the pms controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss new file mode 100644 index 0000000..6ec6a8f --- /dev/null +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -0,0 +1,69 @@ +body { + background-color: #fff; + color: #333; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; + &:visited { + color: #666; + } + &:hover { + color: #fff; + background-color: #000; + } +} + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px; + padding-bottom: 0; + margin-bottom: 20px; + background-color: #f0f0f0; + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + margin-bottom: 0px; + background-color: #c00; + color: #fff; + } + ul li { + font-size: 12px; + list-style: square; + } +} diff --git a/app/assets/stylesheets/search.css.scss b/app/assets/stylesheets/search.css.scss new file mode 100644 index 0000000..22fd394 --- /dev/null +++ b/app/assets/stylesheets/search.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the search controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/servers.css.scss b/app/assets/stylesheets/servers.css.scss new file mode 100644 index 0000000..4710386 --- /dev/null +++ b/app/assets/stylesheets/servers.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the servers controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/sessions.css.scss b/app/assets/stylesheets/sessions.css.scss new file mode 100644 index 0000000..ccb1ed2 --- /dev/null +++ b/app/assets/stylesheets/sessions.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Sessions controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/static.css.scss b/app/assets/stylesheets/static.css.scss new file mode 100644 index 0000000..5a803c8 --- /dev/null +++ b/app/assets/stylesheets/static.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the static controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/teams.css.scss b/app/assets/stylesheets/teams.css.scss new file mode 100644 index 0000000..320d00d --- /dev/null +++ b/app/assets/stylesheets/teams.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the teams controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/tournaments.css.scss b/app/assets/stylesheets/tournaments.css.scss new file mode 100644 index 0000000..e372b90 --- /dev/null +++ b/app/assets/stylesheets/tournaments.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the tournaments controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss new file mode 100644 index 0000000..1efc835 --- /dev/null +++ b/app/assets/stylesheets/users.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the users controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/alerts_controller.rb b/app/controllers/alerts_controller.rb new file mode 100644 index 0000000..873e9b7 --- /dev/null +++ b/app/controllers/alerts_controller.rb @@ -0,0 +1,74 @@ +class AlertsController < ApplicationController + before_action :set_alert, only: [:show, :edit, :update, :destroy] + + # GET /alerts + # GET /alerts.json + def index + @alerts = Alert.all + end + + # GET /alerts/1 + # GET /alerts/1.json + def show + end + + # GET /alerts/new + def new + @alert = Alert.new + end + + # GET /alerts/1/edit + def edit + end + + # POST /alerts + # POST /alerts.json + def create + @alert = Alert.new(alert_params) + + respond_to do |format| + if @alert.save + format.html { redirect_to @alert, notice: 'Alert was successfully created.' } + format.json { render action: 'show', status: :created, location: @alert } + else + format.html { render action: 'new' } + format.json { render json: @alert.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /alerts/1 + # PATCH/PUT /alerts/1.json + def update + respond_to do |format| + if @alert.update(alert_params) + format.html { redirect_to @alert, notice: 'Alert was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @alert.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /alerts/1 + # DELETE /alerts/1.json + def destroy + @alert.destroy + respond_to do |format| + format.html { redirect_to alerts_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_alert + @alert = Alert.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def alert_params + params.require(:alert).permit(:author_id, :message) + end +end diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb new file mode 100644 index 0000000..4ecff17 --- /dev/null +++ b/app/controllers/games_controller.rb @@ -0,0 +1,74 @@ +class GamesController < ApplicationController + before_action :set_game, only: [:show, :edit, :update, :destroy] + + # GET /games + # GET /games.json + def index + @games = Game.all + end + + # GET /games/1 + # GET /games/1.json + def show + end + + # GET /games/new + def new + @game = Game.new + end + + # GET /games/1/edit + def edit + end + + # POST /games + # POST /games.json + def create + @game = Game.new(game_params) + + respond_to do |format| + if @game.save + format.html { redirect_to @game, notice: 'Game was successfully created.' } + format.json { render action: 'show', status: :created, location: @game } + else + format.html { render action: 'new' } + format.json { render json: @game.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /games/1 + # PATCH/PUT /games/1.json + def update + respond_to do |format| + if @game.update(game_params) + format.html { redirect_to @game, notice: 'Game was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @game.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /games/1 + # DELETE /games/1.json + def destroy + @game.destroy + respond_to do |format| + format.html { redirect_to games_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_game + @game = Game.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def game_params + params.require(:game).permit(:name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams) + end +end diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb new file mode 100644 index 0000000..6519d7b --- /dev/null +++ b/app/controllers/main_controller.rb @@ -0,0 +1,2 @@ +class MainController < ApplicationController +end diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb new file mode 100644 index 0000000..e9f3c5a --- /dev/null +++ b/app/controllers/matches_controller.rb @@ -0,0 +1,74 @@ +class MatchesController < ApplicationController + before_action :set_match, only: [:show, :edit, :update, :destroy] + + # GET /matches + # GET /matches.json + def index + @matches = Match.all + end + + # GET /matches/1 + # GET /matches/1.json + def show + end + + # GET /matches/new + def new + @match = Match.new + end + + # GET /matches/1/edit + def edit + end + + # POST /matches + # POST /matches.json + def create + @match = Match.new(match_params) + + respond_to do |format| + if @match.save + format.html { redirect_to @match, notice: 'Match was successfully created.' } + format.json { render action: 'show', status: :created, location: @match } + else + format.html { render action: 'new' } + format.json { render json: @match.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /matches/1 + # PATCH/PUT /matches/1.json + def update + respond_to do |format| + if @match.update(match_params) + format.html { redirect_to @match, notice: 'Match was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @match.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /matches/1 + # DELETE /matches/1.json + def destroy + @match.destroy + respond_to do |format| + format.html { redirect_to matches_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_match + @match = Match.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def match_params + params.require(:match).permit(:tournament_id) + end +end diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb new file mode 100644 index 0000000..5dd0d69 --- /dev/null +++ b/app/controllers/pms_controller.rb @@ -0,0 +1,74 @@ +class PmsController < ApplicationController + before_action :set_pm, only: [:show, :edit, :update, :destroy] + + # GET /pms + # GET /pms.json + def index + @pms = Pm.all + end + + # GET /pms/1 + # GET /pms/1.json + def show + end + + # GET /pms/new + def new + @pm = Pm.new + end + + # GET /pms/1/edit + def edit + end + + # POST /pms + # POST /pms.json + def create + @pm = Pm.new(pm_params) + + respond_to do |format| + if @pm.save + format.html { redirect_to @pm, notice: 'Pm was successfully created.' } + format.json { render action: 'show', status: :created, location: @pm } + else + format.html { render action: 'new' } + format.json { render json: @pm.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /pms/1 + # PATCH/PUT /pms/1.json + def update + respond_to do |format| + if @pm.update(pm_params) + format.html { redirect_to @pm, notice: 'Pm was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @pm.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /pms/1 + # DELETE /pms/1.json + def destroy + @pm.destroy + respond_to do |format| + format.html { redirect_to pms_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_pm + @pm = Pm.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def pm_params + params.require(:pm).permit(:author_id, :recipient_id, :message) + end +end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb new file mode 100644 index 0000000..ee61487 --- /dev/null +++ b/app/controllers/search_controller.rb @@ -0,0 +1,2 @@ +class SearchController < ApplicationController +end diff --git a/app/controllers/servers_controller.rb b/app/controllers/servers_controller.rb new file mode 100644 index 0000000..7d54eb6 --- /dev/null +++ b/app/controllers/servers_controller.rb @@ -0,0 +1,74 @@ +class ServersController < ApplicationController + before_action :set_server, only: [:show, :edit, :update, :destroy] + + # GET /servers + # GET /servers.json + def index + @servers = Server.all + end + + # GET /servers/1 + # GET /servers/1.json + def show + end + + # GET /servers/new + def new + @server = Server.new + end + + # GET /servers/1/edit + def edit + end + + # POST /servers + # POST /servers.json + def create + @server = Server.new(server_params) + + respond_to do |format| + if @server.save + format.html { redirect_to @server, notice: 'Server was successfully created.' } + format.json { render action: 'show', status: :created, location: @server } + else + format.html { render action: 'new' } + format.json { render json: @server.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /servers/1 + # PATCH/PUT /servers/1.json + def update + respond_to do |format| + if @server.update(server_params) + format.html { redirect_to @server, notice: 'Server was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @server.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /servers/1 + # DELETE /servers/1.json + def destroy + @server.destroy + respond_to do |format| + format.html { redirect_to servers_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_server + @server = Server.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def server_params + params[:server] + end +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..16d11b5 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,2 @@ +class SessionsController < ApplicationController +end diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb new file mode 100644 index 0000000..c6df11e --- /dev/null +++ b/app/controllers/static_controller.rb @@ -0,0 +1,2 @@ +class StaticController < ApplicationController +end diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb new file mode 100644 index 0000000..f14c97f --- /dev/null +++ b/app/controllers/teams_controller.rb @@ -0,0 +1,74 @@ +class TeamsController < ApplicationController + before_action :set_team, only: [:show, :edit, :update, :destroy] + + # GET /teams + # GET /teams.json + def index + @teams = Team.all + end + + # GET /teams/1 + # GET /teams/1.json + def show + end + + # GET /teams/new + def new + @team = Team.new + end + + # GET /teams/1/edit + def edit + end + + # POST /teams + # POST /teams.json + def create + @team = Team.new(team_params) + + respond_to do |format| + if @team.save + format.html { redirect_to @team, notice: 'Team was successfully created.' } + format.json { render action: 'show', status: :created, location: @team } + else + format.html { render action: 'new' } + format.json { render json: @team.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /teams/1 + # PATCH/PUT /teams/1.json + def update + respond_to do |format| + if @team.update(team_params) + format.html { redirect_to @team, notice: 'Team was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @team.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /teams/1 + # DELETE /teams/1.json + def destroy + @team.destroy + respond_to do |format| + format.html { redirect_to teams_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_team + @team = Team.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def team_params + params[:team] + end +end diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb new file mode 100644 index 0000000..720305f --- /dev/null +++ b/app/controllers/tournaments_controller.rb @@ -0,0 +1,74 @@ +class TournamentsController < ApplicationController + before_action :set_tournament, only: [:show, :edit, :update, :destroy] + + # GET /tournaments + # GET /tournaments.json + def index + @tournaments = Tournament.all + end + + # GET /tournaments/1 + # GET /tournaments/1.json + def show + end + + # GET /tournaments/new + def new + @tournament = Tournament.new + end + + # GET /tournaments/1/edit + def edit + end + + # POST /tournaments + # POST /tournaments.json + def create + @tournament = Tournament.new(tournament_params) + + respond_to do |format| + if @tournament.save + format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' } + format.json { render action: 'show', status: :created, location: @tournament } + else + format.html { render action: 'new' } + format.json { render json: @tournament.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /tournaments/1 + # PATCH/PUT /tournaments/1.json + def update + respond_to do |format| + if @tournament.update(tournament_params) + format.html { redirect_to @tournament, notice: 'Tournament was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @tournament.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /tournaments/1 + # DELETE /tournaments/1.json + def destroy + @tournament.destroy + respond_to do |format| + format.html { redirect_to tournaments_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_tournament + @tournament = Tournament.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def tournament_params + params.require(:tournament).permit(:game_id) + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..3e74dea --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,2 @@ +class UsersController < ApplicationController +end diff --git a/app/helpers/alerts_helper.rb b/app/helpers/alerts_helper.rb new file mode 100644 index 0000000..20f5b50 --- /dev/null +++ b/app/helpers/alerts_helper.rb @@ -0,0 +1,2 @@ +module AlertsHelper +end diff --git a/app/helpers/games_helper.rb b/app/helpers/games_helper.rb new file mode 100644 index 0000000..2ef8c1f --- /dev/null +++ b/app/helpers/games_helper.rb @@ -0,0 +1,2 @@ +module GamesHelper +end diff --git a/app/helpers/main_helper.rb b/app/helpers/main_helper.rb new file mode 100644 index 0000000..826effe --- /dev/null +++ b/app/helpers/main_helper.rb @@ -0,0 +1,2 @@ +module MainHelper +end diff --git a/app/helpers/matches_helper.rb b/app/helpers/matches_helper.rb new file mode 100644 index 0000000..cc2ef83 --- /dev/null +++ b/app/helpers/matches_helper.rb @@ -0,0 +1,2 @@ +module MatchesHelper +end diff --git a/app/helpers/pms_helper.rb b/app/helpers/pms_helper.rb new file mode 100644 index 0000000..0188e59 --- /dev/null +++ b/app/helpers/pms_helper.rb @@ -0,0 +1,2 @@ +module PmsHelper +end diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb new file mode 100644 index 0000000..b3ce20a --- /dev/null +++ b/app/helpers/search_helper.rb @@ -0,0 +1,2 @@ +module SearchHelper +end diff --git a/app/helpers/servers_helper.rb b/app/helpers/servers_helper.rb new file mode 100644 index 0000000..a36fb17 --- /dev/null +++ b/app/helpers/servers_helper.rb @@ -0,0 +1,2 @@ +module ServersHelper +end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb new file mode 100644 index 0000000..309f8b2 --- /dev/null +++ b/app/helpers/sessions_helper.rb @@ -0,0 +1,2 @@ +module SessionsHelper +end diff --git a/app/helpers/static_helper.rb b/app/helpers/static_helper.rb new file mode 100644 index 0000000..8cfc9af --- /dev/null +++ b/app/helpers/static_helper.rb @@ -0,0 +1,2 @@ +module StaticHelper +end diff --git a/app/helpers/teams_helper.rb b/app/helpers/teams_helper.rb new file mode 100644 index 0000000..5fb41eb --- /dev/null +++ b/app/helpers/teams_helper.rb @@ -0,0 +1,2 @@ +module TeamsHelper +end diff --git a/app/helpers/tournaments_helper.rb b/app/helpers/tournaments_helper.rb new file mode 100644 index 0000000..2b6e27c --- /dev/null +++ b/app/helpers/tournaments_helper.rb @@ -0,0 +1,2 @@ +module TournamentsHelper +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/models/alert.rb b/app/models/alert.rb new file mode 100644 index 0000000..343c269 --- /dev/null +++ b/app/models/alert.rb @@ -0,0 +1,3 @@ +class Alert < ActiveRecord::Base + belongs_to :author +end diff --git a/app/models/game.rb b/app/models/game.rb new file mode 100644 index 0000000..a181c26 --- /dev/null +++ b/app/models/game.rb @@ -0,0 +1,2 @@ +class Game < ActiveRecord::Base +end diff --git a/app/models/game_attribute.rb b/app/models/game_attribute.rb new file mode 100644 index 0000000..c12723b --- /dev/null +++ b/app/models/game_attribute.rb @@ -0,0 +1,3 @@ +class GameAttribute < ActiveRecord::Base + belongs_to :game +end diff --git a/app/models/match.rb b/app/models/match.rb new file mode 100644 index 0000000..533435a --- /dev/null +++ b/app/models/match.rb @@ -0,0 +1,3 @@ +class Match < ActiveRecord::Base + belongs_to :tournament +end diff --git a/app/models/pm.rb b/app/models/pm.rb new file mode 100644 index 0000000..ab5af3b --- /dev/null +++ b/app/models/pm.rb @@ -0,0 +1,4 @@ +class Pm < ActiveRecord::Base + belongs_to :author + belongs_to :recipient +end diff --git a/app/models/server.rb b/app/models/server.rb new file mode 100644 index 0000000..120f0fa --- /dev/null +++ b/app/models/server.rb @@ -0,0 +1,2 @@ +class Server < ActiveRecord::Base +end diff --git a/app/models/server_settings.rb b/app/models/server_settings.rb new file mode 100644 index 0000000..7f49863 --- /dev/null +++ b/app/models/server_settings.rb @@ -0,0 +1,2 @@ +class ServerSettings < ActiveRecord::Base +end diff --git a/app/models/team.rb b/app/models/team.rb new file mode 100644 index 0000000..fa7ba9e --- /dev/null +++ b/app/models/team.rb @@ -0,0 +1,2 @@ +class Team < ActiveRecord::Base +end diff --git a/app/models/team_match_pair.rb b/app/models/team_match_pair.rb new file mode 100644 index 0000000..85f8eaa --- /dev/null +++ b/app/models/team_match_pair.rb @@ -0,0 +1,4 @@ +class TeamMatchPair < ActiveRecord::Base + belongs_to :team + belongs_to :match +end diff --git a/app/models/tournament.rb b/app/models/tournament.rb new file mode 100644 index 0000000..cc915a0 --- /dev/null +++ b/app/models/tournament.rb @@ -0,0 +1,3 @@ +class Tournament < ActiveRecord::Base + belongs_to :game +end diff --git a/app/models/tournament_option.rb b/app/models/tournament_option.rb new file mode 100644 index 0000000..950b351 --- /dev/null +++ b/app/models/tournament_option.rb @@ -0,0 +1,2 @@ +class TournamentOption < ActiveRecord::Base +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..4a57cf0 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,2 @@ +class User < ActiveRecord::Base +end diff --git a/app/models/user_team_pair.rb b/app/models/user_team_pair.rb new file mode 100644 index 0000000..c55dc2e --- /dev/null +++ b/app/models/user_team_pair.rb @@ -0,0 +1,4 @@ +class UserTeamPair < ActiveRecord::Base + belongs_to :user + belongs_to :team +end diff --git a/app/views/alerts/_form.html.erb b/app/views/alerts/_form.html.erb new file mode 100644 index 0000000..b60eaf2 --- /dev/null +++ b/app/views/alerts/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@alert) do |f| %> + <% if @alert.errors.any? %> +
+

<%= pluralize(@alert.errors.count, "error") %> prohibited this alert from being saved:

+ +
    + <% @alert.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :author_id %>
+ <%= f.text_field :author_id %> +
+
+ <%= f.label :message %>
+ <%= f.text_area :message %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/alerts/edit.html.erb b/app/views/alerts/edit.html.erb new file mode 100644 index 0000000..ad99164 --- /dev/null +++ b/app/views/alerts/edit.html.erb @@ -0,0 +1,6 @@ +

Editing alert

+ +<%= render 'form' %> + +<%= link_to 'Show', @alert %> | +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/index.html.erb b/app/views/alerts/index.html.erb new file mode 100644 index 0000000..458b951 --- /dev/null +++ b/app/views/alerts/index.html.erb @@ -0,0 +1,29 @@ +

Listing alerts

+ + + + + + + + + + + + + + <% @alerts.each do |alert| %> + + + + + + + + <% end %> + +
AuthorMessage
<%= alert.author %><%= alert.message %><%= link_to 'Show', alert %><%= link_to 'Edit', edit_alert_path(alert) %><%= link_to 'Destroy', alert, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Alert', new_alert_path %> diff --git a/app/views/alerts/index.json.jbuilder b/app/views/alerts/index.json.jbuilder new file mode 100644 index 0000000..0911a5c --- /dev/null +++ b/app/views/alerts/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@alerts) do |alert| + json.extract! alert, :id, :author_id, :message + json.url alert_url(alert, format: :json) +end diff --git a/app/views/alerts/new.html.erb b/app/views/alerts/new.html.erb new file mode 100644 index 0000000..6d04589 --- /dev/null +++ b/app/views/alerts/new.html.erb @@ -0,0 +1,5 @@ +

New alert

+ +<%= render 'form' %> + +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/show.html.erb b/app/views/alerts/show.html.erb new file mode 100644 index 0000000..eeab7f7 --- /dev/null +++ b/app/views/alerts/show.html.erb @@ -0,0 +1,14 @@ +

<%= notice %>

+ +

+ Author: + <%= @alert.author %> +

+ +

+ Message: + <%= @alert.message %> +

+ +<%= link_to 'Edit', edit_alert_path(@alert) %> | +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/show.json.jbuilder b/app/views/alerts/show.json.jbuilder new file mode 100644 index 0000000..95481eb --- /dev/null +++ b/app/views/alerts/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @alert, :id, :author_id, :message, :created_at, :updated_at diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb new file mode 100644 index 0000000..8941c59 --- /dev/null +++ b/app/views/games/_form.html.erb @@ -0,0 +1,37 @@ +<%= form_for(@game) do |f| %> + <% if @game.errors.any? %> +
+

<%= pluralize(@game.errors.count, "error") %> prohibited this game from being saved:

+ +
    + <% @game.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_area :name %> +
+
+ <%= f.label :players_per_team %>
+ <%= f.number_field :players_per_team %> +
+
+ <%= f.label :teams_per_match %>
+ <%= f.number_field :teams_per_match %> +
+
+ <%= f.label :set_rounds %>
+ <%= f.number_field :set_rounds %> +
+
+ <%= f.label :randomized_teams %>
+ <%= f.number_field :randomized_teams %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/games/edit.html.erb b/app/views/games/edit.html.erb new file mode 100644 index 0000000..d72bd2e --- /dev/null +++ b/app/views/games/edit.html.erb @@ -0,0 +1,6 @@ +

Editing game

+ +<%= render 'form' %> + +<%= link_to 'Show', @game %> | +<%= link_to 'Back', games_path %> diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb new file mode 100644 index 0000000..ccd0f63 --- /dev/null +++ b/app/views/games/index.html.erb @@ -0,0 +1,35 @@ +

Listing games

+ + + + + + + + + + + + + + + + + <% @games.each do |game| %> + + + + + + + + + + + <% end %> + +
NamePlayers per teamTeams per matchSet roundsRandomized teams
<%= game.name %><%= game.players_per_team %><%= game.teams_per_match %><%= game.set_rounds %><%= game.randomized_teams %><%= link_to 'Show', game %><%= link_to 'Edit', edit_game_path(game) %><%= link_to 'Destroy', game, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Game', new_game_path %> diff --git a/app/views/games/index.json.jbuilder b/app/views/games/index.json.jbuilder new file mode 100644 index 0000000..7e5c1a1 --- /dev/null +++ b/app/views/games/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@games) do |game| + json.extract! game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams + json.url game_url(game, format: :json) +end diff --git a/app/views/games/new.html.erb b/app/views/games/new.html.erb new file mode 100644 index 0000000..ab95f70 --- /dev/null +++ b/app/views/games/new.html.erb @@ -0,0 +1,5 @@ +

New game

+ +<%= render 'form' %> + +<%= link_to 'Back', games_path %> diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb new file mode 100644 index 0000000..7986016 --- /dev/null +++ b/app/views/games/show.html.erb @@ -0,0 +1,29 @@ +

<%= notice %>

+ +

+ Name: + <%= @game.name %> +

+ +

+ Players per team: + <%= @game.players_per_team %> +

+ +

+ Teams per match: + <%= @game.teams_per_match %> +

+ +

+ Set rounds: + <%= @game.set_rounds %> +

+ +

+ Randomized teams: + <%= @game.randomized_teams %> +

+ +<%= link_to 'Edit', edit_game_path(@game) %> | +<%= link_to 'Back', games_path %> diff --git a/app/views/games/show.json.jbuilder b/app/views/games/show.json.jbuilder new file mode 100644 index 0000000..1a2d0c7 --- /dev/null +++ b/app/views/games/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb new file mode 100644 index 0000000..34494c3 --- /dev/null +++ b/app/views/matches/_form.html.erb @@ -0,0 +1,21 @@ +<%= form_for(@match) do |f| %> + <% if @match.errors.any? %> +
+

<%= pluralize(@match.errors.count, "error") %> prohibited this match from being saved:

+ +
    + <% @match.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :tournament_id %>
+ <%= f.text_field :tournament_id %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/matches/edit.html.erb b/app/views/matches/edit.html.erb new file mode 100644 index 0000000..38b7d70 --- /dev/null +++ b/app/views/matches/edit.html.erb @@ -0,0 +1,6 @@ +

Editing match

+ +<%= render 'form' %> + +<%= link_to 'Show', @match %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb new file mode 100644 index 0000000..d8122ac --- /dev/null +++ b/app/views/matches/index.html.erb @@ -0,0 +1,27 @@ +

Listing matches

+ + + + + + + + + + + + + <% @matches.each do |match| %> + + + + + + + <% end %> + +
Tournament
<%= match.tournament %><%= link_to 'Show', match %><%= link_to 'Edit', edit_match_path(match) %><%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Match', new_match_path %> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder new file mode 100644 index 0000000..c8ada7a --- /dev/null +++ b/app/views/matches/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@matches) do |match| + json.extract! match, :id, :tournament_id + json.url match_url(match, format: :json) +end diff --git a/app/views/matches/new.html.erb b/app/views/matches/new.html.erb new file mode 100644 index 0000000..bd4c78c --- /dev/null +++ b/app/views/matches/new.html.erb @@ -0,0 +1,5 @@ +

New match

+ +<%= render 'form' %> + +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb new file mode 100644 index 0000000..7bab721 --- /dev/null +++ b/app/views/matches/show.html.erb @@ -0,0 +1,9 @@ +

<%= notice %>

+ +

+ Tournament: + <%= @match.tournament %> +

+ +<%= link_to 'Edit', edit_match_path(@match) %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder new file mode 100644 index 0000000..2e45395 --- /dev/null +++ b/app/views/matches/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @match, :id, :tournament_id, :created_at, :updated_at diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb new file mode 100644 index 0000000..480e308 --- /dev/null +++ b/app/views/pms/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@pm) do |f| %> + <% if @pm.errors.any? %> +
+

<%= pluralize(@pm.errors.count, "error") %> prohibited this pm from being saved:

+ +
    + <% @pm.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :author_id %>
+ <%= f.text_field :author_id %> +
+
+ <%= f.label :recipient_id %>
+ <%= f.text_field :recipient_id %> +
+
+ <%= f.label :message %>
+ <%= f.text_area :message %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/pms/edit.html.erb b/app/views/pms/edit.html.erb new file mode 100644 index 0000000..074a4fd --- /dev/null +++ b/app/views/pms/edit.html.erb @@ -0,0 +1,6 @@ +

Editing pm

+ +<%= render 'form' %> + +<%= link_to 'Show', @pm %> | +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb new file mode 100644 index 0000000..cb7fe4b --- /dev/null +++ b/app/views/pms/index.html.erb @@ -0,0 +1,31 @@ +

Listing pms

+ + + + + + + + + + + + + + + <% @pms.each do |pm| %> + + + + + + + + + <% end %> + +
AuthorRecipientMessage
<%= pm.author %><%= pm.recipient %><%= pm.message %><%= link_to 'Show', pm %><%= link_to 'Edit', edit_pm_path(pm) %><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Pm', new_pm_path %> diff --git a/app/views/pms/index.json.jbuilder b/app/views/pms/index.json.jbuilder new file mode 100644 index 0000000..fcfca84 --- /dev/null +++ b/app/views/pms/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@pms) do |pm| + json.extract! pm, :id, :author_id, :recipient_id, :message + json.url pm_url(pm, format: :json) +end diff --git a/app/views/pms/new.html.erb b/app/views/pms/new.html.erb new file mode 100644 index 0000000..29e24ec --- /dev/null +++ b/app/views/pms/new.html.erb @@ -0,0 +1,5 @@ +

New pm

+ +<%= render 'form' %> + +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb new file mode 100644 index 0000000..5ee483f --- /dev/null +++ b/app/views/pms/show.html.erb @@ -0,0 +1,19 @@ +

<%= notice %>

+ +

+ Author: + <%= @pm.author %> +

+ +

+ Recipient: + <%= @pm.recipient %> +

+ +

+ Message: + <%= @pm.message %> +

+ +<%= link_to 'Edit', edit_pm_path(@pm) %> | +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.json.jbuilder b/app/views/pms/show.json.jbuilder new file mode 100644 index 0000000..94252e9 --- /dev/null +++ b/app/views/pms/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @pm, :id, :author_id, :recipient_id, :message, :created_at, :updated_at diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb new file mode 100644 index 0000000..b08654b --- /dev/null +++ b/app/views/servers/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@server) do |f| %> + <% if @server.errors.any? %> +
+

<%= pluralize(@server.errors.count, "error") %> prohibited this server from being saved:

+ +
    + <% @server.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/servers/edit.html.erb b/app/views/servers/edit.html.erb new file mode 100644 index 0000000..a92cdb5 --- /dev/null +++ b/app/views/servers/edit.html.erb @@ -0,0 +1,6 @@ +

Editing server

+ +<%= render 'form' %> + +<%= link_to 'Show', @server %> | +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb new file mode 100644 index 0000000..f45d393 --- /dev/null +++ b/app/views/servers/index.html.erb @@ -0,0 +1,25 @@ +

Listing servers

+ + + + + + + + + + + + <% @servers.each do |server| %> + + + + + + <% end %> + +
<%= link_to 'Show', server %><%= link_to 'Edit', edit_server_path(server) %><%= link_to 'Destroy', server, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Server', new_server_path %> diff --git a/app/views/servers/index.json.jbuilder b/app/views/servers/index.json.jbuilder new file mode 100644 index 0000000..2776abc --- /dev/null +++ b/app/views/servers/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@servers) do |server| + json.extract! server, :id + json.url server_url(server, format: :json) +end diff --git a/app/views/servers/new.html.erb b/app/views/servers/new.html.erb new file mode 100644 index 0000000..0422009 --- /dev/null +++ b/app/views/servers/new.html.erb @@ -0,0 +1,5 @@ +

New server

+ +<%= render 'form' %> + +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb new file mode 100644 index 0000000..039cd8f --- /dev/null +++ b/app/views/servers/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_server_path(@server) %> | +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/show.json.jbuilder b/app/views/servers/show.json.jbuilder new file mode 100644 index 0000000..972b1c0 --- /dev/null +++ b/app/views/servers/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @server, :id, :created_at, :updated_at diff --git a/app/views/teams/_form.html.erb b/app/views/teams/_form.html.erb new file mode 100644 index 0000000..fd10129 --- /dev/null +++ b/app/views/teams/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@team) do |f| %> + <% if @team.errors.any? %> +
+

<%= pluralize(@team.errors.count, "error") %> prohibited this team from being saved:

+ +
    + <% @team.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/teams/edit.html.erb b/app/views/teams/edit.html.erb new file mode 100644 index 0000000..49858ad --- /dev/null +++ b/app/views/teams/edit.html.erb @@ -0,0 +1,6 @@ +

Editing team

+ +<%= render 'form' %> + +<%= link_to 'Show', @team %> | +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/index.html.erb b/app/views/teams/index.html.erb new file mode 100644 index 0000000..b077e10 --- /dev/null +++ b/app/views/teams/index.html.erb @@ -0,0 +1,25 @@ +

Listing teams

+ + + + + + + + + + + + <% @teams.each do |team| %> + + + + + + <% end %> + +
<%= link_to 'Show', team %><%= link_to 'Edit', edit_team_path(team) %><%= link_to 'Destroy', team, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Team', new_team_path %> diff --git a/app/views/teams/index.json.jbuilder b/app/views/teams/index.json.jbuilder new file mode 100644 index 0000000..b29428b --- /dev/null +++ b/app/views/teams/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@teams) do |team| + json.extract! team, :id + json.url team_url(team, format: :json) +end diff --git a/app/views/teams/new.html.erb b/app/views/teams/new.html.erb new file mode 100644 index 0000000..433d944 --- /dev/null +++ b/app/views/teams/new.html.erb @@ -0,0 +1,5 @@ +

New team

+ +<%= render 'form' %> + +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb new file mode 100644 index 0000000..5b18d33 --- /dev/null +++ b/app/views/teams/show.html.erb @@ -0,0 +1,4 @@ +

<%= notice %>

+ +<%= link_to 'Edit', edit_team_path(@team) %> | +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/show.json.jbuilder b/app/views/teams/show.json.jbuilder new file mode 100644 index 0000000..1538019 --- /dev/null +++ b/app/views/teams/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @team, :id, :created_at, :updated_at diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb new file mode 100644 index 0000000..1fd63e9 --- /dev/null +++ b/app/views/tournaments/_form.html.erb @@ -0,0 +1,21 @@ +<%= form_for(@tournament) do |f| %> + <% if @tournament.errors.any? %> +
+

<%= pluralize(@tournament.errors.count, "error") %> prohibited this tournament from being saved:

+ +
    + <% @tournament.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :game_id %>
+ <%= f.text_field :game_id %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/tournaments/edit.html.erb b/app/views/tournaments/edit.html.erb new file mode 100644 index 0000000..2913025 --- /dev/null +++ b/app/views/tournaments/edit.html.erb @@ -0,0 +1,6 @@ +

Editing tournament

+ +<%= render 'form' %> + +<%= link_to 'Show', @tournament %> | +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb new file mode 100644 index 0000000..ad2b7cf --- /dev/null +++ b/app/views/tournaments/index.html.erb @@ -0,0 +1,27 @@ +

Listing tournaments

+ + + + + + + + + + + + + <% @tournaments.each do |tournament| %> + + + + + + + <% end %> + +
Game
<%= tournament.game %><%= link_to 'Show', tournament %><%= link_to 'Edit', edit_tournament_path(tournament) %><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Tournament', new_tournament_path %> diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder new file mode 100644 index 0000000..e6f3b49 --- /dev/null +++ b/app/views/tournaments/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@tournaments) do |tournament| + json.extract! tournament, :id, :game_id + json.url tournament_url(tournament, format: :json) +end diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb new file mode 100644 index 0000000..2a60539 --- /dev/null +++ b/app/views/tournaments/new.html.erb @@ -0,0 +1,5 @@ +

New tournament

+ +<%= render 'form' %> + +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb new file mode 100644 index 0000000..30df788 --- /dev/null +++ b/app/views/tournaments/show.html.erb @@ -0,0 +1,9 @@ +

<%= notice %>

+ +

+ Game: + <%= @tournament.game %> +

+ +<%= link_to 'Edit', edit_tournament_path(@tournament) %> | +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder new file mode 100644 index 0000000..0fe65a6 --- /dev/null +++ b/app/views/tournaments/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @tournament, :id, :game_id, :created_at, :updated_at diff --git a/config/routes.rb b/config/routes.rb index 876667f..149c321 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,18 @@ Leaguer::Application.routes.draw do + resources :games + + resources :pms + + resources :alerts + + resources :teams + + resources :matches + + resources :tournaments + + resources :servers + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/db/migrate/20140304020217_create_servers.rb b/db/migrate/20140304020217_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304020217_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020219_create_tournaments.rb b/db/migrate/20140304020219_create_tournaments.rb new file mode 100644 index 0000000..36fcf7e --- /dev/null +++ b/db/migrate/20140304020219_create_tournaments.rb @@ -0,0 +1,9 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + t.references :game, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020221_create_matches.rb b/db/migrate/20140304020221_create_matches.rb new file mode 100644 index 0000000..6c0c157 --- /dev/null +++ b/db/migrate/20140304020221_create_matches.rb @@ -0,0 +1,9 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020224_create_teams.rb b/db/migrate/20140304020224_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304020224_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020230_create_users.rb b/db/migrate/20140304020230_create_users.rb new file mode 100644 index 0000000..f0986d4 --- /dev/null +++ b/db/migrate/20140304020230_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :user_name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020233_create_user_team_pairs.rb b/db/migrate/20140304020233_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304020233_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020235_create_team_match_pairs.rb b/db/migrate/20140304020235_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304020235_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020237_create_alerts.rb b/db/migrate/20140304020237_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304020237_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020239_create_pms.rb b/db/migrate/20140304020239_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304020239_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020242_create_games.rb b/db/migrate/20140304020242_create_games.rb new file mode 100644 index 0000000..59d4ef0 --- /dev/null +++ b/db/migrate/20140304020242_create_games.rb @@ -0,0 +1,13 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.text :name + t.integer :players_per_team + t.integer :teams_per_match + t.integer :set_rounds + t.integer :randomized_teams + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020244_create_game_attributes.rb b/db/migrate/20140304020244_create_game_attributes.rb new file mode 100644 index 0000000..b63f134 --- /dev/null +++ b/db/migrate/20140304020244_create_game_attributes.rb @@ -0,0 +1,11 @@ +class CreateGameAttributes < ActiveRecord::Migration + def change + create_table :game_attributes do |t| + t.references :game, index: true + t.text :key + t.integer :type + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020246_create_server_settings.rb b/db/migrate/20140304020246_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304020246_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020255_create_tournament_options.rb b/db/migrate/20140304020255_create_tournament_options.rb new file mode 100644 index 0000000..d2df22e --- /dev/null +++ b/db/migrate/20140304020255_create_tournament_options.rb @@ -0,0 +1,8 @@ +class CreateTournamentOptions < ActiveRecord::Migration + def change + create_table :tournament_options do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..016476d --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,120 @@ +# encoding: UTF-8 +# 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 that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20140304020255) do + + create_table "alerts", force: true do |t| + t.integer "author_id" + t.text "message" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "alerts", ["author_id"], name: "index_alerts_on_author_id" + + create_table "game_attributes", force: true do |t| + t.integer "game_id" + t.text "key" + t.integer "type" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "game_attributes", ["game_id"], name: "index_game_attributes_on_game_id" + + create_table "games", force: true do |t| + t.text "name" + t.integer "players_per_team" + t.integer "teams_per_match" + t.integer "set_rounds" + t.integer "randomized_teams" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "matches", force: true do |t| + t.integer "tournament_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "matches", ["tournament_id"], name: "index_matches_on_tournament_id" + + create_table "pms", force: true do |t| + t.integer "author_id" + t.integer "recipient_id" + t.text "message" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "pms", ["author_id"], name: "index_pms_on_author_id" + add_index "pms", ["recipient_id"], name: "index_pms_on_recipient_id" + + create_table "server_settings", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "servers", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "team_match_pairs", force: true do |t| + t.integer "team_id" + t.integer "match_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "team_match_pairs", ["match_id"], name: "index_team_match_pairs_on_match_id" + add_index "team_match_pairs", ["team_id"], name: "index_team_match_pairs_on_team_id" + + create_table "teams", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "tournament_options", force: true do |t| + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "tournaments", force: true do |t| + t.integer "game_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "tournaments", ["game_id"], name: "index_tournaments_on_game_id" + + create_table "user_team_pairs", force: true do |t| + t.integer "user_id" + t.integer "team_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "user_team_pairs", ["team_id"], name: "index_user_team_pairs_on_team_id" + add_index "user_team_pairs", ["user_id"], name: "index_user_team_pairs_on_user_id" + + create_table "users", force: true do |t| + t.string "name" + t.string "email" + t.string "user_name" + t.datetime "created_at" + t.datetime "updated_at" + end + +end diff --git a/generate.sh b/generate.sh index 807b9ef..7f70d56 100755 --- a/generate.sh +++ b/generate.sh @@ -18,6 +18,7 @@ bundle exec rails generate scaffold tournament game:references $NOTEST bundle exec rails generate scaffold match tournament:references $NOTEST bundle exec rails generate scaffold team $NOTEST bundle exec rails generate controller users $NOTEST +bundle exec rails generate controller Sessions bundle exec rails generate model user name:string email:string user_name:string $NOTEST bundle exec rails generate model user_team_pair user:references team:references $NOTEST bundle exec rails generate model team_match_pair team:references match:references $NOTEST diff --git a/spec/controllers/alerts_controller_spec.rb b/spec/controllers/alerts_controller_spec.rb new file mode 100644 index 0000000..82b031b --- /dev/null +++ b/spec/controllers/alerts_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe AlertsController do + + # This should return the minimal set of attributes required to create a valid + # Alert. As you add validations to Alert, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "author" => "" } } + + # 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 + # AlertsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all alerts as @alerts" do + alert = Alert.create! valid_attributes + get :index, {}, valid_session + assigns(:alerts).should eq([alert]) + end + end + + describe "GET show" do + it "assigns the requested alert as @alert" do + alert = Alert.create! valid_attributes + get :show, {:id => alert.to_param}, valid_session + assigns(:alert).should eq(alert) + end + end + + describe "GET new" do + it "assigns a new alert as @alert" do + get :new, {}, valid_session + assigns(:alert).should be_a_new(Alert) + end + end + + describe "GET edit" do + it "assigns the requested alert as @alert" do + alert = Alert.create! valid_attributes + get :edit, {:id => alert.to_param}, valid_session + assigns(:alert).should eq(alert) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Alert" do + expect { + post :create, {:alert => valid_attributes}, valid_session + }.to change(Alert, :count).by(1) + end + + it "assigns a newly created alert as @alert" do + post :create, {:alert => valid_attributes}, valid_session + assigns(:alert).should be_a(Alert) + assigns(:alert).should be_persisted + end + + it "redirects to the created alert" do + post :create, {:alert => valid_attributes}, valid_session + response.should redirect_to(Alert.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved alert as @alert" do + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + post :create, {:alert => { "author" => "invalid value" }}, valid_session + assigns(:alert).should be_a_new(Alert) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + post :create, {:alert => { "author" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested alert" do + alert = Alert.create! valid_attributes + # Assuming there are no other alerts in the database, this + # specifies that the Alert created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Alert.any_instance.should_receive(:update).with({ "author" => "" }) + put :update, {:id => alert.to_param, :alert => { "author" => "" }}, valid_session + end + + it "assigns the requested alert as @alert" do + alert = Alert.create! valid_attributes + put :update, {:id => alert.to_param, :alert => valid_attributes}, valid_session + assigns(:alert).should eq(alert) + end + + it "redirects to the alert" do + alert = Alert.create! valid_attributes + put :update, {:id => alert.to_param, :alert => valid_attributes}, valid_session + response.should redirect_to(alert) + end + end + + describe "with invalid params" do + it "assigns the alert as @alert" do + alert = Alert.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + put :update, {:id => alert.to_param, :alert => { "author" => "invalid value" }}, valid_session + assigns(:alert).should eq(alert) + end + + it "re-renders the 'edit' template" do + alert = Alert.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Alert.any_instance.stub(:save).and_return(false) + put :update, {:id => alert.to_param, :alert => { "author" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested alert" do + alert = Alert.create! valid_attributes + expect { + delete :destroy, {:id => alert.to_param}, valid_session + }.to change(Alert, :count).by(-1) + end + + it "redirects to the alerts list" do + alert = Alert.create! valid_attributes + delete :destroy, {:id => alert.to_param}, valid_session + response.should redirect_to(alerts_url) + end + end + +end diff --git a/spec/controllers/games_controller_spec.rb b/spec/controllers/games_controller_spec.rb new file mode 100644 index 0000000..ab8b6b2 --- /dev/null +++ b/spec/controllers/games_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe GamesController do + + # This should return the minimal set of attributes required to create a valid + # Game. As you add validations to Game, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "name" => "MyText" } } + + # 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 + # GamesController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all games as @games" do + game = Game.create! valid_attributes + get :index, {}, valid_session + assigns(:games).should eq([game]) + end + end + + describe "GET show" do + it "assigns the requested game as @game" do + game = Game.create! valid_attributes + get :show, {:id => game.to_param}, valid_session + assigns(:game).should eq(game) + end + end + + describe "GET new" do + it "assigns a new game as @game" do + get :new, {}, valid_session + assigns(:game).should be_a_new(Game) + end + end + + describe "GET edit" do + it "assigns the requested game as @game" do + game = Game.create! valid_attributes + get :edit, {:id => game.to_param}, valid_session + assigns(:game).should eq(game) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Game" do + expect { + post :create, {:game => valid_attributes}, valid_session + }.to change(Game, :count).by(1) + end + + it "assigns a newly created game as @game" do + post :create, {:game => valid_attributes}, valid_session + assigns(:game).should be_a(Game) + assigns(:game).should be_persisted + end + + it "redirects to the created game" do + post :create, {:game => valid_attributes}, valid_session + response.should redirect_to(Game.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved game as @game" do + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + post :create, {:game => { "name" => "invalid value" }}, valid_session + assigns(:game).should be_a_new(Game) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + post :create, {:game => { "name" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested game" do + game = Game.create! valid_attributes + # Assuming there are no other games in the database, this + # specifies that the Game created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Game.any_instance.should_receive(:update).with({ "name" => "MyText" }) + put :update, {:id => game.to_param, :game => { "name" => "MyText" }}, valid_session + end + + it "assigns the requested game as @game" do + game = Game.create! valid_attributes + put :update, {:id => game.to_param, :game => valid_attributes}, valid_session + assigns(:game).should eq(game) + end + + it "redirects to the game" do + game = Game.create! valid_attributes + put :update, {:id => game.to_param, :game => valid_attributes}, valid_session + response.should redirect_to(game) + end + end + + describe "with invalid params" do + it "assigns the game as @game" do + game = Game.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + put :update, {:id => game.to_param, :game => { "name" => "invalid value" }}, valid_session + assigns(:game).should eq(game) + end + + it "re-renders the 'edit' template" do + game = Game.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Game.any_instance.stub(:save).and_return(false) + put :update, {:id => game.to_param, :game => { "name" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested game" do + game = Game.create! valid_attributes + expect { + delete :destroy, {:id => game.to_param}, valid_session + }.to change(Game, :count).by(-1) + end + + it "redirects to the games list" do + game = Game.create! valid_attributes + delete :destroy, {:id => game.to_param}, valid_session + response.should redirect_to(games_url) + end + end + +end diff --git a/spec/controllers/main_controller_spec.rb b/spec/controllers/main_controller_spec.rb new file mode 100644 index 0000000..247e21d --- /dev/null +++ b/spec/controllers/main_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe MainController do + +end diff --git a/spec/controllers/matches_controller_spec.rb b/spec/controllers/matches_controller_spec.rb new file mode 100644 index 0000000..1f7adf8 --- /dev/null +++ b/spec/controllers/matches_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe MatchesController do + + # This should return the minimal set of attributes required to create a valid + # Match. As you add validations to Match, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "tournament" => "" } } + + # 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 + # MatchesController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all matches as @matches" do + match = Match.create! valid_attributes + get :index, {}, valid_session + assigns(:matches).should eq([match]) + end + end + + describe "GET show" do + it "assigns the requested match as @match" do + match = Match.create! valid_attributes + get :show, {:id => match.to_param}, valid_session + assigns(:match).should eq(match) + end + end + + describe "GET new" do + it "assigns a new match as @match" do + get :new, {}, valid_session + assigns(:match).should be_a_new(Match) + end + end + + describe "GET edit" do + it "assigns the requested match as @match" do + match = Match.create! valid_attributes + get :edit, {:id => match.to_param}, valid_session + assigns(:match).should eq(match) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Match" do + expect { + post :create, {:match => valid_attributes}, valid_session + }.to change(Match, :count).by(1) + end + + it "assigns a newly created match as @match" do + post :create, {:match => valid_attributes}, valid_session + assigns(:match).should be_a(Match) + assigns(:match).should be_persisted + end + + it "redirects to the created match" do + post :create, {:match => valid_attributes}, valid_session + response.should redirect_to(Match.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved match as @match" do + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + post :create, {:match => { "tournament" => "invalid value" }}, valid_session + assigns(:match).should be_a_new(Match) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + post :create, {:match => { "tournament" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested match" do + match = Match.create! valid_attributes + # Assuming there are no other matches in the database, this + # specifies that the Match created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Match.any_instance.should_receive(:update).with({ "tournament" => "" }) + put :update, {:id => match.to_param, :match => { "tournament" => "" }}, valid_session + end + + it "assigns the requested match as @match" do + match = Match.create! valid_attributes + put :update, {:id => match.to_param, :match => valid_attributes}, valid_session + assigns(:match).should eq(match) + end + + it "redirects to the match" do + match = Match.create! valid_attributes + put :update, {:id => match.to_param, :match => valid_attributes}, valid_session + response.should redirect_to(match) + end + end + + describe "with invalid params" do + it "assigns the match as @match" do + match = Match.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + put :update, {:id => match.to_param, :match => { "tournament" => "invalid value" }}, valid_session + assigns(:match).should eq(match) + end + + it "re-renders the 'edit' template" do + match = Match.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Match.any_instance.stub(:save).and_return(false) + put :update, {:id => match.to_param, :match => { "tournament" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested match" do + match = Match.create! valid_attributes + expect { + delete :destroy, {:id => match.to_param}, valid_session + }.to change(Match, :count).by(-1) + end + + it "redirects to the matches list" do + match = Match.create! valid_attributes + delete :destroy, {:id => match.to_param}, valid_session + response.should redirect_to(matches_url) + end + end + +end diff --git a/spec/controllers/pms_controller_spec.rb b/spec/controllers/pms_controller_spec.rb new file mode 100644 index 0000000..f0822db --- /dev/null +++ b/spec/controllers/pms_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe PmsController do + + # This should return the minimal set of attributes required to create a valid + # Pm. As you add validations to Pm, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "author" => "" } } + + # 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 + # PmsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all pms as @pms" do + pm = Pm.create! valid_attributes + get :index, {}, valid_session + assigns(:pms).should eq([pm]) + end + end + + describe "GET show" do + it "assigns the requested pm as @pm" do + pm = Pm.create! valid_attributes + get :show, {:id => pm.to_param}, valid_session + assigns(:pm).should eq(pm) + end + end + + describe "GET new" do + it "assigns a new pm as @pm" do + get :new, {}, valid_session + assigns(:pm).should be_a_new(Pm) + end + end + + describe "GET edit" do + it "assigns the requested pm as @pm" do + pm = Pm.create! valid_attributes + get :edit, {:id => pm.to_param}, valid_session + assigns(:pm).should eq(pm) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Pm" do + expect { + post :create, {:pm => valid_attributes}, valid_session + }.to change(Pm, :count).by(1) + end + + it "assigns a newly created pm as @pm" do + post :create, {:pm => valid_attributes}, valid_session + assigns(:pm).should be_a(Pm) + assigns(:pm).should be_persisted + end + + it "redirects to the created pm" do + post :create, {:pm => valid_attributes}, valid_session + response.should redirect_to(Pm.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved pm as @pm" do + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + post :create, {:pm => { "author" => "invalid value" }}, valid_session + assigns(:pm).should be_a_new(Pm) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + post :create, {:pm => { "author" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested pm" do + pm = Pm.create! valid_attributes + # Assuming there are no other pms in the database, this + # specifies that the Pm created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Pm.any_instance.should_receive(:update).with({ "author" => "" }) + put :update, {:id => pm.to_param, :pm => { "author" => "" }}, valid_session + end + + it "assigns the requested pm as @pm" do + pm = Pm.create! valid_attributes + put :update, {:id => pm.to_param, :pm => valid_attributes}, valid_session + assigns(:pm).should eq(pm) + end + + it "redirects to the pm" do + pm = Pm.create! valid_attributes + put :update, {:id => pm.to_param, :pm => valid_attributes}, valid_session + response.should redirect_to(pm) + end + end + + describe "with invalid params" do + it "assigns the pm as @pm" do + pm = Pm.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + put :update, {:id => pm.to_param, :pm => { "author" => "invalid value" }}, valid_session + assigns(:pm).should eq(pm) + end + + it "re-renders the 'edit' template" do + pm = Pm.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Pm.any_instance.stub(:save).and_return(false) + put :update, {:id => pm.to_param, :pm => { "author" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested pm" do + pm = Pm.create! valid_attributes + expect { + delete :destroy, {:id => pm.to_param}, valid_session + }.to change(Pm, :count).by(-1) + end + + it "redirects to the pms list" do + pm = Pm.create! valid_attributes + delete :destroy, {:id => pm.to_param}, valid_session + response.should redirect_to(pms_url) + end + end + +end diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb new file mode 100644 index 0000000..73248fb --- /dev/null +++ b/spec/controllers/search_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe SearchController do + +end diff --git a/spec/controllers/servers_controller_spec.rb b/spec/controllers/servers_controller_spec.rb new file mode 100644 index 0000000..c6f4fa6 --- /dev/null +++ b/spec/controllers/servers_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe ServersController do + + # This should return the minimal set of attributes required to create a valid + # Server. As you add validations to Server, be sure to + # adjust the attributes here as well. + let(: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 + # ServersController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all servers as @servers" do + server = Server.create! valid_attributes + get :index, {}, valid_session + assigns(:servers).should eq([server]) + end + end + + describe "GET show" do + it "assigns the requested server as @server" do + server = Server.create! valid_attributes + get :show, {:id => server.to_param}, valid_session + assigns(:server).should eq(server) + end + end + + describe "GET new" do + it "assigns a new server as @server" do + get :new, {}, valid_session + assigns(:server).should be_a_new(Server) + end + end + + describe "GET edit" do + it "assigns the requested server as @server" do + server = Server.create! valid_attributes + get :edit, {:id => server.to_param}, valid_session + assigns(:server).should eq(server) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Server" do + expect { + post :create, {:server => valid_attributes}, valid_session + }.to change(Server, :count).by(1) + end + + it "assigns a newly created server as @server" do + post :create, {:server => valid_attributes}, valid_session + assigns(:server).should be_a(Server) + assigns(:server).should be_persisted + end + + it "redirects to the created server" do + post :create, {:server => valid_attributes}, valid_session + response.should redirect_to(Server.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved server as @server" do + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + post :create, {:server => { }}, valid_session + assigns(:server).should be_a_new(Server) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + post :create, {:server => { }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested server" do + server = Server.create! valid_attributes + # Assuming there are no other servers in the database, this + # specifies that the Server created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Server.any_instance.should_receive(:update).with({ "these" => "params" }) + put :update, {:id => server.to_param, :server => { "these" => "params" }}, valid_session + end + + it "assigns the requested server as @server" do + server = Server.create! valid_attributes + put :update, {:id => server.to_param, :server => valid_attributes}, valid_session + assigns(:server).should eq(server) + end + + it "redirects to the server" do + server = Server.create! valid_attributes + put :update, {:id => server.to_param, :server => valid_attributes}, valid_session + response.should redirect_to(server) + end + end + + describe "with invalid params" do + it "assigns the server as @server" do + server = Server.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + put :update, {:id => server.to_param, :server => { }}, valid_session + assigns(:server).should eq(server) + end + + it "re-renders the 'edit' template" do + server = Server.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Server.any_instance.stub(:save).and_return(false) + put :update, {:id => server.to_param, :server => { }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested server" do + server = Server.create! valid_attributes + expect { + delete :destroy, {:id => server.to_param}, valid_session + }.to change(Server, :count).by(-1) + end + + it "redirects to the servers list" do + server = Server.create! valid_attributes + delete :destroy, {:id => server.to_param}, valid_session + response.should redirect_to(servers_url) + end + end + +end diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb new file mode 100644 index 0000000..702c559 --- /dev/null +++ b/spec/controllers/sessions_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe SessionsController do + +end diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb new file mode 100644 index 0000000..a3db7c0 --- /dev/null +++ b/spec/controllers/static_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe StaticController do + +end diff --git a/spec/controllers/teams_controller_spec.rb b/spec/controllers/teams_controller_spec.rb new file mode 100644 index 0000000..9c74d89 --- /dev/null +++ b/spec/controllers/teams_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe TeamsController do + + # This should return the minimal set of attributes required to create a valid + # Team. As you add validations to Team, be sure to + # adjust the attributes here as well. + let(: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 + # TeamsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all teams as @teams" do + team = Team.create! valid_attributes + get :index, {}, valid_session + assigns(:teams).should eq([team]) + end + end + + describe "GET show" do + it "assigns the requested team as @team" do + team = Team.create! valid_attributes + get :show, {:id => team.to_param}, valid_session + assigns(:team).should eq(team) + end + end + + describe "GET new" do + it "assigns a new team as @team" do + get :new, {}, valid_session + assigns(:team).should be_a_new(Team) + end + end + + describe "GET edit" do + it "assigns the requested team as @team" do + team = Team.create! valid_attributes + get :edit, {:id => team.to_param}, valid_session + assigns(:team).should eq(team) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Team" do + expect { + post :create, {:team => valid_attributes}, valid_session + }.to change(Team, :count).by(1) + end + + it "assigns a newly created team as @team" do + post :create, {:team => valid_attributes}, valid_session + assigns(:team).should be_a(Team) + assigns(:team).should be_persisted + end + + it "redirects to the created team" do + post :create, {:team => valid_attributes}, valid_session + response.should redirect_to(Team.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved team as @team" do + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + post :create, {:team => { }}, valid_session + assigns(:team).should be_a_new(Team) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + post :create, {:team => { }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested team" do + team = Team.create! valid_attributes + # Assuming there are no other teams in the database, this + # specifies that the Team created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Team.any_instance.should_receive(:update).with({ "these" => "params" }) + put :update, {:id => team.to_param, :team => { "these" => "params" }}, valid_session + end + + it "assigns the requested team as @team" do + team = Team.create! valid_attributes + put :update, {:id => team.to_param, :team => valid_attributes}, valid_session + assigns(:team).should eq(team) + end + + it "redirects to the team" do + team = Team.create! valid_attributes + put :update, {:id => team.to_param, :team => valid_attributes}, valid_session + response.should redirect_to(team) + end + end + + describe "with invalid params" do + it "assigns the team as @team" do + team = Team.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + put :update, {:id => team.to_param, :team => { }}, valid_session + assigns(:team).should eq(team) + end + + it "re-renders the 'edit' template" do + team = Team.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Team.any_instance.stub(:save).and_return(false) + put :update, {:id => team.to_param, :team => { }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested team" do + team = Team.create! valid_attributes + expect { + delete :destroy, {:id => team.to_param}, valid_session + }.to change(Team, :count).by(-1) + end + + it "redirects to the teams list" do + team = Team.create! valid_attributes + delete :destroy, {:id => team.to_param}, valid_session + response.should redirect_to(teams_url) + end + end + +end diff --git a/spec/controllers/tournaments_controller_spec.rb b/spec/controllers/tournaments_controller_spec.rb new file mode 100644 index 0000000..f7b6e19 --- /dev/null +++ b/spec/controllers/tournaments_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe TournamentsController do + + # This should return the minimal set of attributes required to create a valid + # Tournament. As you add validations to Tournament, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "game" => "" } } + + # 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 + # TournamentsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all tournaments as @tournaments" do + tournament = Tournament.create! valid_attributes + get :index, {}, valid_session + assigns(:tournaments).should eq([tournament]) + end + end + + describe "GET show" do + it "assigns the requested tournament as @tournament" do + tournament = Tournament.create! valid_attributes + get :show, {:id => tournament.to_param}, valid_session + assigns(:tournament).should eq(tournament) + end + end + + describe "GET new" do + it "assigns a new tournament as @tournament" do + get :new, {}, valid_session + assigns(:tournament).should be_a_new(Tournament) + end + end + + describe "GET edit" do + it "assigns the requested tournament as @tournament" do + tournament = Tournament.create! valid_attributes + get :edit, {:id => tournament.to_param}, valid_session + assigns(:tournament).should eq(tournament) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Tournament" do + expect { + post :create, {:tournament => valid_attributes}, valid_session + }.to change(Tournament, :count).by(1) + end + + it "assigns a newly created tournament as @tournament" do + post :create, {:tournament => valid_attributes}, valid_session + assigns(:tournament).should be_a(Tournament) + assigns(:tournament).should be_persisted + end + + it "redirects to the created tournament" do + post :create, {:tournament => valid_attributes}, valid_session + response.should redirect_to(Tournament.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved tournament as @tournament" do + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + post :create, {:tournament => { "game" => "invalid value" }}, valid_session + assigns(:tournament).should be_a_new(Tournament) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + post :create, {:tournament => { "game" => "invalid value" }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested tournament" do + tournament = Tournament.create! valid_attributes + # Assuming there are no other tournaments in the database, this + # specifies that the Tournament created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Tournament.any_instance.should_receive(:update).with({ "game" => "" }) + put :update, {:id => tournament.to_param, :tournament => { "game" => "" }}, valid_session + end + + it "assigns the requested tournament as @tournament" do + tournament = Tournament.create! valid_attributes + put :update, {:id => tournament.to_param, :tournament => valid_attributes}, valid_session + assigns(:tournament).should eq(tournament) + end + + it "redirects to the tournament" do + tournament = Tournament.create! valid_attributes + put :update, {:id => tournament.to_param, :tournament => valid_attributes}, valid_session + response.should redirect_to(tournament) + end + end + + describe "with invalid params" do + it "assigns the tournament as @tournament" do + tournament = Tournament.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + put :update, {:id => tournament.to_param, :tournament => { "game" => "invalid value" }}, valid_session + assigns(:tournament).should eq(tournament) + end + + it "re-renders the 'edit' template" do + tournament = Tournament.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tournament.any_instance.stub(:save).and_return(false) + put :update, {:id => tournament.to_param, :tournament => { "game" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested tournament" do + tournament = Tournament.create! valid_attributes + expect { + delete :destroy, {:id => tournament.to_param}, valid_session + }.to change(Tournament, :count).by(-1) + end + + it "redirects to the tournaments list" do + tournament = Tournament.create! valid_attributes + delete :destroy, {:id => tournament.to_param}, valid_session + response.should redirect_to(tournaments_url) + end + end + +end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb new file mode 100644 index 0000000..142455c --- /dev/null +++ b/spec/controllers/users_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe UsersController do + +end diff --git a/spec/helpers/alerts_helper_spec.rb b/spec/helpers/alerts_helper_spec.rb new file mode 100644 index 0000000..812e415 --- /dev/null +++ b/spec/helpers/alerts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the AlertsHelper. For example: +# +# describe AlertsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe AlertsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/games_helper_spec.rb b/spec/helpers/games_helper_spec.rb new file mode 100644 index 0000000..72addeb --- /dev/null +++ b/spec/helpers/games_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the GamesHelper. For example: +# +# describe GamesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe GamesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/main_helper_spec.rb b/spec/helpers/main_helper_spec.rb new file mode 100644 index 0000000..9d316c5 --- /dev/null +++ b/spec/helpers/main_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MainHelper. For example: +# +# describe MainHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MainHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/matches_helper_spec.rb b/spec/helpers/matches_helper_spec.rb new file mode 100644 index 0000000..271cd00 --- /dev/null +++ b/spec/helpers/matches_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MatchesHelper. For example: +# +# describe MatchesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MatchesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/pms_helper_spec.rb b/spec/helpers/pms_helper_spec.rb new file mode 100644 index 0000000..5ebf709 --- /dev/null +++ b/spec/helpers/pms_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the PmsHelper. For example: +# +# describe PmsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe PmsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb new file mode 100644 index 0000000..fabfe99 --- /dev/null +++ b/spec/helpers/search_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the SearchHelper. For example: +# +# describe SearchHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe SearchHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/servers_helper_spec.rb b/spec/helpers/servers_helper_spec.rb new file mode 100644 index 0000000..487d1e4 --- /dev/null +++ b/spec/helpers/servers_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ServersHelper. For example: +# +# describe ServersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe ServersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/sessions_helper_spec.rb b/spec/helpers/sessions_helper_spec.rb new file mode 100644 index 0000000..c14cfa5 --- /dev/null +++ b/spec/helpers/sessions_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the SessionsHelper. For example: +# +# describe SessionsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe SessionsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/static_helper_spec.rb b/spec/helpers/static_helper_spec.rb new file mode 100644 index 0000000..6a1bf5c --- /dev/null +++ b/spec/helpers/static_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the StaticHelper. For example: +# +# describe StaticHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe StaticHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/teams_helper_spec.rb b/spec/helpers/teams_helper_spec.rb new file mode 100644 index 0000000..9572616 --- /dev/null +++ b/spec/helpers/teams_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TeamsHelper. For example: +# +# describe TeamsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TeamsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/tournaments_helper_spec.rb b/spec/helpers/tournaments_helper_spec.rb new file mode 100644 index 0000000..c7eb224 --- /dev/null +++ b/spec/helpers/tournaments_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TournamentsHelper. For example: +# +# describe TournamentsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TournamentsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb new file mode 100644 index 0000000..e65fff9 --- /dev/null +++ b/spec/helpers/users_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the UsersHelper. For example: +# +# describe UsersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe UsersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/alert_spec.rb b/spec/models/alert_spec.rb new file mode 100644 index 0000000..d7fa4af --- /dev/null +++ b/spec/models/alert_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Alert do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/game_attribute_spec.rb b/spec/models/game_attribute_spec.rb new file mode 100644 index 0000000..200e59b --- /dev/null +++ b/spec/models/game_attribute_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe GameAttribute do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/game_spec.rb b/spec/models/game_spec.rb new file mode 100644 index 0000000..8c56446 --- /dev/null +++ b/spec/models/game_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Game do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/match_spec.rb b/spec/models/match_spec.rb new file mode 100644 index 0000000..86931c9 --- /dev/null +++ b/spec/models/match_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Match do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/pm_spec.rb b/spec/models/pm_spec.rb new file mode 100644 index 0000000..d56845b --- /dev/null +++ b/spec/models/pm_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Pm do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/server_settings_spec.rb b/spec/models/server_settings_spec.rb new file mode 100644 index 0000000..d579746 --- /dev/null +++ b/spec/models/server_settings_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe ServerSettings do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/server_spec.rb b/spec/models/server_spec.rb new file mode 100644 index 0000000..646344a --- /dev/null +++ b/spec/models/server_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Server do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/team_match_pair_spec.rb b/spec/models/team_match_pair_spec.rb new file mode 100644 index 0000000..676c563 --- /dev/null +++ b/spec/models/team_match_pair_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe TeamMatchPair do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb new file mode 100644 index 0000000..666a904 --- /dev/null +++ b/spec/models/team_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Team do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/tournament_option_spec.rb b/spec/models/tournament_option_spec.rb new file mode 100644 index 0000000..501b316 --- /dev/null +++ b/spec/models/tournament_option_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe TournamentOption do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/tournament_spec.rb b/spec/models/tournament_spec.rb new file mode 100644 index 0000000..56c919d --- /dev/null +++ b/spec/models/tournament_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Tournament do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..44032b4 --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe User do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_team_pair_spec.rb b/spec/models/user_team_pair_spec.rb new file mode 100644 index 0000000..9947368 --- /dev/null +++ b/spec/models/user_team_pair_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe UserTeamPair do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/alerts_spec.rb b/spec/requests/alerts_spec.rb new file mode 100644 index 0000000..03c332a --- /dev/null +++ b/spec/requests/alerts_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Alerts" do + describe "GET /alerts" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get alerts_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/games_spec.rb b/spec/requests/games_spec.rb new file mode 100644 index 0000000..1a84608 --- /dev/null +++ b/spec/requests/games_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Games" do + describe "GET /games" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get games_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/matches_spec.rb b/spec/requests/matches_spec.rb new file mode 100644 index 0000000..250f746 --- /dev/null +++ b/spec/requests/matches_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Matches" do + describe "GET /matches" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get matches_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/pms_spec.rb b/spec/requests/pms_spec.rb new file mode 100644 index 0000000..1862b87 --- /dev/null +++ b/spec/requests/pms_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Pms" do + describe "GET /pms" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get pms_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/servers_spec.rb b/spec/requests/servers_spec.rb new file mode 100644 index 0000000..2a1562e --- /dev/null +++ b/spec/requests/servers_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Servers" do + describe "GET /servers" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get servers_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/teams_spec.rb b/spec/requests/teams_spec.rb new file mode 100644 index 0000000..f0caf7a --- /dev/null +++ b/spec/requests/teams_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Teams" do + describe "GET /teams" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get teams_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/tournaments_spec.rb b/spec/requests/tournaments_spec.rb new file mode 100644 index 0000000..09b4b55 --- /dev/null +++ b/spec/requests/tournaments_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Tournaments" do + describe "GET /tournaments" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get tournaments_path + response.status.should be(200) + end + end +end diff --git a/spec/routing/alerts_routing_spec.rb b/spec/routing/alerts_routing_spec.rb new file mode 100644 index 0000000..9485907 --- /dev/null +++ b/spec/routing/alerts_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe AlertsController do + describe "routing" do + + it "routes to #index" do + get("/alerts").should route_to("alerts#index") + end + + it "routes to #new" do + get("/alerts/new").should route_to("alerts#new") + end + + it "routes to #show" do + get("/alerts/1").should route_to("alerts#show", :id => "1") + end + + it "routes to #edit" do + get("/alerts/1/edit").should route_to("alerts#edit", :id => "1") + end + + it "routes to #create" do + post("/alerts").should route_to("alerts#create") + end + + it "routes to #update" do + put("/alerts/1").should route_to("alerts#update", :id => "1") + end + + it "routes to #destroy" do + delete("/alerts/1").should route_to("alerts#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/games_routing_spec.rb b/spec/routing/games_routing_spec.rb new file mode 100644 index 0000000..3b3ec0c --- /dev/null +++ b/spec/routing/games_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe GamesController do + describe "routing" do + + it "routes to #index" do + get("/games").should route_to("games#index") + end + + it "routes to #new" do + get("/games/new").should route_to("games#new") + end + + it "routes to #show" do + get("/games/1").should route_to("games#show", :id => "1") + end + + it "routes to #edit" do + get("/games/1/edit").should route_to("games#edit", :id => "1") + end + + it "routes to #create" do + post("/games").should route_to("games#create") + end + + it "routes to #update" do + put("/games/1").should route_to("games#update", :id => "1") + end + + it "routes to #destroy" do + delete("/games/1").should route_to("games#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/matches_routing_spec.rb b/spec/routing/matches_routing_spec.rb new file mode 100644 index 0000000..a9f8254 --- /dev/null +++ b/spec/routing/matches_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe MatchesController do + describe "routing" do + + it "routes to #index" do + get("/matches").should route_to("matches#index") + end + + it "routes to #new" do + get("/matches/new").should route_to("matches#new") + end + + it "routes to #show" do + get("/matches/1").should route_to("matches#show", :id => "1") + end + + it "routes to #edit" do + get("/matches/1/edit").should route_to("matches#edit", :id => "1") + end + + it "routes to #create" do + post("/matches").should route_to("matches#create") + end + + it "routes to #update" do + put("/matches/1").should route_to("matches#update", :id => "1") + end + + it "routes to #destroy" do + delete("/matches/1").should route_to("matches#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/pms_routing_spec.rb b/spec/routing/pms_routing_spec.rb new file mode 100644 index 0000000..839b0a9 --- /dev/null +++ b/spec/routing/pms_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe PmsController do + describe "routing" do + + it "routes to #index" do + get("/pms").should route_to("pms#index") + end + + it "routes to #new" do + get("/pms/new").should route_to("pms#new") + end + + it "routes to #show" do + get("/pms/1").should route_to("pms#show", :id => "1") + end + + it "routes to #edit" do + get("/pms/1/edit").should route_to("pms#edit", :id => "1") + end + + it "routes to #create" do + post("/pms").should route_to("pms#create") + end + + it "routes to #update" do + put("/pms/1").should route_to("pms#update", :id => "1") + end + + it "routes to #destroy" do + delete("/pms/1").should route_to("pms#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/servers_routing_spec.rb b/spec/routing/servers_routing_spec.rb new file mode 100644 index 0000000..e514d15 --- /dev/null +++ b/spec/routing/servers_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe ServersController do + describe "routing" do + + it "routes to #index" do + get("/servers").should route_to("servers#index") + end + + it "routes to #new" do + get("/servers/new").should route_to("servers#new") + end + + it "routes to #show" do + get("/servers/1").should route_to("servers#show", :id => "1") + end + + it "routes to #edit" do + get("/servers/1/edit").should route_to("servers#edit", :id => "1") + end + + it "routes to #create" do + post("/servers").should route_to("servers#create") + end + + it "routes to #update" do + put("/servers/1").should route_to("servers#update", :id => "1") + end + + it "routes to #destroy" do + delete("/servers/1").should route_to("servers#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/teams_routing_spec.rb b/spec/routing/teams_routing_spec.rb new file mode 100644 index 0000000..818fa7b --- /dev/null +++ b/spec/routing/teams_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe TeamsController do + describe "routing" do + + it "routes to #index" do + get("/teams").should route_to("teams#index") + end + + it "routes to #new" do + get("/teams/new").should route_to("teams#new") + end + + it "routes to #show" do + get("/teams/1").should route_to("teams#show", :id => "1") + end + + it "routes to #edit" do + get("/teams/1/edit").should route_to("teams#edit", :id => "1") + end + + it "routes to #create" do + post("/teams").should route_to("teams#create") + end + + it "routes to #update" do + put("/teams/1").should route_to("teams#update", :id => "1") + end + + it "routes to #destroy" do + delete("/teams/1").should route_to("teams#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/tournaments_routing_spec.rb b/spec/routing/tournaments_routing_spec.rb new file mode 100644 index 0000000..e4a229c --- /dev/null +++ b/spec/routing/tournaments_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe TournamentsController do + describe "routing" do + + it "routes to #index" do + get("/tournaments").should route_to("tournaments#index") + end + + it "routes to #new" do + get("/tournaments/new").should route_to("tournaments#new") + end + + it "routes to #show" do + get("/tournaments/1").should route_to("tournaments#show", :id => "1") + end + + it "routes to #edit" do + get("/tournaments/1/edit").should route_to("tournaments#edit", :id => "1") + end + + it "routes to #create" do + post("/tournaments").should route_to("tournaments#create") + end + + it "routes to #update" do + put("/tournaments/1").should route_to("tournaments#update", :id => "1") + end + + it "routes to #destroy" do + delete("/tournaments/1").should route_to("tournaments#destroy", :id => "1") + end + + end +end diff --git a/spec/views/alerts/edit.html.erb_spec.rb b/spec/views/alerts/edit.html.erb_spec.rb new file mode 100644 index 0000000..d837f26 --- /dev/null +++ b/spec/views/alerts/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "alerts/edit" do + before(:each) do + @alert = assign(:alert, stub_model(Alert, + :author => nil, + :message => "MyText" + )) + end + + it "renders the edit alert form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", alert_path(@alert), "post" do + assert_select "input#alert_author[name=?]", "alert[author]" + assert_select "textarea#alert_message[name=?]", "alert[message]" + end + end +end diff --git a/spec/views/alerts/index.html.erb_spec.rb b/spec/views/alerts/index.html.erb_spec.rb new file mode 100644 index 0000000..a5b4f3c --- /dev/null +++ b/spec/views/alerts/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "alerts/index" do + before(:each) do + assign(:alerts, [ + stub_model(Alert, + :author => nil, + :message => "MyText" + ), + stub_model(Alert, + :author => nil, + :message => "MyText" + ) + ]) + end + + it "renders a list of alerts" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/alerts/new.html.erb_spec.rb b/spec/views/alerts/new.html.erb_spec.rb new file mode 100644 index 0000000..e38cbd3 --- /dev/null +++ b/spec/views/alerts/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "alerts/new" do + before(:each) do + assign(:alert, stub_model(Alert, + :author => nil, + :message => "MyText" + ).as_new_record) + end + + it "renders new alert form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", alerts_path, "post" do + assert_select "input#alert_author[name=?]", "alert[author]" + assert_select "textarea#alert_message[name=?]", "alert[message]" + end + end +end diff --git a/spec/views/alerts/show.html.erb_spec.rb b/spec/views/alerts/show.html.erb_spec.rb new file mode 100644 index 0000000..267c9f1 --- /dev/null +++ b/spec/views/alerts/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "alerts/show" do + before(:each) do + @alert = assign(:alert, stub_model(Alert, + :author => nil, + :message => "MyText" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/games/edit.html.erb_spec.rb b/spec/views/games/edit.html.erb_spec.rb new file mode 100644 index 0000000..d568c90 --- /dev/null +++ b/spec/views/games/edit.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "games/edit" do + before(:each) do + @game = assign(:game, stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 1, + :set_rounds => 1, + :randomized_teams => 1 + )) + end + + it "renders the edit game form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", game_path(@game), "post" do + assert_select "textarea#game_name[name=?]", "game[name]" + assert_select "input#game_players_per_team[name=?]", "game[players_per_team]" + assert_select "input#game_teams_per_match[name=?]", "game[teams_per_match]" + assert_select "input#game_set_rounds[name=?]", "game[set_rounds]" + assert_select "input#game_randomized_teams[name=?]", "game[randomized_teams]" + end + end +end diff --git a/spec/views/games/index.html.erb_spec.rb b/spec/views/games/index.html.erb_spec.rb new file mode 100644 index 0000000..3107393 --- /dev/null +++ b/spec/views/games/index.html.erb_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe "games/index" do + before(:each) do + assign(:games, [ + stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 2, + :set_rounds => 3, + :randomized_teams => 4 + ), + stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 2, + :set_rounds => 3, + :randomized_teams => 4 + ) + ]) + end + + it "renders a list of games" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + assert_select "tr>td", :text => 1.to_s, :count => 2 + assert_select "tr>td", :text => 2.to_s, :count => 2 + assert_select "tr>td", :text => 3.to_s, :count => 2 + assert_select "tr>td", :text => 4.to_s, :count => 2 + end +end diff --git a/spec/views/games/new.html.erb_spec.rb b/spec/views/games/new.html.erb_spec.rb new file mode 100644 index 0000000..ebe6113 --- /dev/null +++ b/spec/views/games/new.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "games/new" do + before(:each) do + assign(:game, stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 1, + :set_rounds => 1, + :randomized_teams => 1 + ).as_new_record) + end + + it "renders new game form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", games_path, "post" do + assert_select "textarea#game_name[name=?]", "game[name]" + assert_select "input#game_players_per_team[name=?]", "game[players_per_team]" + assert_select "input#game_teams_per_match[name=?]", "game[teams_per_match]" + assert_select "input#game_set_rounds[name=?]", "game[set_rounds]" + assert_select "input#game_randomized_teams[name=?]", "game[randomized_teams]" + end + end +end diff --git a/spec/views/games/show.html.erb_spec.rb b/spec/views/games/show.html.erb_spec.rb new file mode 100644 index 0000000..fb75ad6 --- /dev/null +++ b/spec/views/games/show.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "games/show" do + before(:each) do + @game = assign(:game, stub_model(Game, + :name => "MyText", + :players_per_team => 1, + :teams_per_match => 2, + :set_rounds => 3, + :randomized_teams => 4 + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/MyText/) + rendered.should match(/1/) + rendered.should match(/2/) + rendered.should match(/3/) + rendered.should match(/4/) + end +end diff --git a/spec/views/matches/edit.html.erb_spec.rb b/spec/views/matches/edit.html.erb_spec.rb new file mode 100644 index 0000000..0f7c673 --- /dev/null +++ b/spec/views/matches/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "matches/edit" do + before(:each) do + @match = assign(:match, stub_model(Match, + :tournament => nil + )) + end + + it "renders the edit match form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", match_path(@match), "post" do + assert_select "input#match_tournament[name=?]", "match[tournament]" + end + end +end diff --git a/spec/views/matches/index.html.erb_spec.rb b/spec/views/matches/index.html.erb_spec.rb new file mode 100644 index 0000000..e920f16 --- /dev/null +++ b/spec/views/matches/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "matches/index" do + before(:each) do + assign(:matches, [ + stub_model(Match, + :tournament => nil + ), + stub_model(Match, + :tournament => nil + ) + ]) + end + + it "renders a list of matches" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + end +end diff --git a/spec/views/matches/new.html.erb_spec.rb b/spec/views/matches/new.html.erb_spec.rb new file mode 100644 index 0000000..c3537dc --- /dev/null +++ b/spec/views/matches/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "matches/new" do + before(:each) do + assign(:match, stub_model(Match, + :tournament => nil + ).as_new_record) + end + + it "renders new match form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", matches_path, "post" do + assert_select "input#match_tournament[name=?]", "match[tournament]" + end + end +end diff --git a/spec/views/matches/show.html.erb_spec.rb b/spec/views/matches/show.html.erb_spec.rb new file mode 100644 index 0000000..4460feb --- /dev/null +++ b/spec/views/matches/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "matches/show" do + before(:each) do + @match = assign(:match, stub_model(Match, + :tournament => nil + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + end +end diff --git a/spec/views/pms/edit.html.erb_spec.rb b/spec/views/pms/edit.html.erb_spec.rb new file mode 100644 index 0000000..5ec0de5 --- /dev/null +++ b/spec/views/pms/edit.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "pms/edit" do + before(:each) do + @pm = assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + )) + end + + it "renders the edit pm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", pm_path(@pm), "post" do + assert_select "input#pm_author[name=?]", "pm[author]" + assert_select "input#pm_recipient[name=?]", "pm[recipient]" + assert_select "textarea#pm_message[name=?]", "pm[message]" + end + end +end diff --git a/spec/views/pms/index.html.erb_spec.rb b/spec/views/pms/index.html.erb_spec.rb new file mode 100644 index 0000000..a3bc733 --- /dev/null +++ b/spec/views/pms/index.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "pms/index" do + before(:each) do + assign(:pms, [ + stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ), + stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ) + ]) + end + + it "renders a list of pms" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/pms/new.html.erb_spec.rb b/spec/views/pms/new.html.erb_spec.rb new file mode 100644 index 0000000..342af96 --- /dev/null +++ b/spec/views/pms/new.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "pms/new" do + before(:each) do + assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + ).as_new_record) + end + + it "renders new pm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", pms_path, "post" do + assert_select "input#pm_author[name=?]", "pm[author]" + assert_select "input#pm_recipient[name=?]", "pm[recipient]" + assert_select "textarea#pm_message[name=?]", "pm[message]" + end + end +end diff --git a/spec/views/pms/show.html.erb_spec.rb b/spec/views/pms/show.html.erb_spec.rb new file mode 100644 index 0000000..5802887 --- /dev/null +++ b/spec/views/pms/show.html.erb_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe "pms/show" do + before(:each) do + @pm = assign(:pm, stub_model(Pm, + :author => nil, + :recipient => nil, + :message => "MyText" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + rendered.should match(//) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/servers/edit.html.erb_spec.rb b/spec/views/servers/edit.html.erb_spec.rb new file mode 100644 index 0000000..870126c --- /dev/null +++ b/spec/views/servers/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "servers/edit" do + before(:each) do + @server = assign(:server, stub_model(Server)) + end + + it "renders the edit server form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", server_path(@server), "post" do + end + end +end diff --git a/spec/views/servers/index.html.erb_spec.rb b/spec/views/servers/index.html.erb_spec.rb new file mode 100644 index 0000000..9af4a19 --- /dev/null +++ b/spec/views/servers/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "servers/index" do + before(:each) do + assign(:servers, [ + stub_model(Server), + stub_model(Server) + ]) + end + + it "renders a list of servers" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/servers/new.html.erb_spec.rb b/spec/views/servers/new.html.erb_spec.rb new file mode 100644 index 0000000..bfc69c5 --- /dev/null +++ b/spec/views/servers/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "servers/new" do + before(:each) do + assign(:server, stub_model(Server).as_new_record) + end + + it "renders new server form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", servers_path, "post" do + end + end +end diff --git a/spec/views/servers/show.html.erb_spec.rb b/spec/views/servers/show.html.erb_spec.rb new file mode 100644 index 0000000..3762389 --- /dev/null +++ b/spec/views/servers/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "servers/show" do + before(:each) do + @server = assign(:server, stub_model(Server)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/teams/edit.html.erb_spec.rb b/spec/views/teams/edit.html.erb_spec.rb new file mode 100644 index 0000000..1153b6d --- /dev/null +++ b/spec/views/teams/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "teams/edit" do + before(:each) do + @team = assign(:team, stub_model(Team)) + end + + it "renders the edit team form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", team_path(@team), "post" do + end + end +end diff --git a/spec/views/teams/index.html.erb_spec.rb b/spec/views/teams/index.html.erb_spec.rb new file mode 100644 index 0000000..e894f36 --- /dev/null +++ b/spec/views/teams/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "teams/index" do + before(:each) do + assign(:teams, [ + stub_model(Team), + stub_model(Team) + ]) + end + + it "renders a list of teams" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/teams/new.html.erb_spec.rb b/spec/views/teams/new.html.erb_spec.rb new file mode 100644 index 0000000..6a05475 --- /dev/null +++ b/spec/views/teams/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "teams/new" do + before(:each) do + assign(:team, stub_model(Team).as_new_record) + end + + it "renders new team form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", teams_path, "post" do + end + end +end diff --git a/spec/views/teams/show.html.erb_spec.rb b/spec/views/teams/show.html.erb_spec.rb new file mode 100644 index 0000000..1d8ebd5 --- /dev/null +++ b/spec/views/teams/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "teams/show" do + before(:each) do + @team = assign(:team, stub_model(Team)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/tournaments/edit.html.erb_spec.rb b/spec/views/tournaments/edit.html.erb_spec.rb new file mode 100644 index 0000000..db7cbb5 --- /dev/null +++ b/spec/views/tournaments/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "tournaments/edit" do + before(:each) do + @tournament = assign(:tournament, stub_model(Tournament, + :game => nil + )) + end + + it "renders the edit tournament form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", tournament_path(@tournament), "post" do + assert_select "input#tournament_game[name=?]", "tournament[game]" + end + end +end diff --git a/spec/views/tournaments/index.html.erb_spec.rb b/spec/views/tournaments/index.html.erb_spec.rb new file mode 100644 index 0000000..bf36e06 --- /dev/null +++ b/spec/views/tournaments/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "tournaments/index" do + before(:each) do + assign(:tournaments, [ + stub_model(Tournament, + :game => nil + ), + stub_model(Tournament, + :game => nil + ) + ]) + end + + it "renders a list of tournaments" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => nil.to_s, :count => 2 + end +end diff --git a/spec/views/tournaments/new.html.erb_spec.rb b/spec/views/tournaments/new.html.erb_spec.rb new file mode 100644 index 0000000..49785a4 --- /dev/null +++ b/spec/views/tournaments/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "tournaments/new" do + before(:each) do + assign(:tournament, stub_model(Tournament, + :game => nil + ).as_new_record) + end + + it "renders new tournament form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", tournaments_path, "post" do + assert_select "input#tournament_game[name=?]", "tournament[game]" + end + end +end diff --git a/spec/views/tournaments/show.html.erb_spec.rb b/spec/views/tournaments/show.html.erb_spec.rb new file mode 100644 index 0000000..abb1879 --- /dev/null +++ b/spec/views/tournaments/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tournaments/show" do + before(:each) do + @tournament = assign(:tournament, stub_model(Tournament, + :game => nil + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + end +end -- cgit v1.2.3-54-g00ecf From fefe3f469243d6c932c256cc8798bae35e4ff1c4 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Sun, 2 Mar 2014 21:10:49 -0500 Subject: Added Tournament Name. --- app/controllers/matches_controller.rb | 2 +- app/views/matches/_form.html.erb | 4 ++++ app/views/matches/index.html.erb | 2 ++ app/views/matches/index.json.jbuilder | 2 +- app/views/matches/show.html.erb | 5 +++++ app/views/matches/show.json.jbuilder | 2 +- db/migrate/20140304020531_create_servers.rb | 8 -------- db/migrate/20140304020533_create_tournaments.rb | 9 --------- db/migrate/20140304020536_create_matches.rb | 9 --------- db/migrate/20140304020538_create_teams.rb | 8 -------- db/migrate/20140304020545_create_users.rb | 11 ----------- db/migrate/20140304020547_create_user_team_pairs.rb | 10 ---------- db/migrate/20140304020549_create_team_match_pairs.rb | 10 ---------- db/migrate/20140304020551_create_alerts.rb | 10 ---------- db/migrate/20140304020554_create_pms.rb | 11 ----------- db/migrate/20140304020556_create_games.rb | 13 ------------- db/migrate/20140304020558_create_game_attributes.rb | 11 ----------- db/migrate/20140304020601_create_server_settings.rb | 8 -------- db/migrate/20140304020609_create_tournament_options.rb | 8 -------- db/migrate/20140304020709_create_servers.rb | 8 ++++++++ db/migrate/20140304020711_create_tournaments.rb | 9 +++++++++ db/migrate/20140304020713_create_matches.rb | 10 ++++++++++ db/migrate/20140304020716_create_teams.rb | 8 ++++++++ db/migrate/20140304020722_create_users.rb | 11 +++++++++++ db/migrate/20140304020724_create_user_team_pairs.rb | 10 ++++++++++ db/migrate/20140304020727_create_team_match_pairs.rb | 10 ++++++++++ db/migrate/20140304020729_create_alerts.rb | 10 ++++++++++ db/migrate/20140304020731_create_pms.rb | 11 +++++++++++ db/migrate/20140304020733_create_games.rb | 13 +++++++++++++ db/migrate/20140304020736_create_game_attributes.rb | 11 +++++++++++ db/migrate/20140304020738_create_server_settings.rb | 8 ++++++++ db/migrate/20140304020747_create_tournament_options.rb | 8 ++++++++ db/schema.rb | 3 ++- generate.sh | 2 +- spec/views/matches/edit.html.erb_spec.rb | 4 +++- spec/views/matches/index.html.erb_spec.rb | 7 +++++-- spec/views/matches/new.html.erb_spec.rb | 4 +++- spec/views/matches/show.html.erb_spec.rb | 4 +++- 38 files changed, 158 insertions(+), 136 deletions(-) delete mode 100644 db/migrate/20140304020531_create_servers.rb delete mode 100644 db/migrate/20140304020533_create_tournaments.rb delete mode 100644 db/migrate/20140304020536_create_matches.rb delete mode 100644 db/migrate/20140304020538_create_teams.rb delete mode 100644 db/migrate/20140304020545_create_users.rb delete mode 100644 db/migrate/20140304020547_create_user_team_pairs.rb delete mode 100644 db/migrate/20140304020549_create_team_match_pairs.rb delete mode 100644 db/migrate/20140304020551_create_alerts.rb delete mode 100644 db/migrate/20140304020554_create_pms.rb delete mode 100644 db/migrate/20140304020556_create_games.rb delete mode 100644 db/migrate/20140304020558_create_game_attributes.rb delete mode 100644 db/migrate/20140304020601_create_server_settings.rb delete mode 100644 db/migrate/20140304020609_create_tournament_options.rb create mode 100644 db/migrate/20140304020709_create_servers.rb create mode 100644 db/migrate/20140304020711_create_tournaments.rb create mode 100644 db/migrate/20140304020713_create_matches.rb create mode 100644 db/migrate/20140304020716_create_teams.rb create mode 100644 db/migrate/20140304020722_create_users.rb create mode 100644 db/migrate/20140304020724_create_user_team_pairs.rb create mode 100644 db/migrate/20140304020727_create_team_match_pairs.rb create mode 100644 db/migrate/20140304020729_create_alerts.rb create mode 100644 db/migrate/20140304020731_create_pms.rb create mode 100644 db/migrate/20140304020733_create_games.rb create mode 100644 db/migrate/20140304020736_create_game_attributes.rb create mode 100644 db/migrate/20140304020738_create_server_settings.rb create mode 100644 db/migrate/20140304020747_create_tournament_options.rb (limited to 'app/views') diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index e9f3c5a..984be3f 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -69,6 +69,6 @@ class MatchesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def match_params - params.require(:match).permit(:tournament_id) + params.require(:match).permit(:tournament_id, :name) end end diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index 34494c3..c5f1ba8 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -15,6 +15,10 @@ <%= f.label :tournament_id %>
<%= f.text_field :tournament_id %> +

+ <%= f.label :name %>
+ <%= f.text_field :name %> +
<%= f.submit %>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index d8122ac..0742770 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -4,6 +4,7 @@ Tournament + Name @@ -14,6 +15,7 @@ <% @matches.each do |match| %> <%= match.tournament %> + <%= match.name %> <%= link_to 'Show', match %> <%= link_to 'Edit', edit_match_path(match) %> <%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder index c8ada7a..08ae0ef 100644 --- a/app/views/matches/index.json.jbuilder +++ b/app/views/matches/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@matches) do |match| - json.extract! match, :id, :tournament_id + json.extract! match, :id, :tournament_id, :name json.url match_url(match, format: :json) end diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 7bab721..0b02ae7 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -5,5 +5,10 @@ <%= @match.tournament %>

+

+ Name: + <%= @match.name %> +

+ <%= link_to 'Edit', edit_match_path(@match) %> | <%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder index 2e45395..128550f 100644 --- a/app/views/matches/show.json.jbuilder +++ b/app/views/matches/show.json.jbuilder @@ -1 +1 @@ -json.extract! @match, :id, :tournament_id, :created_at, :updated_at +json.extract! @match, :id, :tournament_id, :name, :created_at, :updated_at diff --git a/db/migrate/20140304020531_create_servers.rb b/db/migrate/20140304020531_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304020531_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020533_create_tournaments.rb b/db/migrate/20140304020533_create_tournaments.rb deleted file mode 100644 index 36fcf7e..0000000 --- a/db/migrate/20140304020533_create_tournaments.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - t.references :game, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020536_create_matches.rb b/db/migrate/20140304020536_create_matches.rb deleted file mode 100644 index 6c0c157..0000000 --- a/db/migrate/20140304020536_create_matches.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.references :tournament, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020538_create_teams.rb b/db/migrate/20140304020538_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304020538_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020545_create_users.rb b/db/migrate/20140304020545_create_users.rb deleted file mode 100644 index f0986d4..0000000 --- a/db/migrate/20140304020545_create_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.string :name - t.string :email - t.string :user_name - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020547_create_user_team_pairs.rb b/db/migrate/20140304020547_create_user_team_pairs.rb deleted file mode 100644 index 2c492ac..0000000 --- a/db/migrate/20140304020547_create_user_team_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUserTeamPairs < ActiveRecord::Migration - def change - create_table :user_team_pairs do |t| - t.references :user, index: true - t.references :team, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020549_create_team_match_pairs.rb b/db/migrate/20140304020549_create_team_match_pairs.rb deleted file mode 100644 index 8fac07e..0000000 --- a/db/migrate/20140304020549_create_team_match_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTeamMatchPairs < ActiveRecord::Migration - def change - create_table :team_match_pairs do |t| - t.references :team, index: true - t.references :match, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020551_create_alerts.rb b/db/migrate/20140304020551_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140304020551_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.references :author, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020554_create_pms.rb b/db/migrate/20140304020554_create_pms.rb deleted file mode 100644 index 93bb5c6..0000000 --- a/db/migrate/20140304020554_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.references :author, index: true - t.references :recipient, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020556_create_games.rb b/db/migrate/20140304020556_create_games.rb deleted file mode 100644 index 59d4ef0..0000000 --- a/db/migrate/20140304020556_create_games.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateGames < ActiveRecord::Migration - def change - create_table :games do |t| - t.text :name - t.integer :players_per_team - t.integer :teams_per_match - t.integer :set_rounds - t.integer :randomized_teams - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020558_create_game_attributes.rb b/db/migrate/20140304020558_create_game_attributes.rb deleted file mode 100644 index b63f134..0000000 --- a/db/migrate/20140304020558_create_game_attributes.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateGameAttributes < ActiveRecord::Migration - def change - create_table :game_attributes do |t| - t.references :game, index: true - t.text :key - t.integer :type - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020601_create_server_settings.rb b/db/migrate/20140304020601_create_server_settings.rb deleted file mode 100644 index dfdd91b..0000000 --- a/db/migrate/20140304020601_create_server_settings.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServerSettings < ActiveRecord::Migration - def change - create_table :server_settings do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020609_create_tournament_options.rb b/db/migrate/20140304020609_create_tournament_options.rb deleted file mode 100644 index d2df22e..0000000 --- a/db/migrate/20140304020609_create_tournament_options.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentOptions < ActiveRecord::Migration - def change - create_table :tournament_options do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304020709_create_servers.rb b/db/migrate/20140304020709_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304020709_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020711_create_tournaments.rb b/db/migrate/20140304020711_create_tournaments.rb new file mode 100644 index 0000000..36fcf7e --- /dev/null +++ b/db/migrate/20140304020711_create_tournaments.rb @@ -0,0 +1,9 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + t.references :game, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020713_create_matches.rb b/db/migrate/20140304020713_create_matches.rb new file mode 100644 index 0000000..325863d --- /dev/null +++ b/db/migrate/20140304020713_create_matches.rb @@ -0,0 +1,10 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020716_create_teams.rb b/db/migrate/20140304020716_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304020716_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020722_create_users.rb b/db/migrate/20140304020722_create_users.rb new file mode 100644 index 0000000..f0986d4 --- /dev/null +++ b/db/migrate/20140304020722_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :user_name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020724_create_user_team_pairs.rb b/db/migrate/20140304020724_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304020724_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020727_create_team_match_pairs.rb b/db/migrate/20140304020727_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304020727_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020729_create_alerts.rb b/db/migrate/20140304020729_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304020729_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020731_create_pms.rb b/db/migrate/20140304020731_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304020731_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020733_create_games.rb b/db/migrate/20140304020733_create_games.rb new file mode 100644 index 0000000..59d4ef0 --- /dev/null +++ b/db/migrate/20140304020733_create_games.rb @@ -0,0 +1,13 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.text :name + t.integer :players_per_team + t.integer :teams_per_match + t.integer :set_rounds + t.integer :randomized_teams + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020736_create_game_attributes.rb b/db/migrate/20140304020736_create_game_attributes.rb new file mode 100644 index 0000000..b63f134 --- /dev/null +++ b/db/migrate/20140304020736_create_game_attributes.rb @@ -0,0 +1,11 @@ +class CreateGameAttributes < ActiveRecord::Migration + def change + create_table :game_attributes do |t| + t.references :game, index: true + t.text :key + t.integer :type + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020738_create_server_settings.rb b/db/migrate/20140304020738_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304020738_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304020747_create_tournament_options.rb b/db/migrate/20140304020747_create_tournament_options.rb new file mode 100644 index 0000000..d2df22e --- /dev/null +++ b/db/migrate/20140304020747_create_tournament_options.rb @@ -0,0 +1,8 @@ +class CreateTournamentOptions < ActiveRecord::Migration + def change + create_table :tournament_options do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 847a686..9069230 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140304020609) do +ActiveRecord::Schema.define(version: 20140304020747) do create_table "alerts", force: true do |t| t.integer "author_id" @@ -44,6 +44,7 @@ ActiveRecord::Schema.define(version: 20140304020609) do create_table "matches", force: true do |t| t.integer "tournament_id" + t.string "name" t.datetime "created_at" t.datetime "updated_at" end diff --git a/generate.sh b/generate.sh index ea96b9b..336ea5b 100755 --- a/generate.sh +++ b/generate.sh @@ -15,7 +15,7 @@ NOTEST='--skip-test-unit' set -x bundle exec rails generate scaffold server --force $NOTEST bundle exec rails generate scaffold tournament game:references --force $NOTEST -bundle exec rails generate scaffold match tournament:references --force $NOTEST +bundle exec rails generate scaffold match tournament:references name:string --force $NOTEST bundle exec rails generate scaffold team $NOTEST bundle exec rails generate controller users $NOTEST bundle exec rails generate controller Sessions diff --git a/spec/views/matches/edit.html.erb_spec.rb b/spec/views/matches/edit.html.erb_spec.rb index 0f7c673..fca468f 100644 --- a/spec/views/matches/edit.html.erb_spec.rb +++ b/spec/views/matches/edit.html.erb_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' describe "matches/edit" do before(:each) do @match = assign(:match, stub_model(Match, - :tournament => nil + :tournament => nil, + :name => "MyString" )) end @@ -13,6 +14,7 @@ describe "matches/edit" do # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "form[action=?][method=?]", match_path(@match), "post" do assert_select "input#match_tournament[name=?]", "match[tournament]" + assert_select "input#match_name[name=?]", "match[name]" end end end diff --git a/spec/views/matches/index.html.erb_spec.rb b/spec/views/matches/index.html.erb_spec.rb index e920f16..d3be1b5 100644 --- a/spec/views/matches/index.html.erb_spec.rb +++ b/spec/views/matches/index.html.erb_spec.rb @@ -4,10 +4,12 @@ describe "matches/index" do before(:each) do assign(:matches, [ stub_model(Match, - :tournament => nil + :tournament => nil, + :name => "Name" ), stub_model(Match, - :tournament => nil + :tournament => nil, + :name => "Name" ) ]) end @@ -16,5 +18,6 @@ describe "matches/index" do render # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "tr>td", :text => nil.to_s, :count => 2 + assert_select "tr>td", :text => "Name".to_s, :count => 2 end end diff --git a/spec/views/matches/new.html.erb_spec.rb b/spec/views/matches/new.html.erb_spec.rb index c3537dc..4423d2c 100644 --- a/spec/views/matches/new.html.erb_spec.rb +++ b/spec/views/matches/new.html.erb_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' describe "matches/new" do before(:each) do assign(:match, stub_model(Match, - :tournament => nil + :tournament => nil, + :name => "MyString" ).as_new_record) end @@ -13,6 +14,7 @@ describe "matches/new" do # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "form[action=?][method=?]", matches_path, "post" do assert_select "input#match_tournament[name=?]", "match[tournament]" + assert_select "input#match_name[name=?]", "match[name]" end end end diff --git a/spec/views/matches/show.html.erb_spec.rb b/spec/views/matches/show.html.erb_spec.rb index 4460feb..642119d 100644 --- a/spec/views/matches/show.html.erb_spec.rb +++ b/spec/views/matches/show.html.erb_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' describe "matches/show" do before(:each) do @match = assign(:match, stub_model(Match, - :tournament => nil + :tournament => nil, + :name => "Name" )) end @@ -11,5 +12,6 @@ describe "matches/show" do render # Run the generator again with the --webrat flag if you want to use webrat matchers rendered.should match(//) + rendered.should match(/Name/) end end -- cgit v1.2.3-54-g00ecf From d8ce62fa89705ff9d93d28c3ce626ce9268a01af Mon Sep 17 00:00:00 2001 From: Tomer Kimia Date: Mon, 3 Mar 2014 20:46:18 -0500 Subject: signed in people see a link to make a new tournament --- app/views/static/homepage.html.erb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/views') diff --git a/app/views/static/homepage.html.erb b/app/views/static/homepage.html.erb index 5887d5f..8b96e11 100644 --- a/app/views/static/homepage.html.erb +++ b/app/views/static/homepage.html.erb @@ -7,8 +7,11 @@ <% if !signed_in? %> <%= link_to 'Log In', "/signin", :class => "btn btn-warning btn-lg", :role => "button" %> <%= link_to 'Sign Up', "/signup", :class => "btn btn-warning btn-lg", :role => "button" %> + <% else %> + <%= link_to 'Start a Tournament', new_tournament_path, :class => "btn btn-warning btn-lg", :role => "button" %> <% end %> <%= link_to 'See Ongoing Tournaments', tournaments_path, :class => "btn btn-warning btn-lg", :role => "button" %> +

-- cgit v1.2.3-54-g00ecf From 661dbaf902d770dfbefa9ba1d9e4c28fc7abf891 Mon Sep 17 00:00:00 2001 From: Tomer Kimia Date: Mon, 3 Mar 2014 21:49:38 -0500 Subject: small things --- app/assets/stylesheets/scaffolds.css.scss | 1 - app/controllers/sessions_controller.rb | 17 ++++++++++------- app/views/sessions/new.html.erb | 4 +++- app/views/users/index.html.erb | 4 +++- 4 files changed, 16 insertions(+), 10 deletions(-) (limited to 'app/views') diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss index dc22c99..f4c3040 100644 --- a/app/assets/stylesheets/scaffolds.css.scss +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -29,7 +29,6 @@ a { } &:hover { color: #000; - font-weight:bold; text-decoration: none; } } diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 68cb949..3417332 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,22 +1,25 @@ class SessionsController < ApplicationController def new + if @user.nil? + @user = User.new + end end # find the user and create a new session def create - user = User.find_by(email: params[:session][:email].downcase) - if user && user.authenticate(params[:session][:password]) - sign_in user + @user = User.find_by(email: params[:session][:email].downcase) + if @user && @user.authenticate(params[:session][:password]) + sign_in @user redirect_to root_path else - render 'new' - end + redirect_to signin_path + end end def destroy - sign_out - redirect_to root_path + sign_out + redirect_to root_path end end diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index f942cf6..2e7a0d3 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,5 +1,7 @@

Sign in

- +<% if @fail %> +

Email and password combination not found

+<% end %>
<%= form_for(:session, url: sessions_path) do |f| %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index c128661..d92da4d 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -3,6 +3,7 @@ + @@ -14,7 +15,8 @@ <% @users.each do |user| %> - + + -- cgit v1.2.3-54-g00ecf From 423d0e5a440d8d66407522bc842ef273196173bc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 3 Mar 2014 22:20:02 -0500 Subject: run ./generate.sh --- app/assets/stylesheets/sessions.css.scss | 2 +- app/controllers/users_controller.rb | 72 ++++++++++ app/views/users/_form.html.erb | 29 ++++ app/views/users/edit.html.erb | 6 + app/views/users/index.html.erb | 31 ++++ app/views/users/index.json.jbuilder | 4 + app/views/users/new.html.erb | 5 + app/views/users/show.html.erb | 19 +++ app/views/users/show.json.jbuilder | 1 + config/routes.rb | 2 + db/migrate/20140304021249_create_servers.rb | 8 -- db/migrate/20140304021251_create_tournaments.rb | 9 -- db/migrate/20140304021254_create_matches.rb | 10 -- db/migrate/20140304021256_create_teams.rb | 8 -- db/migrate/20140304021258_create_alerts.rb | 10 -- db/migrate/20140304021301_create_pms.rb | 11 -- db/migrate/20140304021303_create_games.rb | 13 -- .../20140304021306_create_game_attributes.rb | 11 -- .../20140304021308_create_server_settings.rb | 8 -- db/migrate/20140304021310_create_users.rb | 11 -- .../20140304021312_create_user_team_pairs.rb | 10 -- .../20140304021314_create_team_match_pairs.rb | 10 -- .../20140304021327_create_tournament_options.rb | 8 -- db/migrate/20140304031800_create_servers.rb | 8 ++ db/migrate/20140304031802_create_tournaments.rb | 9 ++ db/migrate/20140304031804_create_matches.rb | 10 ++ db/migrate/20140304031806_create_teams.rb | 8 ++ db/migrate/20140304031808_create_alerts.rb | 10 ++ db/migrate/20140304031810_create_pms.rb | 11 ++ db/migrate/20140304031813_create_games.rb | 13 ++ db/migrate/20140304031815_create_users.rb | 11 ++ .../20140304031817_create_game_attributes.rb | 11 ++ .../20140304031819_create_server_settings.rb | 8 ++ .../20140304031821_create_user_team_pairs.rb | 10 ++ .../20140304031823_create_team_match_pairs.rb | 10 ++ .../20140304031834_create_tournament_options.rb | 8 ++ db/schema.rb | 2 +- spec/controllers/alerts_controller_spec.rb | 160 --------------------- spec/controllers/games_controller_spec.rb | 160 --------------------- spec/controllers/main_controller_spec.rb | 5 - spec/controllers/matches_controller_spec.rb | 160 --------------------- spec/controllers/pms_controller_spec.rb | 160 --------------------- spec/controllers/search_controller_spec.rb | 5 - spec/controllers/servers_controller_spec.rb | 160 --------------------- spec/controllers/sessions_controller_spec.rb | 5 - spec/controllers/static_controller_spec.rb | 5 - spec/controllers/teams_controller_spec.rb | 160 --------------------- spec/controllers/tournaments_controller_spec.rb | 160 --------------------- spec/controllers/users_controller_spec.rb | 5 - spec/helpers/alerts_helper_spec.rb | 15 -- spec/helpers/games_helper_spec.rb | 15 -- spec/helpers/main_helper_spec.rb | 15 -- spec/helpers/matches_helper_spec.rb | 15 -- spec/helpers/pms_helper_spec.rb | 15 -- spec/helpers/search_helper_spec.rb | 15 -- spec/helpers/servers_helper_spec.rb | 15 -- spec/helpers/sessions_helper_spec.rb | 15 -- spec/helpers/static_helper_spec.rb | 15 -- spec/helpers/teams_helper_spec.rb | 15 -- spec/helpers/tournaments_helper_spec.rb | 15 -- spec/helpers/users_helper_spec.rb | 15 -- spec/models/alert_spec.rb | 5 - spec/models/game_attribute_spec.rb | 5 - spec/models/game_spec.rb | 5 - spec/models/match_spec.rb | 5 - spec/models/pm_spec.rb | 5 - spec/models/server_settings_spec.rb | 5 - spec/models/server_spec.rb | 5 - spec/models/team_match_pair_spec.rb | 5 - spec/models/team_spec.rb | 5 - spec/models/tournament_option_spec.rb | 5 - spec/models/tournament_spec.rb | 5 - spec/models/user_spec.rb | 5 - spec/models/user_team_pair_spec.rb | 5 - spec/requests/alerts_spec.rb | 11 -- spec/requests/games_spec.rb | 11 -- spec/requests/matches_spec.rb | 11 -- spec/requests/pms_spec.rb | 11 -- spec/requests/servers_spec.rb | 11 -- spec/requests/teams_spec.rb | 11 -- spec/requests/tournaments_spec.rb | 11 -- spec/routing/alerts_routing_spec.rb | 35 ----- spec/routing/games_routing_spec.rb | 35 ----- spec/routing/matches_routing_spec.rb | 35 ----- spec/routing/pms_routing_spec.rb | 35 ----- spec/routing/servers_routing_spec.rb | 35 ----- spec/routing/teams_routing_spec.rb | 35 ----- spec/routing/tournaments_routing_spec.rb | 35 ----- spec/views/alerts/edit.html.erb_spec.rb | 20 --- spec/views/alerts/index.html.erb_spec.rb | 23 --- spec/views/alerts/new.html.erb_spec.rb | 20 --- spec/views/alerts/show.html.erb_spec.rb | 17 --- spec/views/games/edit.html.erb_spec.rb | 26 ---- spec/views/games/index.html.erb_spec.rb | 32 ----- spec/views/games/new.html.erb_spec.rb | 26 ---- spec/views/games/show.html.erb_spec.rb | 23 --- spec/views/matches/edit.html.erb_spec.rb | 20 --- spec/views/matches/index.html.erb_spec.rb | 23 --- spec/views/matches/new.html.erb_spec.rb | 20 --- spec/views/matches/show.html.erb_spec.rb | 17 --- spec/views/pms/edit.html.erb_spec.rb | 22 --- spec/views/pms/index.html.erb_spec.rb | 26 ---- spec/views/pms/new.html.erb_spec.rb | 22 --- spec/views/pms/show.html.erb_spec.rb | 19 --- spec/views/servers/edit.html.erb_spec.rb | 15 -- spec/views/servers/index.html.erb_spec.rb | 15 -- spec/views/servers/new.html.erb_spec.rb | 15 -- spec/views/servers/show.html.erb_spec.rb | 12 -- spec/views/teams/edit.html.erb_spec.rb | 15 -- spec/views/teams/index.html.erb_spec.rb | 15 -- spec/views/teams/new.html.erb_spec.rb | 15 -- spec/views/teams/show.html.erb_spec.rb | 12 -- spec/views/tournaments/edit.html.erb_spec.rb | 18 --- spec/views/tournaments/index.html.erb_spec.rb | 20 --- spec/views/tournaments/new.html.erb_spec.rb | 18 --- spec/views/tournaments/show.html.erb_spec.rb | 15 -- test/controllers/.keep | 0 test/controllers/alerts_controller_test.rb | 49 +++++++ test/controllers/games_controller_test.rb | 49 +++++++ test/controllers/main_controller_test.rb | 7 + test/controllers/matches_controller_test.rb | 49 +++++++ test/controllers/pms_controller_test.rb | 49 +++++++ test/controllers/search_controller_test.rb | 7 + test/controllers/servers_controller_test.rb | 49 +++++++ test/controllers/sessions_controller_test.rb | 7 + test/controllers/static_controller_test.rb | 7 + test/controllers/teams_controller_test.rb | 49 +++++++ test/controllers/tournaments_controller_test.rb | 49 +++++++ test/controllers/users_controller_test.rb | 49 +++++++ test/fixtures/.keep | 0 test/fixtures/alerts.yml | 9 ++ test/fixtures/game_attributes.yml | 11 ++ test/fixtures/games.yml | 15 ++ test/fixtures/matches.yml | 9 ++ test/fixtures/pms.yml | 11 ++ test/fixtures/server_settings.yml | 11 ++ test/fixtures/servers.yml | 11 ++ test/fixtures/team_match_pairs.yml | 9 ++ test/fixtures/teams.yml | 11 ++ test/fixtures/tournament_options.yml | 11 ++ test/fixtures/tournaments.yml | 7 + test/fixtures/user_team_pairs.yml | 9 ++ test/fixtures/users.yml | 11 ++ test/helpers/.keep | 0 test/helpers/alerts_helper_test.rb | 4 + test/helpers/games_helper_test.rb | 4 + test/helpers/main_helper_test.rb | 4 + test/helpers/matches_helper_test.rb | 4 + test/helpers/pms_helper_test.rb | 4 + test/helpers/search_helper_test.rb | 4 + test/helpers/servers_helper_test.rb | 4 + test/helpers/sessions_helper_test.rb | 4 + test/helpers/static_helper_test.rb | 4 + test/helpers/teams_helper_test.rb | 4 + test/helpers/tournaments_helper_test.rb | 4 + test/helpers/users_helper_test.rb | 4 + test/integration/.keep | 0 test/mailers/.keep | 0 test/models/.keep | 0 test/models/alert_test.rb | 7 + test/models/game_attribute_test.rb | 7 + test/models/game_test.rb | 7 + test/models/match_test.rb | 7 + test/models/pm_test.rb | 7 + test/models/server_settings_test.rb | 7 + test/models/server_test.rb | 7 + test/models/team_match_pair_test.rb | 7 + test/models/team_test.rb | 7 + test/models/tournament_option_test.rb | 7 + test/models/tournament_test.rb | 7 + test/models/user_team_pair_test.rb | 7 + test/models/user_test.rb | 7 + test/test_helper.rb | 15 ++ 173 files changed, 1007 insertions(+), 2382 deletions(-) create mode 100644 app/views/users/_form.html.erb create mode 100644 app/views/users/edit.html.erb create mode 100644 app/views/users/index.html.erb create mode 100644 app/views/users/index.json.jbuilder create mode 100644 app/views/users/new.html.erb create mode 100644 app/views/users/show.html.erb create mode 100644 app/views/users/show.json.jbuilder delete mode 100644 db/migrate/20140304021249_create_servers.rb delete mode 100644 db/migrate/20140304021251_create_tournaments.rb delete mode 100644 db/migrate/20140304021254_create_matches.rb delete mode 100644 db/migrate/20140304021256_create_teams.rb delete mode 100644 db/migrate/20140304021258_create_alerts.rb delete mode 100644 db/migrate/20140304021301_create_pms.rb delete mode 100644 db/migrate/20140304021303_create_games.rb delete mode 100644 db/migrate/20140304021306_create_game_attributes.rb delete mode 100644 db/migrate/20140304021308_create_server_settings.rb delete mode 100644 db/migrate/20140304021310_create_users.rb delete mode 100644 db/migrate/20140304021312_create_user_team_pairs.rb delete mode 100644 db/migrate/20140304021314_create_team_match_pairs.rb delete mode 100644 db/migrate/20140304021327_create_tournament_options.rb create mode 100644 db/migrate/20140304031800_create_servers.rb create mode 100644 db/migrate/20140304031802_create_tournaments.rb create mode 100644 db/migrate/20140304031804_create_matches.rb create mode 100644 db/migrate/20140304031806_create_teams.rb create mode 100644 db/migrate/20140304031808_create_alerts.rb create mode 100644 db/migrate/20140304031810_create_pms.rb create mode 100644 db/migrate/20140304031813_create_games.rb create mode 100644 db/migrate/20140304031815_create_users.rb create mode 100644 db/migrate/20140304031817_create_game_attributes.rb create mode 100644 db/migrate/20140304031819_create_server_settings.rb create mode 100644 db/migrate/20140304031821_create_user_team_pairs.rb create mode 100644 db/migrate/20140304031823_create_team_match_pairs.rb create mode 100644 db/migrate/20140304031834_create_tournament_options.rb delete mode 100644 spec/controllers/alerts_controller_spec.rb delete mode 100644 spec/controllers/games_controller_spec.rb delete mode 100644 spec/controllers/main_controller_spec.rb delete mode 100644 spec/controllers/matches_controller_spec.rb delete mode 100644 spec/controllers/pms_controller_spec.rb delete mode 100644 spec/controllers/search_controller_spec.rb delete mode 100644 spec/controllers/servers_controller_spec.rb delete mode 100644 spec/controllers/sessions_controller_spec.rb delete mode 100644 spec/controllers/static_controller_spec.rb delete mode 100644 spec/controllers/teams_controller_spec.rb delete mode 100644 spec/controllers/tournaments_controller_spec.rb delete mode 100644 spec/controllers/users_controller_spec.rb delete mode 100644 spec/helpers/alerts_helper_spec.rb delete mode 100644 spec/helpers/games_helper_spec.rb delete mode 100644 spec/helpers/main_helper_spec.rb delete mode 100644 spec/helpers/matches_helper_spec.rb delete mode 100644 spec/helpers/pms_helper_spec.rb delete mode 100644 spec/helpers/search_helper_spec.rb delete mode 100644 spec/helpers/servers_helper_spec.rb delete mode 100644 spec/helpers/sessions_helper_spec.rb delete mode 100644 spec/helpers/static_helper_spec.rb delete mode 100644 spec/helpers/teams_helper_spec.rb delete mode 100644 spec/helpers/tournaments_helper_spec.rb delete mode 100644 spec/helpers/users_helper_spec.rb delete mode 100644 spec/models/alert_spec.rb delete mode 100644 spec/models/game_attribute_spec.rb delete mode 100644 spec/models/game_spec.rb delete mode 100644 spec/models/match_spec.rb delete mode 100644 spec/models/pm_spec.rb delete mode 100644 spec/models/server_settings_spec.rb delete mode 100644 spec/models/server_spec.rb delete mode 100644 spec/models/team_match_pair_spec.rb delete mode 100644 spec/models/team_spec.rb delete mode 100644 spec/models/tournament_option_spec.rb delete mode 100644 spec/models/tournament_spec.rb delete mode 100644 spec/models/user_spec.rb delete mode 100644 spec/models/user_team_pair_spec.rb delete mode 100644 spec/requests/alerts_spec.rb delete mode 100644 spec/requests/games_spec.rb delete mode 100644 spec/requests/matches_spec.rb delete mode 100644 spec/requests/pms_spec.rb delete mode 100644 spec/requests/servers_spec.rb delete mode 100644 spec/requests/teams_spec.rb delete mode 100644 spec/requests/tournaments_spec.rb delete mode 100644 spec/routing/alerts_routing_spec.rb delete mode 100644 spec/routing/games_routing_spec.rb delete mode 100644 spec/routing/matches_routing_spec.rb delete mode 100644 spec/routing/pms_routing_spec.rb delete mode 100644 spec/routing/servers_routing_spec.rb delete mode 100644 spec/routing/teams_routing_spec.rb delete mode 100644 spec/routing/tournaments_routing_spec.rb delete mode 100644 spec/views/alerts/edit.html.erb_spec.rb delete mode 100644 spec/views/alerts/index.html.erb_spec.rb delete mode 100644 spec/views/alerts/new.html.erb_spec.rb delete mode 100644 spec/views/alerts/show.html.erb_spec.rb delete mode 100644 spec/views/games/edit.html.erb_spec.rb delete mode 100644 spec/views/games/index.html.erb_spec.rb delete mode 100644 spec/views/games/new.html.erb_spec.rb delete mode 100644 spec/views/games/show.html.erb_spec.rb delete mode 100644 spec/views/matches/edit.html.erb_spec.rb delete mode 100644 spec/views/matches/index.html.erb_spec.rb delete mode 100644 spec/views/matches/new.html.erb_spec.rb delete mode 100644 spec/views/matches/show.html.erb_spec.rb delete mode 100644 spec/views/pms/edit.html.erb_spec.rb delete mode 100644 spec/views/pms/index.html.erb_spec.rb delete mode 100644 spec/views/pms/new.html.erb_spec.rb delete mode 100644 spec/views/pms/show.html.erb_spec.rb delete mode 100644 spec/views/servers/edit.html.erb_spec.rb delete mode 100644 spec/views/servers/index.html.erb_spec.rb delete mode 100644 spec/views/servers/new.html.erb_spec.rb delete mode 100644 spec/views/servers/show.html.erb_spec.rb delete mode 100644 spec/views/teams/edit.html.erb_spec.rb delete mode 100644 spec/views/teams/index.html.erb_spec.rb delete mode 100644 spec/views/teams/new.html.erb_spec.rb delete mode 100644 spec/views/teams/show.html.erb_spec.rb delete mode 100644 spec/views/tournaments/edit.html.erb_spec.rb delete mode 100644 spec/views/tournaments/index.html.erb_spec.rb delete mode 100644 spec/views/tournaments/new.html.erb_spec.rb delete mode 100644 spec/views/tournaments/show.html.erb_spec.rb create mode 100644 test/controllers/.keep create mode 100644 test/controllers/alerts_controller_test.rb create mode 100644 test/controllers/games_controller_test.rb create mode 100644 test/controllers/main_controller_test.rb create mode 100644 test/controllers/matches_controller_test.rb create mode 100644 test/controllers/pms_controller_test.rb create mode 100644 test/controllers/search_controller_test.rb create mode 100644 test/controllers/servers_controller_test.rb create mode 100644 test/controllers/sessions_controller_test.rb create mode 100644 test/controllers/static_controller_test.rb create mode 100644 test/controllers/teams_controller_test.rb create mode 100644 test/controllers/tournaments_controller_test.rb create mode 100644 test/controllers/users_controller_test.rb create mode 100644 test/fixtures/.keep create mode 100644 test/fixtures/alerts.yml create mode 100644 test/fixtures/game_attributes.yml create mode 100644 test/fixtures/games.yml create mode 100644 test/fixtures/matches.yml create mode 100644 test/fixtures/pms.yml create mode 100644 test/fixtures/server_settings.yml create mode 100644 test/fixtures/servers.yml create mode 100644 test/fixtures/team_match_pairs.yml create mode 100644 test/fixtures/teams.yml create mode 100644 test/fixtures/tournament_options.yml create mode 100644 test/fixtures/tournaments.yml create mode 100644 test/fixtures/user_team_pairs.yml create mode 100644 test/fixtures/users.yml create mode 100644 test/helpers/.keep create mode 100644 test/helpers/alerts_helper_test.rb create mode 100644 test/helpers/games_helper_test.rb create mode 100644 test/helpers/main_helper_test.rb create mode 100644 test/helpers/matches_helper_test.rb create mode 100644 test/helpers/pms_helper_test.rb create mode 100644 test/helpers/search_helper_test.rb create mode 100644 test/helpers/servers_helper_test.rb create mode 100644 test/helpers/sessions_helper_test.rb create mode 100644 test/helpers/static_helper_test.rb create mode 100644 test/helpers/teams_helper_test.rb create mode 100644 test/helpers/tournaments_helper_test.rb create mode 100644 test/helpers/users_helper_test.rb create mode 100644 test/integration/.keep create mode 100644 test/mailers/.keep create mode 100644 test/models/.keep create mode 100644 test/models/alert_test.rb create mode 100644 test/models/game_attribute_test.rb create mode 100644 test/models/game_test.rb create mode 100644 test/models/match_test.rb create mode 100644 test/models/pm_test.rb create mode 100644 test/models/server_settings_test.rb create mode 100644 test/models/server_test.rb create mode 100644 test/models/team_match_pair_test.rb create mode 100644 test/models/team_test.rb create mode 100644 test/models/tournament_option_test.rb create mode 100644 test/models/tournament_test.rb create mode 100644 test/models/user_team_pair_test.rb create mode 100644 test/models/user_test.rb create mode 100644 test/test_helper.rb (limited to 'app/views') diff --git a/app/assets/stylesheets/sessions.css.scss b/app/assets/stylesheets/sessions.css.scss index ccb1ed2..7bef9cf 100644 --- a/app/assets/stylesheets/sessions.css.scss +++ b/app/assets/stylesheets/sessions.css.scss @@ -1,3 +1,3 @@ -// Place all the styles related to the Sessions controller here. +// Place all the styles related to the sessions controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3e74dea..b18efed 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,2 +1,74 @@ class UsersController < ApplicationController + before_action :set_user, only: [:show, :edit, :update, :destroy] + + # GET /users + # GET /users.json + def index + @users = User.all + end + + # GET /users/1 + # GET /users/1.json + def show + end + + # GET /users/new + def new + @user = User.new + end + + # GET /users/1/edit + def edit + end + + # POST /users + # POST /users.json + def create + @user = User.new(user_params) + + respond_to do |format| + if @user.save + format.html { redirect_to @user, notice: 'User was successfully created.' } + format.json { render action: 'show', status: :created, location: @user } + else + format.html { render action: 'new' } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /users/1 + # PATCH/PUT /users/1.json + def update + respond_to do |format| + if @user.update(user_params) + format.html { redirect_to @user, notice: 'User was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /users/1 + # DELETE /users/1.json + def destroy + @user.destroy + respond_to do |format| + format.html { redirect_to users_url } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_user + @user = User.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def user_params + params.require(:user).permit(:name, :email, :user_name) + end end diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb new file mode 100644 index 0000000..4d28738 --- /dev/null +++ b/app/views/users/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@user) do |f| %> + <% if @user.errors.any? %> +
+

<%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:

+ +
    + <% @user.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :name %>
+ <%= f.text_field :name %> +
+
+ <%= f.label :email %>
+ <%= f.text_field :email %> +
+
+ <%= f.label :user_name %>
+ <%= f.text_field :user_name %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 0000000..99bd4cc --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,6 @@ +

Editing user

+ +<%= render 'form' %> + +<%= link_to 'Show', @user %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..3692112 --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,31 @@ +

Listing users

+ +
Username Name Pw hash
<%= link_to("#{user.name}", user, nil) %><%= link_to("#{user.user_name}", user, nil) %><%= user.name %> ******* <%= link_to 'Edit', edit_user_path(user) %> <%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
+ + + + + + + + + + + + + <% @users.each do |user| %> + + + + + + + + + <% end %> + +
NameEmailUser name
<%= user.name %><%= user.email %><%= user.user_name %><%= link_to 'Show', user %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New User', new_user_path %> diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder new file mode 100644 index 0000000..42d8b72 --- /dev/null +++ b/app/views/users/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@users) do |user| + json.extract! user, :id, :name, :email, :user_name + json.url user_url(user, format: :json) +end diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 0000000..efc0404 --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,5 @@ +

New user

+ +<%= render 'form' %> + +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..9455a3c --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,19 @@ +

<%= notice %>

+ +

+ Name: + <%= @user.name %> +

+ +

+ Email: + <%= @user.email %> +

+ +

+ User name: + <%= @user.user_name %> +

+ +<%= link_to 'Edit', edit_user_path(@user) %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder new file mode 100644 index 0000000..4919af3 --- /dev/null +++ b/app/views/users/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @user, :id, :name, :email, :user_name, :created_at, :updated_at diff --git a/config/routes.rb b/config/routes.rb index 149c321..3bad42d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,6 @@ Leaguer::Application.routes.draw do + resources :users + resources :games resources :pms diff --git a/db/migrate/20140304021249_create_servers.rb b/db/migrate/20140304021249_create_servers.rb deleted file mode 100644 index f33241a..0000000 --- a/db/migrate/20140304021249_create_servers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021251_create_tournaments.rb b/db/migrate/20140304021251_create_tournaments.rb deleted file mode 100644 index 36fcf7e..0000000 --- a/db/migrate/20140304021251_create_tournaments.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - t.references :game, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021254_create_matches.rb b/db/migrate/20140304021254_create_matches.rb deleted file mode 100644 index 325863d..0000000 --- a/db/migrate/20140304021254_create_matches.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.references :tournament, index: true - t.string :name - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021256_create_teams.rb b/db/migrate/20140304021256_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140304021256_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021258_create_alerts.rb b/db/migrate/20140304021258_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140304021258_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.references :author, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021301_create_pms.rb b/db/migrate/20140304021301_create_pms.rb deleted file mode 100644 index 93bb5c6..0000000 --- a/db/migrate/20140304021301_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.references :author, index: true - t.references :recipient, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021303_create_games.rb b/db/migrate/20140304021303_create_games.rb deleted file mode 100644 index 59d4ef0..0000000 --- a/db/migrate/20140304021303_create_games.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateGames < ActiveRecord::Migration - def change - create_table :games do |t| - t.text :name - t.integer :players_per_team - t.integer :teams_per_match - t.integer :set_rounds - t.integer :randomized_teams - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021306_create_game_attributes.rb b/db/migrate/20140304021306_create_game_attributes.rb deleted file mode 100644 index b63f134..0000000 --- a/db/migrate/20140304021306_create_game_attributes.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateGameAttributes < ActiveRecord::Migration - def change - create_table :game_attributes do |t| - t.references :game, index: true - t.text :key - t.integer :type - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021308_create_server_settings.rb b/db/migrate/20140304021308_create_server_settings.rb deleted file mode 100644 index dfdd91b..0000000 --- a/db/migrate/20140304021308_create_server_settings.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateServerSettings < ActiveRecord::Migration - def change - create_table :server_settings do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021310_create_users.rb b/db/migrate/20140304021310_create_users.rb deleted file mode 100644 index f0986d4..0000000 --- a/db/migrate/20140304021310_create_users.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.string :name - t.string :email - t.string :user_name - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021312_create_user_team_pairs.rb b/db/migrate/20140304021312_create_user_team_pairs.rb deleted file mode 100644 index 2c492ac..0000000 --- a/db/migrate/20140304021312_create_user_team_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateUserTeamPairs < ActiveRecord::Migration - def change - create_table :user_team_pairs do |t| - t.references :user, index: true - t.references :team, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021314_create_team_match_pairs.rb b/db/migrate/20140304021314_create_team_match_pairs.rb deleted file mode 100644 index 8fac07e..0000000 --- a/db/migrate/20140304021314_create_team_match_pairs.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateTeamMatchPairs < ActiveRecord::Migration - def change - create_table :team_match_pairs do |t| - t.references :team, index: true - t.references :match, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140304021327_create_tournament_options.rb b/db/migrate/20140304021327_create_tournament_options.rb deleted file mode 100644 index d2df22e..0000000 --- a/db/migrate/20140304021327_create_tournament_options.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentOptions < ActiveRecord::Migration - def change - create_table :tournament_options do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140304031800_create_servers.rb b/db/migrate/20140304031800_create_servers.rb new file mode 100644 index 0000000..f33241a --- /dev/null +++ b/db/migrate/20140304031800_create_servers.rb @@ -0,0 +1,8 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031802_create_tournaments.rb b/db/migrate/20140304031802_create_tournaments.rb new file mode 100644 index 0000000..36fcf7e --- /dev/null +++ b/db/migrate/20140304031802_create_tournaments.rb @@ -0,0 +1,9 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + t.references :game, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031804_create_matches.rb b/db/migrate/20140304031804_create_matches.rb new file mode 100644 index 0000000..325863d --- /dev/null +++ b/db/migrate/20140304031804_create_matches.rb @@ -0,0 +1,10 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.references :tournament, index: true + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031806_create_teams.rb b/db/migrate/20140304031806_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140304031806_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031808_create_alerts.rb b/db/migrate/20140304031808_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140304031808_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031810_create_pms.rb b/db/migrate/20140304031810_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140304031810_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031813_create_games.rb b/db/migrate/20140304031813_create_games.rb new file mode 100644 index 0000000..59d4ef0 --- /dev/null +++ b/db/migrate/20140304031813_create_games.rb @@ -0,0 +1,13 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.text :name + t.integer :players_per_team + t.integer :teams_per_match + t.integer :set_rounds + t.integer :randomized_teams + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031815_create_users.rb b/db/migrate/20140304031815_create_users.rb new file mode 100644 index 0000000..f0986d4 --- /dev/null +++ b/db/migrate/20140304031815_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :user_name + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031817_create_game_attributes.rb b/db/migrate/20140304031817_create_game_attributes.rb new file mode 100644 index 0000000..b63f134 --- /dev/null +++ b/db/migrate/20140304031817_create_game_attributes.rb @@ -0,0 +1,11 @@ +class CreateGameAttributes < ActiveRecord::Migration + def change + create_table :game_attributes do |t| + t.references :game, index: true + t.text :key + t.integer :type + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031819_create_server_settings.rb b/db/migrate/20140304031819_create_server_settings.rb new file mode 100644 index 0000000..dfdd91b --- /dev/null +++ b/db/migrate/20140304031819_create_server_settings.rb @@ -0,0 +1,8 @@ +class CreateServerSettings < ActiveRecord::Migration + def change + create_table :server_settings do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031821_create_user_team_pairs.rb b/db/migrate/20140304031821_create_user_team_pairs.rb new file mode 100644 index 0000000..2c492ac --- /dev/null +++ b/db/migrate/20140304031821_create_user_team_pairs.rb @@ -0,0 +1,10 @@ +class CreateUserTeamPairs < ActiveRecord::Migration + def change + create_table :user_team_pairs do |t| + t.references :user, index: true + t.references :team, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031823_create_team_match_pairs.rb b/db/migrate/20140304031823_create_team_match_pairs.rb new file mode 100644 index 0000000..8fac07e --- /dev/null +++ b/db/migrate/20140304031823_create_team_match_pairs.rb @@ -0,0 +1,10 @@ +class CreateTeamMatchPairs < ActiveRecord::Migration + def change + create_table :team_match_pairs do |t| + t.references :team, index: true + t.references :match, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140304031834_create_tournament_options.rb b/db/migrate/20140304031834_create_tournament_options.rb new file mode 100644 index 0000000..d2df22e --- /dev/null +++ b/db/migrate/20140304031834_create_tournament_options.rb @@ -0,0 +1,8 @@ +class CreateTournamentOptions < ActiveRecord::Migration + def change + create_table :tournament_options do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index e40d70c..a9bd57b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140304021327) do +ActiveRecord::Schema.define(version: 20140304031834) do create_table "alerts", force: true do |t| t.integer "author_id" diff --git a/spec/controllers/alerts_controller_spec.rb b/spec/controllers/alerts_controller_spec.rb deleted file mode 100644 index 82b031b..0000000 --- a/spec/controllers/alerts_controller_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe AlertsController do - - # This should return the minimal set of attributes required to create a valid - # Alert. As you add validations to Alert, be sure to - # adjust the attributes here as well. - let(:valid_attributes) { { "author" => "" } } - - # 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 - # AlertsController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET index" do - it "assigns all alerts as @alerts" do - alert = Alert.create! valid_attributes - get :index, {}, valid_session - assigns(:alerts).should eq([alert]) - end - end - - describe "GET show" do - it "assigns the requested alert as @alert" do - alert = Alert.create! valid_attributes - get :show, {:id => alert.to_param}, valid_session - assigns(:alert).should eq(alert) - end - end - - describe "GET new" do - it "assigns a new alert as @alert" do - get :new, {}, valid_session - assigns(:alert).should be_a_new(Alert) - end - end - - describe "GET edit" do - it "assigns the requested alert as @alert" do - alert = Alert.create! valid_attributes - get :edit, {:id => alert.to_param}, valid_session - assigns(:alert).should eq(alert) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Alert" do - expect { - post :create, {:alert => valid_attributes}, valid_session - }.to change(Alert, :count).by(1) - end - - it "assigns a newly created alert as @alert" do - post :create, {:alert => valid_attributes}, valid_session - assigns(:alert).should be_a(Alert) - assigns(:alert).should be_persisted - end - - it "redirects to the created alert" do - post :create, {:alert => valid_attributes}, valid_session - response.should redirect_to(Alert.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved alert as @alert" do - # Trigger the behavior that occurs when invalid params are submitted - Alert.any_instance.stub(:save).and_return(false) - post :create, {:alert => { "author" => "invalid value" }}, valid_session - assigns(:alert).should be_a_new(Alert) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Alert.any_instance.stub(:save).and_return(false) - post :create, {:alert => { "author" => "invalid value" }}, valid_session - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested alert" do - alert = Alert.create! valid_attributes - # Assuming there are no other alerts in the database, this - # specifies that the Alert created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Alert.any_instance.should_receive(:update).with({ "author" => "" }) - put :update, {:id => alert.to_param, :alert => { "author" => "" }}, valid_session - end - - it "assigns the requested alert as @alert" do - alert = Alert.create! valid_attributes - put :update, {:id => alert.to_param, :alert => valid_attributes}, valid_session - assigns(:alert).should eq(alert) - end - - it "redirects to the alert" do - alert = Alert.create! valid_attributes - put :update, {:id => alert.to_param, :alert => valid_attributes}, valid_session - response.should redirect_to(alert) - end - end - - describe "with invalid params" do - it "assigns the alert as @alert" do - alert = Alert.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Alert.any_instance.stub(:save).and_return(false) - put :update, {:id => alert.to_param, :alert => { "author" => "invalid value" }}, valid_session - assigns(:alert).should eq(alert) - end - - it "re-renders the 'edit' template" do - alert = Alert.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Alert.any_instance.stub(:save).and_return(false) - put :update, {:id => alert.to_param, :alert => { "author" => "invalid value" }}, valid_session - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested alert" do - alert = Alert.create! valid_attributes - expect { - delete :destroy, {:id => alert.to_param}, valid_session - }.to change(Alert, :count).by(-1) - end - - it "redirects to the alerts list" do - alert = Alert.create! valid_attributes - delete :destroy, {:id => alert.to_param}, valid_session - response.should redirect_to(alerts_url) - end - end - -end diff --git a/spec/controllers/games_controller_spec.rb b/spec/controllers/games_controller_spec.rb deleted file mode 100644 index ab8b6b2..0000000 --- a/spec/controllers/games_controller_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe GamesController do - - # This should return the minimal set of attributes required to create a valid - # Game. As you add validations to Game, be sure to - # adjust the attributes here as well. - let(:valid_attributes) { { "name" => "MyText" } } - - # 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 - # GamesController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET index" do - it "assigns all games as @games" do - game = Game.create! valid_attributes - get :index, {}, valid_session - assigns(:games).should eq([game]) - end - end - - describe "GET show" do - it "assigns the requested game as @game" do - game = Game.create! valid_attributes - get :show, {:id => game.to_param}, valid_session - assigns(:game).should eq(game) - end - end - - describe "GET new" do - it "assigns a new game as @game" do - get :new, {}, valid_session - assigns(:game).should be_a_new(Game) - end - end - - describe "GET edit" do - it "assigns the requested game as @game" do - game = Game.create! valid_attributes - get :edit, {:id => game.to_param}, valid_session - assigns(:game).should eq(game) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Game" do - expect { - post :create, {:game => valid_attributes}, valid_session - }.to change(Game, :count).by(1) - end - - it "assigns a newly created game as @game" do - post :create, {:game => valid_attributes}, valid_session - assigns(:game).should be_a(Game) - assigns(:game).should be_persisted - end - - it "redirects to the created game" do - post :create, {:game => valid_attributes}, valid_session - response.should redirect_to(Game.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved game as @game" do - # Trigger the behavior that occurs when invalid params are submitted - Game.any_instance.stub(:save).and_return(false) - post :create, {:game => { "name" => "invalid value" }}, valid_session - assigns(:game).should be_a_new(Game) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Game.any_instance.stub(:save).and_return(false) - post :create, {:game => { "name" => "invalid value" }}, valid_session - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested game" do - game = Game.create! valid_attributes - # Assuming there are no other games in the database, this - # specifies that the Game created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Game.any_instance.should_receive(:update).with({ "name" => "MyText" }) - put :update, {:id => game.to_param, :game => { "name" => "MyText" }}, valid_session - end - - it "assigns the requested game as @game" do - game = Game.create! valid_attributes - put :update, {:id => game.to_param, :game => valid_attributes}, valid_session - assigns(:game).should eq(game) - end - - it "redirects to the game" do - game = Game.create! valid_attributes - put :update, {:id => game.to_param, :game => valid_attributes}, valid_session - response.should redirect_to(game) - end - end - - describe "with invalid params" do - it "assigns the game as @game" do - game = Game.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Game.any_instance.stub(:save).and_return(false) - put :update, {:id => game.to_param, :game => { "name" => "invalid value" }}, valid_session - assigns(:game).should eq(game) - end - - it "re-renders the 'edit' template" do - game = Game.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Game.any_instance.stub(:save).and_return(false) - put :update, {:id => game.to_param, :game => { "name" => "invalid value" }}, valid_session - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested game" do - game = Game.create! valid_attributes - expect { - delete :destroy, {:id => game.to_param}, valid_session - }.to change(Game, :count).by(-1) - end - - it "redirects to the games list" do - game = Game.create! valid_attributes - delete :destroy, {:id => game.to_param}, valid_session - response.should redirect_to(games_url) - end - end - -end diff --git a/spec/controllers/main_controller_spec.rb b/spec/controllers/main_controller_spec.rb deleted file mode 100644 index 247e21d..0000000 --- a/spec/controllers/main_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe MainController do - -end diff --git a/spec/controllers/matches_controller_spec.rb b/spec/controllers/matches_controller_spec.rb deleted file mode 100644 index 1f7adf8..0000000 --- a/spec/controllers/matches_controller_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe MatchesController do - - # This should return the minimal set of attributes required to create a valid - # Match. As you add validations to Match, be sure to - # adjust the attributes here as well. - let(:valid_attributes) { { "tournament" => "" } } - - # 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 - # MatchesController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET index" do - it "assigns all matches as @matches" do - match = Match.create! valid_attributes - get :index, {}, valid_session - assigns(:matches).should eq([match]) - end - end - - describe "GET show" do - it "assigns the requested match as @match" do - match = Match.create! valid_attributes - get :show, {:id => match.to_param}, valid_session - assigns(:match).should eq(match) - end - end - - describe "GET new" do - it "assigns a new match as @match" do - get :new, {}, valid_session - assigns(:match).should be_a_new(Match) - end - end - - describe "GET edit" do - it "assigns the requested match as @match" do - match = Match.create! valid_attributes - get :edit, {:id => match.to_param}, valid_session - assigns(:match).should eq(match) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Match" do - expect { - post :create, {:match => valid_attributes}, valid_session - }.to change(Match, :count).by(1) - end - - it "assigns a newly created match as @match" do - post :create, {:match => valid_attributes}, valid_session - assigns(:match).should be_a(Match) - assigns(:match).should be_persisted - end - - it "redirects to the created match" do - post :create, {:match => valid_attributes}, valid_session - response.should redirect_to(Match.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved match as @match" do - # Trigger the behavior that occurs when invalid params are submitted - Match.any_instance.stub(:save).and_return(false) - post :create, {:match => { "tournament" => "invalid value" }}, valid_session - assigns(:match).should be_a_new(Match) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Match.any_instance.stub(:save).and_return(false) - post :create, {:match => { "tournament" => "invalid value" }}, valid_session - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested match" do - match = Match.create! valid_attributes - # Assuming there are no other matches in the database, this - # specifies that the Match created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Match.any_instance.should_receive(:update).with({ "tournament" => "" }) - put :update, {:id => match.to_param, :match => { "tournament" => "" }}, valid_session - end - - it "assigns the requested match as @match" do - match = Match.create! valid_attributes - put :update, {:id => match.to_param, :match => valid_attributes}, valid_session - assigns(:match).should eq(match) - end - - it "redirects to the match" do - match = Match.create! valid_attributes - put :update, {:id => match.to_param, :match => valid_attributes}, valid_session - response.should redirect_to(match) - end - end - - describe "with invalid params" do - it "assigns the match as @match" do - match = Match.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Match.any_instance.stub(:save).and_return(false) - put :update, {:id => match.to_param, :match => { "tournament" => "invalid value" }}, valid_session - assigns(:match).should eq(match) - end - - it "re-renders the 'edit' template" do - match = Match.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Match.any_instance.stub(:save).and_return(false) - put :update, {:id => match.to_param, :match => { "tournament" => "invalid value" }}, valid_session - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested match" do - match = Match.create! valid_attributes - expect { - delete :destroy, {:id => match.to_param}, valid_session - }.to change(Match, :count).by(-1) - end - - it "redirects to the matches list" do - match = Match.create! valid_attributes - delete :destroy, {:id => match.to_param}, valid_session - response.should redirect_to(matches_url) - end - end - -end diff --git a/spec/controllers/pms_controller_spec.rb b/spec/controllers/pms_controller_spec.rb deleted file mode 100644 index f0822db..0000000 --- a/spec/controllers/pms_controller_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe PmsController do - - # This should return the minimal set of attributes required to create a valid - # Pm. As you add validations to Pm, be sure to - # adjust the attributes here as well. - let(:valid_attributes) { { "author" => "" } } - - # 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 - # PmsController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET index" do - it "assigns all pms as @pms" do - pm = Pm.create! valid_attributes - get :index, {}, valid_session - assigns(:pms).should eq([pm]) - end - end - - describe "GET show" do - it "assigns the requested pm as @pm" do - pm = Pm.create! valid_attributes - get :show, {:id => pm.to_param}, valid_session - assigns(:pm).should eq(pm) - end - end - - describe "GET new" do - it "assigns a new pm as @pm" do - get :new, {}, valid_session - assigns(:pm).should be_a_new(Pm) - end - end - - describe "GET edit" do - it "assigns the requested pm as @pm" do - pm = Pm.create! valid_attributes - get :edit, {:id => pm.to_param}, valid_session - assigns(:pm).should eq(pm) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Pm" do - expect { - post :create, {:pm => valid_attributes}, valid_session - }.to change(Pm, :count).by(1) - end - - it "assigns a newly created pm as @pm" do - post :create, {:pm => valid_attributes}, valid_session - assigns(:pm).should be_a(Pm) - assigns(:pm).should be_persisted - end - - it "redirects to the created pm" do - post :create, {:pm => valid_attributes}, valid_session - response.should redirect_to(Pm.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved pm as @pm" do - # Trigger the behavior that occurs when invalid params are submitted - Pm.any_instance.stub(:save).and_return(false) - post :create, {:pm => { "author" => "invalid value" }}, valid_session - assigns(:pm).should be_a_new(Pm) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Pm.any_instance.stub(:save).and_return(false) - post :create, {:pm => { "author" => "invalid value" }}, valid_session - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested pm" do - pm = Pm.create! valid_attributes - # Assuming there are no other pms in the database, this - # specifies that the Pm created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Pm.any_instance.should_receive(:update).with({ "author" => "" }) - put :update, {:id => pm.to_param, :pm => { "author" => "" }}, valid_session - end - - it "assigns the requested pm as @pm" do - pm = Pm.create! valid_attributes - put :update, {:id => pm.to_param, :pm => valid_attributes}, valid_session - assigns(:pm).should eq(pm) - end - - it "redirects to the pm" do - pm = Pm.create! valid_attributes - put :update, {:id => pm.to_param, :pm => valid_attributes}, valid_session - response.should redirect_to(pm) - end - end - - describe "with invalid params" do - it "assigns the pm as @pm" do - pm = Pm.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Pm.any_instance.stub(:save).and_return(false) - put :update, {:id => pm.to_param, :pm => { "author" => "invalid value" }}, valid_session - assigns(:pm).should eq(pm) - end - - it "re-renders the 'edit' template" do - pm = Pm.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Pm.any_instance.stub(:save).and_return(false) - put :update, {:id => pm.to_param, :pm => { "author" => "invalid value" }}, valid_session - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested pm" do - pm = Pm.create! valid_attributes - expect { - delete :destroy, {:id => pm.to_param}, valid_session - }.to change(Pm, :count).by(-1) - end - - it "redirects to the pms list" do - pm = Pm.create! valid_attributes - delete :destroy, {:id => pm.to_param}, valid_session - response.should redirect_to(pms_url) - end - end - -end diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb deleted file mode 100644 index 73248fb..0000000 --- a/spec/controllers/search_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe SearchController do - -end diff --git a/spec/controllers/servers_controller_spec.rb b/spec/controllers/servers_controller_spec.rb deleted file mode 100644 index c6f4fa6..0000000 --- a/spec/controllers/servers_controller_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe ServersController do - - # This should return the minimal set of attributes required to create a valid - # Server. As you add validations to Server, be sure to - # adjust the attributes here as well. - let(: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 - # ServersController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET index" do - it "assigns all servers as @servers" do - server = Server.create! valid_attributes - get :index, {}, valid_session - assigns(:servers).should eq([server]) - end - end - - describe "GET show" do - it "assigns the requested server as @server" do - server = Server.create! valid_attributes - get :show, {:id => server.to_param}, valid_session - assigns(:server).should eq(server) - end - end - - describe "GET new" do - it "assigns a new server as @server" do - get :new, {}, valid_session - assigns(:server).should be_a_new(Server) - end - end - - describe "GET edit" do - it "assigns the requested server as @server" do - server = Server.create! valid_attributes - get :edit, {:id => server.to_param}, valid_session - assigns(:server).should eq(server) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Server" do - expect { - post :create, {:server => valid_attributes}, valid_session - }.to change(Server, :count).by(1) - end - - it "assigns a newly created server as @server" do - post :create, {:server => valid_attributes}, valid_session - assigns(:server).should be_a(Server) - assigns(:server).should be_persisted - end - - it "redirects to the created server" do - post :create, {:server => valid_attributes}, valid_session - response.should redirect_to(Server.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved server as @server" do - # Trigger the behavior that occurs when invalid params are submitted - Server.any_instance.stub(:save).and_return(false) - post :create, {:server => { }}, valid_session - assigns(:server).should be_a_new(Server) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Server.any_instance.stub(:save).and_return(false) - post :create, {:server => { }}, valid_session - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested server" do - server = Server.create! valid_attributes - # Assuming there are no other servers in the database, this - # specifies that the Server created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Server.any_instance.should_receive(:update).with({ "these" => "params" }) - put :update, {:id => server.to_param, :server => { "these" => "params" }}, valid_session - end - - it "assigns the requested server as @server" do - server = Server.create! valid_attributes - put :update, {:id => server.to_param, :server => valid_attributes}, valid_session - assigns(:server).should eq(server) - end - - it "redirects to the server" do - server = Server.create! valid_attributes - put :update, {:id => server.to_param, :server => valid_attributes}, valid_session - response.should redirect_to(server) - end - end - - describe "with invalid params" do - it "assigns the server as @server" do - server = Server.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Server.any_instance.stub(:save).and_return(false) - put :update, {:id => server.to_param, :server => { }}, valid_session - assigns(:server).should eq(server) - end - - it "re-renders the 'edit' template" do - server = Server.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Server.any_instance.stub(:save).and_return(false) - put :update, {:id => server.to_param, :server => { }}, valid_session - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested server" do - server = Server.create! valid_attributes - expect { - delete :destroy, {:id => server.to_param}, valid_session - }.to change(Server, :count).by(-1) - end - - it "redirects to the servers list" do - server = Server.create! valid_attributes - delete :destroy, {:id => server.to_param}, valid_session - response.should redirect_to(servers_url) - end - end - -end diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb deleted file mode 100644 index 702c559..0000000 --- a/spec/controllers/sessions_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe SessionsController do - -end diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb deleted file mode 100644 index a3db7c0..0000000 --- a/spec/controllers/static_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe StaticController do - -end diff --git a/spec/controllers/teams_controller_spec.rb b/spec/controllers/teams_controller_spec.rb deleted file mode 100644 index 9c74d89..0000000 --- a/spec/controllers/teams_controller_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe TeamsController do - - # This should return the minimal set of attributes required to create a valid - # Team. As you add validations to Team, be sure to - # adjust the attributes here as well. - let(: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 - # TeamsController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET index" do - it "assigns all teams as @teams" do - team = Team.create! valid_attributes - get :index, {}, valid_session - assigns(:teams).should eq([team]) - end - end - - describe "GET show" do - it "assigns the requested team as @team" do - team = Team.create! valid_attributes - get :show, {:id => team.to_param}, valid_session - assigns(:team).should eq(team) - end - end - - describe "GET new" do - it "assigns a new team as @team" do - get :new, {}, valid_session - assigns(:team).should be_a_new(Team) - end - end - - describe "GET edit" do - it "assigns the requested team as @team" do - team = Team.create! valid_attributes - get :edit, {:id => team.to_param}, valid_session - assigns(:team).should eq(team) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Team" do - expect { - post :create, {:team => valid_attributes}, valid_session - }.to change(Team, :count).by(1) - end - - it "assigns a newly created team as @team" do - post :create, {:team => valid_attributes}, valid_session - assigns(:team).should be_a(Team) - assigns(:team).should be_persisted - end - - it "redirects to the created team" do - post :create, {:team => valid_attributes}, valid_session - response.should redirect_to(Team.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved team as @team" do - # Trigger the behavior that occurs when invalid params are submitted - Team.any_instance.stub(:save).and_return(false) - post :create, {:team => { }}, valid_session - assigns(:team).should be_a_new(Team) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Team.any_instance.stub(:save).and_return(false) - post :create, {:team => { }}, valid_session - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested team" do - team = Team.create! valid_attributes - # Assuming there are no other teams in the database, this - # specifies that the Team created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Team.any_instance.should_receive(:update).with({ "these" => "params" }) - put :update, {:id => team.to_param, :team => { "these" => "params" }}, valid_session - end - - it "assigns the requested team as @team" do - team = Team.create! valid_attributes - put :update, {:id => team.to_param, :team => valid_attributes}, valid_session - assigns(:team).should eq(team) - end - - it "redirects to the team" do - team = Team.create! valid_attributes - put :update, {:id => team.to_param, :team => valid_attributes}, valid_session - response.should redirect_to(team) - end - end - - describe "with invalid params" do - it "assigns the team as @team" do - team = Team.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Team.any_instance.stub(:save).and_return(false) - put :update, {:id => team.to_param, :team => { }}, valid_session - assigns(:team).should eq(team) - end - - it "re-renders the 'edit' template" do - team = Team.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Team.any_instance.stub(:save).and_return(false) - put :update, {:id => team.to_param, :team => { }}, valid_session - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested team" do - team = Team.create! valid_attributes - expect { - delete :destroy, {:id => team.to_param}, valid_session - }.to change(Team, :count).by(-1) - end - - it "redirects to the teams list" do - team = Team.create! valid_attributes - delete :destroy, {:id => team.to_param}, valid_session - response.should redirect_to(teams_url) - end - end - -end diff --git a/spec/controllers/tournaments_controller_spec.rb b/spec/controllers/tournaments_controller_spec.rb deleted file mode 100644 index f7b6e19..0000000 --- a/spec/controllers/tournaments_controller_spec.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'spec_helper' - -# This spec was generated by rspec-rails when you ran the scaffold generator. -# It demonstrates how one might use RSpec to specify the controller code that -# was generated by Rails when you ran the scaffold generator. -# -# It assumes that the implementation code is generated by the rails scaffold -# generator. If you are using any extension libraries to generate different -# controller code, this generated spec may or may not pass. -# -# It only uses APIs available in rails and/or rspec-rails. There are a number -# of tools you can use to make these specs even more expressive, but we're -# sticking to rails and rspec-rails APIs to keep things simple and stable. -# -# Compared to earlier versions of this generator, there is very limited use of -# stubs and message expectations in this spec. Stubs are only used when there -# is no simpler way to get a handle on the object needed for the example. -# Message expectations are only used when there is no simpler way to specify -# that an instance is receiving a specific message. - -describe TournamentsController do - - # This should return the minimal set of attributes required to create a valid - # Tournament. As you add validations to Tournament, be sure to - # adjust the attributes here as well. - let(:valid_attributes) { { "game" => "" } } - - # 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 - # TournamentsController. Be sure to keep this updated too. - let(:valid_session) { {} } - - describe "GET index" do - it "assigns all tournaments as @tournaments" do - tournament = Tournament.create! valid_attributes - get :index, {}, valid_session - assigns(:tournaments).should eq([tournament]) - end - end - - describe "GET show" do - it "assigns the requested tournament as @tournament" do - tournament = Tournament.create! valid_attributes - get :show, {:id => tournament.to_param}, valid_session - assigns(:tournament).should eq(tournament) - end - end - - describe "GET new" do - it "assigns a new tournament as @tournament" do - get :new, {}, valid_session - assigns(:tournament).should be_a_new(Tournament) - end - end - - describe "GET edit" do - it "assigns the requested tournament as @tournament" do - tournament = Tournament.create! valid_attributes - get :edit, {:id => tournament.to_param}, valid_session - assigns(:tournament).should eq(tournament) - end - end - - describe "POST create" do - describe "with valid params" do - it "creates a new Tournament" do - expect { - post :create, {:tournament => valid_attributes}, valid_session - }.to change(Tournament, :count).by(1) - end - - it "assigns a newly created tournament as @tournament" do - post :create, {:tournament => valid_attributes}, valid_session - assigns(:tournament).should be_a(Tournament) - assigns(:tournament).should be_persisted - end - - it "redirects to the created tournament" do - post :create, {:tournament => valid_attributes}, valid_session - response.should redirect_to(Tournament.last) - end - end - - describe "with invalid params" do - it "assigns a newly created but unsaved tournament as @tournament" do - # Trigger the behavior that occurs when invalid params are submitted - Tournament.any_instance.stub(:save).and_return(false) - post :create, {:tournament => { "game" => "invalid value" }}, valid_session - assigns(:tournament).should be_a_new(Tournament) - end - - it "re-renders the 'new' template" do - # Trigger the behavior that occurs when invalid params are submitted - Tournament.any_instance.stub(:save).and_return(false) - post :create, {:tournament => { "game" => "invalid value" }}, valid_session - response.should render_template("new") - end - end - end - - describe "PUT update" do - describe "with valid params" do - it "updates the requested tournament" do - tournament = Tournament.create! valid_attributes - # Assuming there are no other tournaments in the database, this - # specifies that the Tournament created on the previous line - # receives the :update_attributes message with whatever params are - # submitted in the request. - Tournament.any_instance.should_receive(:update).with({ "game" => "" }) - put :update, {:id => tournament.to_param, :tournament => { "game" => "" }}, valid_session - end - - it "assigns the requested tournament as @tournament" do - tournament = Tournament.create! valid_attributes - put :update, {:id => tournament.to_param, :tournament => valid_attributes}, valid_session - assigns(:tournament).should eq(tournament) - end - - it "redirects to the tournament" do - tournament = Tournament.create! valid_attributes - put :update, {:id => tournament.to_param, :tournament => valid_attributes}, valid_session - response.should redirect_to(tournament) - end - end - - describe "with invalid params" do - it "assigns the tournament as @tournament" do - tournament = Tournament.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Tournament.any_instance.stub(:save).and_return(false) - put :update, {:id => tournament.to_param, :tournament => { "game" => "invalid value" }}, valid_session - assigns(:tournament).should eq(tournament) - end - - it "re-renders the 'edit' template" do - tournament = Tournament.create! valid_attributes - # Trigger the behavior that occurs when invalid params are submitted - Tournament.any_instance.stub(:save).and_return(false) - put :update, {:id => tournament.to_param, :tournament => { "game" => "invalid value" }}, valid_session - response.should render_template("edit") - end - end - end - - describe "DELETE destroy" do - it "destroys the requested tournament" do - tournament = Tournament.create! valid_attributes - expect { - delete :destroy, {:id => tournament.to_param}, valid_session - }.to change(Tournament, :count).by(-1) - end - - it "redirects to the tournaments list" do - tournament = Tournament.create! valid_attributes - delete :destroy, {:id => tournament.to_param}, valid_session - response.should redirect_to(tournaments_url) - end - end - -end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb deleted file mode 100644 index 142455c..0000000 --- a/spec/controllers/users_controller_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe UsersController do - -end diff --git a/spec/helpers/alerts_helper_spec.rb b/spec/helpers/alerts_helper_spec.rb deleted file mode 100644 index 812e415..0000000 --- a/spec/helpers/alerts_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the AlertsHelper. For example: -# -# describe AlertsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe AlertsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/games_helper_spec.rb b/spec/helpers/games_helper_spec.rb deleted file mode 100644 index 72addeb..0000000 --- a/spec/helpers/games_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the GamesHelper. For example: -# -# describe GamesHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe GamesHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/main_helper_spec.rb b/spec/helpers/main_helper_spec.rb deleted file mode 100644 index 9d316c5..0000000 --- a/spec/helpers/main_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the MainHelper. For example: -# -# describe MainHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe MainHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/matches_helper_spec.rb b/spec/helpers/matches_helper_spec.rb deleted file mode 100644 index 271cd00..0000000 --- a/spec/helpers/matches_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the MatchesHelper. For example: -# -# describe MatchesHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe MatchesHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/pms_helper_spec.rb b/spec/helpers/pms_helper_spec.rb deleted file mode 100644 index 5ebf709..0000000 --- a/spec/helpers/pms_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the PmsHelper. For example: -# -# describe PmsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe PmsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb deleted file mode 100644 index fabfe99..0000000 --- a/spec/helpers/search_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the SearchHelper. For example: -# -# describe SearchHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe SearchHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/servers_helper_spec.rb b/spec/helpers/servers_helper_spec.rb deleted file mode 100644 index 487d1e4..0000000 --- a/spec/helpers/servers_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the ServersHelper. For example: -# -# describe ServersHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe ServersHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/sessions_helper_spec.rb b/spec/helpers/sessions_helper_spec.rb deleted file mode 100644 index c14cfa5..0000000 --- a/spec/helpers/sessions_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the SessionsHelper. For example: -# -# describe SessionsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe SessionsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/static_helper_spec.rb b/spec/helpers/static_helper_spec.rb deleted file mode 100644 index 6a1bf5c..0000000 --- a/spec/helpers/static_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the StaticHelper. For example: -# -# describe StaticHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe StaticHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/teams_helper_spec.rb b/spec/helpers/teams_helper_spec.rb deleted file mode 100644 index 9572616..0000000 --- a/spec/helpers/teams_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the TeamsHelper. For example: -# -# describe TeamsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe TeamsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/tournaments_helper_spec.rb b/spec/helpers/tournaments_helper_spec.rb deleted file mode 100644 index c7eb224..0000000 --- a/spec/helpers/tournaments_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the TournamentsHelper. For example: -# -# describe TournamentsHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe TournamentsHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb deleted file mode 100644 index e65fff9..0000000 --- a/spec/helpers/users_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -# Specs in this file have access to a helper object that includes -# the UsersHelper. For example: -# -# describe UsersHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" -# end -# end -# end -describe UsersHelper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/alert_spec.rb b/spec/models/alert_spec.rb deleted file mode 100644 index d7fa4af..0000000 --- a/spec/models/alert_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Alert do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/game_attribute_spec.rb b/spec/models/game_attribute_spec.rb deleted file mode 100644 index 200e59b..0000000 --- a/spec/models/game_attribute_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe GameAttribute do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/game_spec.rb b/spec/models/game_spec.rb deleted file mode 100644 index 8c56446..0000000 --- a/spec/models/game_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Game do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/match_spec.rb b/spec/models/match_spec.rb deleted file mode 100644 index 86931c9..0000000 --- a/spec/models/match_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Match do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/pm_spec.rb b/spec/models/pm_spec.rb deleted file mode 100644 index d56845b..0000000 --- a/spec/models/pm_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Pm do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/server_settings_spec.rb b/spec/models/server_settings_spec.rb deleted file mode 100644 index d579746..0000000 --- a/spec/models/server_settings_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe ServerSettings do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/server_spec.rb b/spec/models/server_spec.rb deleted file mode 100644 index 646344a..0000000 --- a/spec/models/server_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Server do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/team_match_pair_spec.rb b/spec/models/team_match_pair_spec.rb deleted file mode 100644 index 676c563..0000000 --- a/spec/models/team_match_pair_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe TeamMatchPair do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb deleted file mode 100644 index 666a904..0000000 --- a/spec/models/team_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Team do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/tournament_option_spec.rb b/spec/models/tournament_option_spec.rb deleted file mode 100644 index 501b316..0000000 --- a/spec/models/tournament_option_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe TournamentOption do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/tournament_spec.rb b/spec/models/tournament_spec.rb deleted file mode 100644 index 56c919d..0000000 --- a/spec/models/tournament_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe Tournament do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb deleted file mode 100644 index 44032b4..0000000 --- a/spec/models/user_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe User do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/user_team_pair_spec.rb b/spec/models/user_team_pair_spec.rb deleted file mode 100644 index 9947368..0000000 --- a/spec/models/user_team_pair_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe UserTeamPair do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/requests/alerts_spec.rb b/spec/requests/alerts_spec.rb deleted file mode 100644 index 03c332a..0000000 --- a/spec/requests/alerts_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Alerts" do - describe "GET /alerts" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get alerts_path - response.status.should be(200) - end - end -end diff --git a/spec/requests/games_spec.rb b/spec/requests/games_spec.rb deleted file mode 100644 index 1a84608..0000000 --- a/spec/requests/games_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Games" do - describe "GET /games" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get games_path - response.status.should be(200) - end - end -end diff --git a/spec/requests/matches_spec.rb b/spec/requests/matches_spec.rb deleted file mode 100644 index 250f746..0000000 --- a/spec/requests/matches_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Matches" do - describe "GET /matches" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get matches_path - response.status.should be(200) - end - end -end diff --git a/spec/requests/pms_spec.rb b/spec/requests/pms_spec.rb deleted file mode 100644 index 1862b87..0000000 --- a/spec/requests/pms_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Pms" do - describe "GET /pms" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get pms_path - response.status.should be(200) - end - end -end diff --git a/spec/requests/servers_spec.rb b/spec/requests/servers_spec.rb deleted file mode 100644 index 2a1562e..0000000 --- a/spec/requests/servers_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Servers" do - describe "GET /servers" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get servers_path - response.status.should be(200) - end - end -end diff --git a/spec/requests/teams_spec.rb b/spec/requests/teams_spec.rb deleted file mode 100644 index f0caf7a..0000000 --- a/spec/requests/teams_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Teams" do - describe "GET /teams" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get teams_path - response.status.should be(200) - end - end -end diff --git a/spec/requests/tournaments_spec.rb b/spec/requests/tournaments_spec.rb deleted file mode 100644 index 09b4b55..0000000 --- a/spec/requests/tournaments_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe "Tournaments" do - describe "GET /tournaments" do - it "works! (now write some real specs)" do - # Run the generator again with the --webrat flag if you want to use webrat methods/matchers - get tournaments_path - response.status.should be(200) - end - end -end diff --git a/spec/routing/alerts_routing_spec.rb b/spec/routing/alerts_routing_spec.rb deleted file mode 100644 index 9485907..0000000 --- a/spec/routing/alerts_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe AlertsController do - describe "routing" do - - it "routes to #index" do - get("/alerts").should route_to("alerts#index") - end - - it "routes to #new" do - get("/alerts/new").should route_to("alerts#new") - end - - it "routes to #show" do - get("/alerts/1").should route_to("alerts#show", :id => "1") - end - - it "routes to #edit" do - get("/alerts/1/edit").should route_to("alerts#edit", :id => "1") - end - - it "routes to #create" do - post("/alerts").should route_to("alerts#create") - end - - it "routes to #update" do - put("/alerts/1").should route_to("alerts#update", :id => "1") - end - - it "routes to #destroy" do - delete("/alerts/1").should route_to("alerts#destroy", :id => "1") - end - - end -end diff --git a/spec/routing/games_routing_spec.rb b/spec/routing/games_routing_spec.rb deleted file mode 100644 index 3b3ec0c..0000000 --- a/spec/routing/games_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe GamesController do - describe "routing" do - - it "routes to #index" do - get("/games").should route_to("games#index") - end - - it "routes to #new" do - get("/games/new").should route_to("games#new") - end - - it "routes to #show" do - get("/games/1").should route_to("games#show", :id => "1") - end - - it "routes to #edit" do - get("/games/1/edit").should route_to("games#edit", :id => "1") - end - - it "routes to #create" do - post("/games").should route_to("games#create") - end - - it "routes to #update" do - put("/games/1").should route_to("games#update", :id => "1") - end - - it "routes to #destroy" do - delete("/games/1").should route_to("games#destroy", :id => "1") - end - - end -end diff --git a/spec/routing/matches_routing_spec.rb b/spec/routing/matches_routing_spec.rb deleted file mode 100644 index a9f8254..0000000 --- a/spec/routing/matches_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe MatchesController do - describe "routing" do - - it "routes to #index" do - get("/matches").should route_to("matches#index") - end - - it "routes to #new" do - get("/matches/new").should route_to("matches#new") - end - - it "routes to #show" do - get("/matches/1").should route_to("matches#show", :id => "1") - end - - it "routes to #edit" do - get("/matches/1/edit").should route_to("matches#edit", :id => "1") - end - - it "routes to #create" do - post("/matches").should route_to("matches#create") - end - - it "routes to #update" do - put("/matches/1").should route_to("matches#update", :id => "1") - end - - it "routes to #destroy" do - delete("/matches/1").should route_to("matches#destroy", :id => "1") - end - - end -end diff --git a/spec/routing/pms_routing_spec.rb b/spec/routing/pms_routing_spec.rb deleted file mode 100644 index 839b0a9..0000000 --- a/spec/routing/pms_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe PmsController do - describe "routing" do - - it "routes to #index" do - get("/pms").should route_to("pms#index") - end - - it "routes to #new" do - get("/pms/new").should route_to("pms#new") - end - - it "routes to #show" do - get("/pms/1").should route_to("pms#show", :id => "1") - end - - it "routes to #edit" do - get("/pms/1/edit").should route_to("pms#edit", :id => "1") - end - - it "routes to #create" do - post("/pms").should route_to("pms#create") - end - - it "routes to #update" do - put("/pms/1").should route_to("pms#update", :id => "1") - end - - it "routes to #destroy" do - delete("/pms/1").should route_to("pms#destroy", :id => "1") - end - - end -end diff --git a/spec/routing/servers_routing_spec.rb b/spec/routing/servers_routing_spec.rb deleted file mode 100644 index e514d15..0000000 --- a/spec/routing/servers_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe ServersController do - describe "routing" do - - it "routes to #index" do - get("/servers").should route_to("servers#index") - end - - it "routes to #new" do - get("/servers/new").should route_to("servers#new") - end - - it "routes to #show" do - get("/servers/1").should route_to("servers#show", :id => "1") - end - - it "routes to #edit" do - get("/servers/1/edit").should route_to("servers#edit", :id => "1") - end - - it "routes to #create" do - post("/servers").should route_to("servers#create") - end - - it "routes to #update" do - put("/servers/1").should route_to("servers#update", :id => "1") - end - - it "routes to #destroy" do - delete("/servers/1").should route_to("servers#destroy", :id => "1") - end - - end -end diff --git a/spec/routing/teams_routing_spec.rb b/spec/routing/teams_routing_spec.rb deleted file mode 100644 index 818fa7b..0000000 --- a/spec/routing/teams_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe TeamsController do - describe "routing" do - - it "routes to #index" do - get("/teams").should route_to("teams#index") - end - - it "routes to #new" do - get("/teams/new").should route_to("teams#new") - end - - it "routes to #show" do - get("/teams/1").should route_to("teams#show", :id => "1") - end - - it "routes to #edit" do - get("/teams/1/edit").should route_to("teams#edit", :id => "1") - end - - it "routes to #create" do - post("/teams").should route_to("teams#create") - end - - it "routes to #update" do - put("/teams/1").should route_to("teams#update", :id => "1") - end - - it "routes to #destroy" do - delete("/teams/1").should route_to("teams#destroy", :id => "1") - end - - end -end diff --git a/spec/routing/tournaments_routing_spec.rb b/spec/routing/tournaments_routing_spec.rb deleted file mode 100644 index e4a229c..0000000 --- a/spec/routing/tournaments_routing_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "spec_helper" - -describe TournamentsController do - describe "routing" do - - it "routes to #index" do - get("/tournaments").should route_to("tournaments#index") - end - - it "routes to #new" do - get("/tournaments/new").should route_to("tournaments#new") - end - - it "routes to #show" do - get("/tournaments/1").should route_to("tournaments#show", :id => "1") - end - - it "routes to #edit" do - get("/tournaments/1/edit").should route_to("tournaments#edit", :id => "1") - end - - it "routes to #create" do - post("/tournaments").should route_to("tournaments#create") - end - - it "routes to #update" do - put("/tournaments/1").should route_to("tournaments#update", :id => "1") - end - - it "routes to #destroy" do - delete("/tournaments/1").should route_to("tournaments#destroy", :id => "1") - end - - end -end diff --git a/spec/views/alerts/edit.html.erb_spec.rb b/spec/views/alerts/edit.html.erb_spec.rb deleted file mode 100644 index d837f26..0000000 --- a/spec/views/alerts/edit.html.erb_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe "alerts/edit" do - before(:each) do - @alert = assign(:alert, stub_model(Alert, - :author => nil, - :message => "MyText" - )) - end - - it "renders the edit alert form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", alert_path(@alert), "post" do - assert_select "input#alert_author[name=?]", "alert[author]" - assert_select "textarea#alert_message[name=?]", "alert[message]" - end - end -end diff --git a/spec/views/alerts/index.html.erb_spec.rb b/spec/views/alerts/index.html.erb_spec.rb deleted file mode 100644 index a5b4f3c..0000000 --- a/spec/views/alerts/index.html.erb_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' - -describe "alerts/index" do - before(:each) do - assign(:alerts, [ - stub_model(Alert, - :author => nil, - :message => "MyText" - ), - stub_model(Alert, - :author => nil, - :message => "MyText" - ) - ]) - end - - it "renders a list of alerts" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => nil.to_s, :count => 2 - assert_select "tr>td", :text => "MyText".to_s, :count => 2 - end -end diff --git a/spec/views/alerts/new.html.erb_spec.rb b/spec/views/alerts/new.html.erb_spec.rb deleted file mode 100644 index e38cbd3..0000000 --- a/spec/views/alerts/new.html.erb_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe "alerts/new" do - before(:each) do - assign(:alert, stub_model(Alert, - :author => nil, - :message => "MyText" - ).as_new_record) - end - - it "renders new alert form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", alerts_path, "post" do - assert_select "input#alert_author[name=?]", "alert[author]" - assert_select "textarea#alert_message[name=?]", "alert[message]" - end - end -end diff --git a/spec/views/alerts/show.html.erb_spec.rb b/spec/views/alerts/show.html.erb_spec.rb deleted file mode 100644 index 267c9f1..0000000 --- a/spec/views/alerts/show.html.erb_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper' - -describe "alerts/show" do - before(:each) do - @alert = assign(:alert, stub_model(Alert, - :author => nil, - :message => "MyText" - )) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(//) - rendered.should match(/MyText/) - end -end diff --git a/spec/views/games/edit.html.erb_spec.rb b/spec/views/games/edit.html.erb_spec.rb deleted file mode 100644 index d568c90..0000000 --- a/spec/views/games/edit.html.erb_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper' - -describe "games/edit" do - before(:each) do - @game = assign(:game, stub_model(Game, - :name => "MyText", - :players_per_team => 1, - :teams_per_match => 1, - :set_rounds => 1, - :randomized_teams => 1 - )) - end - - it "renders the edit game form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", game_path(@game), "post" do - assert_select "textarea#game_name[name=?]", "game[name]" - assert_select "input#game_players_per_team[name=?]", "game[players_per_team]" - assert_select "input#game_teams_per_match[name=?]", "game[teams_per_match]" - assert_select "input#game_set_rounds[name=?]", "game[set_rounds]" - assert_select "input#game_randomized_teams[name=?]", "game[randomized_teams]" - end - end -end diff --git a/spec/views/games/index.html.erb_spec.rb b/spec/views/games/index.html.erb_spec.rb deleted file mode 100644 index 3107393..0000000 --- a/spec/views/games/index.html.erb_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'spec_helper' - -describe "games/index" do - before(:each) do - assign(:games, [ - stub_model(Game, - :name => "MyText", - :players_per_team => 1, - :teams_per_match => 2, - :set_rounds => 3, - :randomized_teams => 4 - ), - stub_model(Game, - :name => "MyText", - :players_per_team => 1, - :teams_per_match => 2, - :set_rounds => 3, - :randomized_teams => 4 - ) - ]) - end - - it "renders a list of games" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => "MyText".to_s, :count => 2 - assert_select "tr>td", :text => 1.to_s, :count => 2 - assert_select "tr>td", :text => 2.to_s, :count => 2 - assert_select "tr>td", :text => 3.to_s, :count => 2 - assert_select "tr>td", :text => 4.to_s, :count => 2 - end -end diff --git a/spec/views/games/new.html.erb_spec.rb b/spec/views/games/new.html.erb_spec.rb deleted file mode 100644 index ebe6113..0000000 --- a/spec/views/games/new.html.erb_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper' - -describe "games/new" do - before(:each) do - assign(:game, stub_model(Game, - :name => "MyText", - :players_per_team => 1, - :teams_per_match => 1, - :set_rounds => 1, - :randomized_teams => 1 - ).as_new_record) - end - - it "renders new game form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", games_path, "post" do - assert_select "textarea#game_name[name=?]", "game[name]" - assert_select "input#game_players_per_team[name=?]", "game[players_per_team]" - assert_select "input#game_teams_per_match[name=?]", "game[teams_per_match]" - assert_select "input#game_set_rounds[name=?]", "game[set_rounds]" - assert_select "input#game_randomized_teams[name=?]", "game[randomized_teams]" - end - end -end diff --git a/spec/views/games/show.html.erb_spec.rb b/spec/views/games/show.html.erb_spec.rb deleted file mode 100644 index fb75ad6..0000000 --- a/spec/views/games/show.html.erb_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' - -describe "games/show" do - before(:each) do - @game = assign(:game, stub_model(Game, - :name => "MyText", - :players_per_team => 1, - :teams_per_match => 2, - :set_rounds => 3, - :randomized_teams => 4 - )) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(/MyText/) - rendered.should match(/1/) - rendered.should match(/2/) - rendered.should match(/3/) - rendered.should match(/4/) - end -end diff --git a/spec/views/matches/edit.html.erb_spec.rb b/spec/views/matches/edit.html.erb_spec.rb deleted file mode 100644 index fca468f..0000000 --- a/spec/views/matches/edit.html.erb_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe "matches/edit" do - before(:each) do - @match = assign(:match, stub_model(Match, - :tournament => nil, - :name => "MyString" - )) - end - - it "renders the edit match form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", match_path(@match), "post" do - assert_select "input#match_tournament[name=?]", "match[tournament]" - assert_select "input#match_name[name=?]", "match[name]" - end - end -end diff --git a/spec/views/matches/index.html.erb_spec.rb b/spec/views/matches/index.html.erb_spec.rb deleted file mode 100644 index d3be1b5..0000000 --- a/spec/views/matches/index.html.erb_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' - -describe "matches/index" do - before(:each) do - assign(:matches, [ - stub_model(Match, - :tournament => nil, - :name => "Name" - ), - stub_model(Match, - :tournament => nil, - :name => "Name" - ) - ]) - end - - it "renders a list of matches" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => nil.to_s, :count => 2 - assert_select "tr>td", :text => "Name".to_s, :count => 2 - end -end diff --git a/spec/views/matches/new.html.erb_spec.rb b/spec/views/matches/new.html.erb_spec.rb deleted file mode 100644 index 4423d2c..0000000 --- a/spec/views/matches/new.html.erb_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe "matches/new" do - before(:each) do - assign(:match, stub_model(Match, - :tournament => nil, - :name => "MyString" - ).as_new_record) - end - - it "renders new match form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", matches_path, "post" do - assert_select "input#match_tournament[name=?]", "match[tournament]" - assert_select "input#match_name[name=?]", "match[name]" - end - end -end diff --git a/spec/views/matches/show.html.erb_spec.rb b/spec/views/matches/show.html.erb_spec.rb deleted file mode 100644 index 642119d..0000000 --- a/spec/views/matches/show.html.erb_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper' - -describe "matches/show" do - before(:each) do - @match = assign(:match, stub_model(Match, - :tournament => nil, - :name => "Name" - )) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(//) - rendered.should match(/Name/) - end -end diff --git a/spec/views/pms/edit.html.erb_spec.rb b/spec/views/pms/edit.html.erb_spec.rb deleted file mode 100644 index 5ec0de5..0000000 --- a/spec/views/pms/edit.html.erb_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe "pms/edit" do - before(:each) do - @pm = assign(:pm, stub_model(Pm, - :author => nil, - :recipient => nil, - :message => "MyText" - )) - end - - it "renders the edit pm form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", pm_path(@pm), "post" do - assert_select "input#pm_author[name=?]", "pm[author]" - assert_select "input#pm_recipient[name=?]", "pm[recipient]" - assert_select "textarea#pm_message[name=?]", "pm[message]" - end - end -end diff --git a/spec/views/pms/index.html.erb_spec.rb b/spec/views/pms/index.html.erb_spec.rb deleted file mode 100644 index a3bc733..0000000 --- a/spec/views/pms/index.html.erb_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper' - -describe "pms/index" do - before(:each) do - assign(:pms, [ - stub_model(Pm, - :author => nil, - :recipient => nil, - :message => "MyText" - ), - stub_model(Pm, - :author => nil, - :recipient => nil, - :message => "MyText" - ) - ]) - end - - it "renders a list of pms" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => nil.to_s, :count => 2 - assert_select "tr>td", :text => nil.to_s, :count => 2 - assert_select "tr>td", :text => "MyText".to_s, :count => 2 - end -end diff --git a/spec/views/pms/new.html.erb_spec.rb b/spec/views/pms/new.html.erb_spec.rb deleted file mode 100644 index 342af96..0000000 --- a/spec/views/pms/new.html.erb_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe "pms/new" do - before(:each) do - assign(:pm, stub_model(Pm, - :author => nil, - :recipient => nil, - :message => "MyText" - ).as_new_record) - end - - it "renders new pm form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", pms_path, "post" do - assert_select "input#pm_author[name=?]", "pm[author]" - assert_select "input#pm_recipient[name=?]", "pm[recipient]" - assert_select "textarea#pm_message[name=?]", "pm[message]" - end - end -end diff --git a/spec/views/pms/show.html.erb_spec.rb b/spec/views/pms/show.html.erb_spec.rb deleted file mode 100644 index 5802887..0000000 --- a/spec/views/pms/show.html.erb_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe "pms/show" do - before(:each) do - @pm = assign(:pm, stub_model(Pm, - :author => nil, - :recipient => nil, - :message => "MyText" - )) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(//) - rendered.should match(//) - rendered.should match(/MyText/) - end -end diff --git a/spec/views/servers/edit.html.erb_spec.rb b/spec/views/servers/edit.html.erb_spec.rb deleted file mode 100644 index 870126c..0000000 --- a/spec/views/servers/edit.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe "servers/edit" do - before(:each) do - @server = assign(:server, stub_model(Server)) - end - - it "renders the edit server form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", server_path(@server), "post" do - end - end -end diff --git a/spec/views/servers/index.html.erb_spec.rb b/spec/views/servers/index.html.erb_spec.rb deleted file mode 100644 index 9af4a19..0000000 --- a/spec/views/servers/index.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe "servers/index" do - before(:each) do - assign(:servers, [ - stub_model(Server), - stub_model(Server) - ]) - end - - it "renders a list of servers" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - end -end diff --git a/spec/views/servers/new.html.erb_spec.rb b/spec/views/servers/new.html.erb_spec.rb deleted file mode 100644 index bfc69c5..0000000 --- a/spec/views/servers/new.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe "servers/new" do - before(:each) do - assign(:server, stub_model(Server).as_new_record) - end - - it "renders new server form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", servers_path, "post" do - end - end -end diff --git a/spec/views/servers/show.html.erb_spec.rb b/spec/views/servers/show.html.erb_spec.rb deleted file mode 100644 index 3762389..0000000 --- a/spec/views/servers/show.html.erb_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe "servers/show" do - before(:each) do - @server = assign(:server, stub_model(Server)) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - end -end diff --git a/spec/views/teams/edit.html.erb_spec.rb b/spec/views/teams/edit.html.erb_spec.rb deleted file mode 100644 index 1153b6d..0000000 --- a/spec/views/teams/edit.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe "teams/edit" do - before(:each) do - @team = assign(:team, stub_model(Team)) - end - - it "renders the edit team form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", team_path(@team), "post" do - end - end -end diff --git a/spec/views/teams/index.html.erb_spec.rb b/spec/views/teams/index.html.erb_spec.rb deleted file mode 100644 index e894f36..0000000 --- a/spec/views/teams/index.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe "teams/index" do - before(:each) do - assign(:teams, [ - stub_model(Team), - stub_model(Team) - ]) - end - - it "renders a list of teams" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - end -end diff --git a/spec/views/teams/new.html.erb_spec.rb b/spec/views/teams/new.html.erb_spec.rb deleted file mode 100644 index 6a05475..0000000 --- a/spec/views/teams/new.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe "teams/new" do - before(:each) do - assign(:team, stub_model(Team).as_new_record) - end - - it "renders new team form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", teams_path, "post" do - end - end -end diff --git a/spec/views/teams/show.html.erb_spec.rb b/spec/views/teams/show.html.erb_spec.rb deleted file mode 100644 index 1d8ebd5..0000000 --- a/spec/views/teams/show.html.erb_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe "teams/show" do - before(:each) do - @team = assign(:team, stub_model(Team)) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - end -end diff --git a/spec/views/tournaments/edit.html.erb_spec.rb b/spec/views/tournaments/edit.html.erb_spec.rb deleted file mode 100644 index db7cbb5..0000000 --- a/spec/views/tournaments/edit.html.erb_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' - -describe "tournaments/edit" do - before(:each) do - @tournament = assign(:tournament, stub_model(Tournament, - :game => nil - )) - end - - it "renders the edit tournament form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", tournament_path(@tournament), "post" do - assert_select "input#tournament_game[name=?]", "tournament[game]" - end - end -end diff --git a/spec/views/tournaments/index.html.erb_spec.rb b/spec/views/tournaments/index.html.erb_spec.rb deleted file mode 100644 index bf36e06..0000000 --- a/spec/views/tournaments/index.html.erb_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe "tournaments/index" do - before(:each) do - assign(:tournaments, [ - stub_model(Tournament, - :game => nil - ), - stub_model(Tournament, - :game => nil - ) - ]) - end - - it "renders a list of tournaments" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "tr>td", :text => nil.to_s, :count => 2 - end -end diff --git a/spec/views/tournaments/new.html.erb_spec.rb b/spec/views/tournaments/new.html.erb_spec.rb deleted file mode 100644 index 49785a4..0000000 --- a/spec/views/tournaments/new.html.erb_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' - -describe "tournaments/new" do - before(:each) do - assign(:tournament, stub_model(Tournament, - :game => nil - ).as_new_record) - end - - it "renders new tournament form" do - render - - # Run the generator again with the --webrat flag if you want to use webrat matchers - assert_select "form[action=?][method=?]", tournaments_path, "post" do - assert_select "input#tournament_game[name=?]", "tournament[game]" - end - end -end diff --git a/spec/views/tournaments/show.html.erb_spec.rb b/spec/views/tournaments/show.html.erb_spec.rb deleted file mode 100644 index abb1879..0000000 --- a/spec/views/tournaments/show.html.erb_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe "tournaments/show" do - before(:each) do - @tournament = assign(:tournament, stub_model(Tournament, - :game => nil - )) - end - - it "renders attributes in

" do - render - # Run the generator again with the --webrat flag if you want to use webrat matchers - rendered.should match(//) - end -end diff --git a/test/controllers/.keep b/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/controllers/alerts_controller_test.rb b/test/controllers/alerts_controller_test.rb new file mode 100644 index 0000000..4a5d911 --- /dev/null +++ b/test/controllers/alerts_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class AlertsControllerTest < ActionController::TestCase + setup do + @alert = alerts(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:alerts) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create alert" do + assert_difference('Alert.count') do + post :create, alert: { author_id: @alert.author_id, message: @alert.message } + end + + assert_redirected_to alert_path(assigns(:alert)) + end + + test "should show alert" do + get :show, id: @alert + assert_response :success + end + + test "should get edit" do + get :edit, id: @alert + assert_response :success + end + + test "should update alert" do + patch :update, id: @alert, alert: { author_id: @alert.author_id, message: @alert.message } + assert_redirected_to alert_path(assigns(:alert)) + end + + test "should destroy alert" do + assert_difference('Alert.count', -1) do + delete :destroy, id: @alert + end + + assert_redirected_to alerts_path + end +end diff --git a/test/controllers/games_controller_test.rb b/test/controllers/games_controller_test.rb new file mode 100644 index 0000000..95c3145 --- /dev/null +++ b/test/controllers/games_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class GamesControllerTest < ActionController::TestCase + setup do + @game = games(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:games) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create game" do + assert_difference('Game.count') do + post :create, game: { name: @game.name, players_per_team: @game.players_per_team, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds, teams_per_match: @game.teams_per_match } + end + + assert_redirected_to game_path(assigns(:game)) + end + + test "should show game" do + get :show, id: @game + assert_response :success + end + + test "should get edit" do + get :edit, id: @game + assert_response :success + end + + test "should update game" do + patch :update, id: @game, game: { name: @game.name, players_per_team: @game.players_per_team, randomized_teams: @game.randomized_teams, set_rounds: @game.set_rounds, teams_per_match: @game.teams_per_match } + assert_redirected_to game_path(assigns(:game)) + end + + test "should destroy game" do + assert_difference('Game.count', -1) do + delete :destroy, id: @game + end + + assert_redirected_to games_path + end +end diff --git a/test/controllers/main_controller_test.rb b/test/controllers/main_controller_test.rb new file mode 100644 index 0000000..b7ec6bf --- /dev/null +++ b/test/controllers/main_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MainControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb new file mode 100644 index 0000000..50675d8 --- /dev/null +++ b/test/controllers/matches_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class MatchesControllerTest < ActionController::TestCase + setup do + @match = matches(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:matches) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create match" do + assert_difference('Match.count') do + post :create, match: { name: @match.name, tournament_id: @match.tournament_id } + end + + assert_redirected_to match_path(assigns(:match)) + end + + test "should show match" do + get :show, id: @match + assert_response :success + end + + test "should get edit" do + get :edit, id: @match + assert_response :success + end + + test "should update match" do + patch :update, id: @match, match: { name: @match.name, tournament_id: @match.tournament_id } + assert_redirected_to match_path(assigns(:match)) + end + + test "should destroy match" do + assert_difference('Match.count', -1) do + delete :destroy, id: @match + end + + assert_redirected_to matches_path + end +end diff --git a/test/controllers/pms_controller_test.rb b/test/controllers/pms_controller_test.rb new file mode 100644 index 0000000..18b2449 --- /dev/null +++ b/test/controllers/pms_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class PmsControllerTest < ActionController::TestCase + setup do + @pm = pms(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:pms) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create pm" do + assert_difference('Pm.count') do + post :create, pm: { author_id: @pm.author_id, message: @pm.message, recipient_id: @pm.recipient_id } + end + + assert_redirected_to pm_path(assigns(:pm)) + end + + test "should show pm" do + get :show, id: @pm + assert_response :success + end + + test "should get edit" do + get :edit, id: @pm + assert_response :success + end + + test "should update pm" do + patch :update, id: @pm, pm: { author_id: @pm.author_id, message: @pm.message, recipient_id: @pm.recipient_id } + assert_redirected_to pm_path(assigns(:pm)) + end + + test "should destroy pm" do + assert_difference('Pm.count', -1) do + delete :destroy, id: @pm + end + + assert_redirected_to pms_path + end +end diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb new file mode 100644 index 0000000..bfbf22d --- /dev/null +++ b/test/controllers/search_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SearchControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/servers_controller_test.rb b/test/controllers/servers_controller_test.rb new file mode 100644 index 0000000..5891bb0 --- /dev/null +++ b/test/controllers/servers_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class ServersControllerTest < ActionController::TestCase + setup do + @server = servers(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:servers) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create server" do + assert_difference('Server.count') do + post :create, server: { } + end + + assert_redirected_to server_path(assigns(:server)) + end + + test "should show server" do + get :show, id: @server + assert_response :success + end + + test "should get edit" do + get :edit, id: @server + assert_response :success + end + + test "should update server" do + patch :update, id: @server, server: { } + assert_redirected_to server_path(assigns(:server)) + end + + test "should destroy server" do + assert_difference('Server.count', -1) do + delete :destroy, id: @server + end + + assert_redirected_to servers_path + end +end diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb new file mode 100644 index 0000000..d30ebc3 --- /dev/null +++ b/test/controllers/sessions_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SessionsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/static_controller_test.rb b/test/controllers/static_controller_test.rb new file mode 100644 index 0000000..e62ae2a --- /dev/null +++ b/test/controllers/static_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class StaticControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/teams_controller_test.rb b/test/controllers/teams_controller_test.rb new file mode 100644 index 0000000..8bf60be --- /dev/null +++ b/test/controllers/teams_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class TeamsControllerTest < ActionController::TestCase + setup do + @team = teams(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:teams) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create team" do + assert_difference('Team.count') do + post :create, team: { } + end + + assert_redirected_to team_path(assigns(:team)) + end + + test "should show team" do + get :show, id: @team + assert_response :success + end + + test "should get edit" do + get :edit, id: @team + assert_response :success + end + + test "should update team" do + patch :update, id: @team, team: { } + assert_redirected_to team_path(assigns(:team)) + end + + test "should destroy team" do + assert_difference('Team.count', -1) do + delete :destroy, id: @team + end + + assert_redirected_to teams_path + end +end diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb new file mode 100644 index 0000000..bdbbfac --- /dev/null +++ b/test/controllers/tournaments_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class TournamentsControllerTest < ActionController::TestCase + setup do + @tournament = tournaments(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:tournaments) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create tournament" do + assert_difference('Tournament.count') do + post :create, tournament: { game_id: @tournament.game_id } + end + + assert_redirected_to tournament_path(assigns(:tournament)) + end + + test "should show tournament" do + get :show, id: @tournament + assert_response :success + end + + test "should get edit" do + get :edit, id: @tournament + assert_response :success + end + + test "should update tournament" do + patch :update, id: @tournament, tournament: { game_id: @tournament.game_id } + assert_redirected_to tournament_path(assigns(:tournament)) + end + + test "should destroy tournament" do + assert_difference('Tournament.count', -1) do + delete :destroy, id: @tournament + end + + assert_redirected_to tournaments_path + end +end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb new file mode 100644 index 0000000..79a5700 --- /dev/null +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class UsersControllerTest < ActionController::TestCase + setup do + @user = users(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:users) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create user" do + assert_difference('User.count') do + post :create, user: { email: @user.email, name: @user.name, user_name: @user.user_name } + end + + assert_redirected_to user_path(assigns(:user)) + end + + test "should show user" do + get :show, id: @user + assert_response :success + end + + test "should get edit" do + get :edit, id: @user + assert_response :success + end + + test "should update user" do + patch :update, id: @user, user: { email: @user.email, name: @user.name, user_name: @user.user_name } + assert_redirected_to user_path(assigns(:user)) + end + + test "should destroy user" do + assert_difference('User.count', -1) do + delete :destroy, id: @user + end + + assert_redirected_to users_path + end +end diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/alerts.yml b/test/fixtures/alerts.yml new file mode 100644 index 0000000..52959af --- /dev/null +++ b/test/fixtures/alerts.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + author_id: + message: MyText + +two: + author_id: + message: MyText diff --git a/test/fixtures/game_attributes.yml b/test/fixtures/game_attributes.yml new file mode 100644 index 0000000..eff7212 --- /dev/null +++ b/test/fixtures/game_attributes.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + game_id: + key: MyText + type: 1 + +two: + game_id: + key: MyText + type: 1 diff --git a/test/fixtures/games.yml b/test/fixtures/games.yml new file mode 100644 index 0000000..3068527 --- /dev/null +++ b/test/fixtures/games.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyText + players_per_team: 1 + teams_per_match: 1 + set_rounds: 1 + randomized_teams: 1 + +two: + name: MyText + players_per_team: 1 + teams_per_match: 1 + set_rounds: 1 + randomized_teams: 1 diff --git a/test/fixtures/matches.yml b/test/fixtures/matches.yml new file mode 100644 index 0000000..089fc65 --- /dev/null +++ b/test/fixtures/matches.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + tournament_id: + name: MyString + +two: + tournament_id: + name: MyString diff --git a/test/fixtures/pms.yml b/test/fixtures/pms.yml new file mode 100644 index 0000000..f77e727 --- /dev/null +++ b/test/fixtures/pms.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + author_id: + recipient_id: + message: MyText + +two: + author_id: + recipient_id: + message: MyText diff --git a/test/fixtures/server_settings.yml b/test/fixtures/server_settings.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/server_settings.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/servers.yml b/test/fixtures/servers.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/servers.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/team_match_pairs.yml b/test/fixtures/team_match_pairs.yml new file mode 100644 index 0000000..5f9cf2f --- /dev/null +++ b/test/fixtures/team_match_pairs.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + team_id: + match_id: + +two: + team_id: + match_id: diff --git a/test/fixtures/teams.yml b/test/fixtures/teams.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/teams.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/tournament_options.yml b/test/fixtures/tournament_options.yml new file mode 100644 index 0000000..937a0c0 --- /dev/null +++ b/test/fixtures/tournament_options.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/tournaments.yml b/test/fixtures/tournaments.yml new file mode 100644 index 0000000..4cba7ca --- /dev/null +++ b/test/fixtures/tournaments.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + game_id: + +two: + game_id: diff --git a/test/fixtures/user_team_pairs.yml b/test/fixtures/user_team_pairs.yml new file mode 100644 index 0000000..a76036f --- /dev/null +++ b/test/fixtures/user_team_pairs.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + user_id: + team_id: + +two: + user_id: + team_id: diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..ea3e874 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + email: MyString + user_name: MyString + +two: + name: MyString + email: MyString + user_name: MyString diff --git a/test/helpers/.keep b/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/helpers/alerts_helper_test.rb b/test/helpers/alerts_helper_test.rb new file mode 100644 index 0000000..1d9079d --- /dev/null +++ b/test/helpers/alerts_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class AlertsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/games_helper_test.rb b/test/helpers/games_helper_test.rb new file mode 100644 index 0000000..449a85c --- /dev/null +++ b/test/helpers/games_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class GamesHelperTest < ActionView::TestCase +end diff --git a/test/helpers/main_helper_test.rb b/test/helpers/main_helper_test.rb new file mode 100644 index 0000000..22da3c4 --- /dev/null +++ b/test/helpers/main_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class MainHelperTest < ActionView::TestCase +end diff --git a/test/helpers/matches_helper_test.rb b/test/helpers/matches_helper_test.rb new file mode 100644 index 0000000..4cc472f --- /dev/null +++ b/test/helpers/matches_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class MatchesHelperTest < ActionView::TestCase +end diff --git a/test/helpers/pms_helper_test.rb b/test/helpers/pms_helper_test.rb new file mode 100644 index 0000000..af80f10 --- /dev/null +++ b/test/helpers/pms_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class PmsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/search_helper_test.rb b/test/helpers/search_helper_test.rb new file mode 100644 index 0000000..3034163 --- /dev/null +++ b/test/helpers/search_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SearchHelperTest < ActionView::TestCase +end diff --git a/test/helpers/servers_helper_test.rb b/test/helpers/servers_helper_test.rb new file mode 100644 index 0000000..8fddf34 --- /dev/null +++ b/test/helpers/servers_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ServersHelperTest < ActionView::TestCase +end diff --git a/test/helpers/sessions_helper_test.rb b/test/helpers/sessions_helper_test.rb new file mode 100644 index 0000000..7d44e09 --- /dev/null +++ b/test/helpers/sessions_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SessionsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/static_helper_test.rb b/test/helpers/static_helper_test.rb new file mode 100644 index 0000000..3b96f2b --- /dev/null +++ b/test/helpers/static_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class StaticHelperTest < ActionView::TestCase +end diff --git a/test/helpers/teams_helper_test.rb b/test/helpers/teams_helper_test.rb new file mode 100644 index 0000000..b736483 --- /dev/null +++ b/test/helpers/teams_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class TeamsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/tournaments_helper_test.rb b/test/helpers/tournaments_helper_test.rb new file mode 100644 index 0000000..1cf5269 --- /dev/null +++ b/test/helpers/tournaments_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class TournamentsHelperTest < ActionView::TestCase +end diff --git a/test/helpers/users_helper_test.rb b/test/helpers/users_helper_test.rb new file mode 100644 index 0000000..96af37a --- /dev/null +++ b/test/helpers/users_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class UsersHelperTest < ActionView::TestCase +end diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/models/alert_test.rb b/test/models/alert_test.rb new file mode 100644 index 0000000..b59c65e --- /dev/null +++ b/test/models/alert_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class AlertTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/game_attribute_test.rb b/test/models/game_attribute_test.rb new file mode 100644 index 0000000..13c6e65 --- /dev/null +++ b/test/models/game_attribute_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GameAttributeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/game_test.rb b/test/models/game_test.rb new file mode 100644 index 0000000..2cab36e --- /dev/null +++ b/test/models/game_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GameTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/match_test.rb b/test/models/match_test.rb new file mode 100644 index 0000000..14436b1 --- /dev/null +++ b/test/models/match_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MatchTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/pm_test.rb b/test/models/pm_test.rb new file mode 100644 index 0000000..e7f6b8f --- /dev/null +++ b/test/models/pm_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PmTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/server_settings_test.rb b/test/models/server_settings_test.rb new file mode 100644 index 0000000..470b316 --- /dev/null +++ b/test/models/server_settings_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ServerSettingsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/server_test.rb b/test/models/server_test.rb new file mode 100644 index 0000000..125ffc9 --- /dev/null +++ b/test/models/server_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ServerTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/team_match_pair_test.rb b/test/models/team_match_pair_test.rb new file mode 100644 index 0000000..c250b3c --- /dev/null +++ b/test/models/team_match_pair_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TeamMatchPairTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/team_test.rb b/test/models/team_test.rb new file mode 100644 index 0000000..8b101cb --- /dev/null +++ b/test/models/team_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TeamTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/tournament_option_test.rb b/test/models/tournament_option_test.rb new file mode 100644 index 0000000..8fa9628 --- /dev/null +++ b/test/models/tournament_option_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TournamentOptionTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/tournament_test.rb b/test/models/tournament_test.rb new file mode 100644 index 0000000..24a7e5f --- /dev/null +++ b/test/models/tournament_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TournamentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_team_pair_test.rb b/test/models/user_team_pair_test.rb new file mode 100644 index 0000000..55f5c58 --- /dev/null +++ b/test/models/user_team_pair_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTeamPairTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..bc7e05d --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,15 @@ +ENV["RAILS_ENV"] ||= "test" +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + ActiveRecord::Migration.check_pending! + + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end -- cgit v1.2.3-54-g00ecf From 1d90f33bf07f9610d358c6c9c56754784b050541 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Mar 2014 10:57:54 -0500 Subject: simplify the sessions routing --- app/controllers/sessions_controller.rb | 25 ++++++++++++++----------- app/views/layouts/application.html.erb | 17 +++++++++-------- app/views/sessions/new.html.erb | 2 +- app/views/static/homepage.html.erb | 4 ++-- app/views/users/new.html.erb | 2 +- config/routes.rb | 8 ++------ 6 files changed, 29 insertions(+), 29 deletions(-) (limited to 'app/views') diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 3417332..fa5d024 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,25 +1,28 @@ class SessionsController < ApplicationController + # GET /sessions/new def new if @user.nil? @user = User.new end end - # find the user and create a new session - def create - @user = User.find_by(email: params[:session][:email].downcase) - if @user && @user.authenticate(params[:session][:password]) + # POST /sessions + def create + # find the user... + @user = User.find_by(email: params[:session][:email].downcase) + # ... and create a new session + if @user && @user.authenticate(params[:session][:password]) sign_in @user - redirect_to root_path - else - redirect_to signin_path + redirect_to root_path + else + redirect_to new_session_path + end end - end + # DELETE /sessions/current def destroy - sign_out - redirect_to root_path + sign_out + redirect_to root_path end - end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b36c0c5..f12c778 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -19,14 +19,15 @@ <%= submit_tag("Go", {:class => "btn btn-warning"}) %> <% end %>

- <% if signed_in? %> -
  • <%= current_user.user_name.upcase %>
  • - <% end %> -
  • - <%= if signed_in? do %> - <%= link_to "Sign out", signout_path, method: "delete" %> - <% end; end %> -
  • +
      + <% if signed_in? %> +
    • <%= current_user.user_name.upcase %>
    • +
    • <%= link_to "Sign out", session_path("current"), method: "delete" %>
    • + <% else %> +
    • <%= link_to "Log in", new_session_path %>
    • +
    • <%= link_to "Sign up", new_user_path %>
    • + <% end %> +
    diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 2e7a0d3..a820b2f 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -15,6 +15,6 @@ <%= f.submit "Sign in", class: "btn btn-large btn-primary" %> <% end %> -

    New user? <%= link_to "Sign up now!", signup_path %>

    +

    New user? <%= link_to "Sign up now!", new_user_path %>

    diff --git a/app/views/static/homepage.html.erb b/app/views/static/homepage.html.erb index 8b96e11..3ca8176 100644 --- a/app/views/static/homepage.html.erb +++ b/app/views/static/homepage.html.erb @@ -5,8 +5,8 @@

    This is a tournment management system designed to be used for any team sport. Our peer review system ensures that the best players move on to the next round! Try creating a new tournament and having people sign up for it.

    <% if !signed_in? %> - <%= link_to 'Log In', "/signin", :class => "btn btn-warning btn-lg", :role => "button" %> - <%= link_to 'Sign Up', "/signup", :class => "btn btn-warning btn-lg", :role => "button" %> + <%= link_to 'Log In', new_session_path, :class => "btn btn-warning btn-lg", :role => "button" %> + <%= link_to 'Sign Up', new_user_path, :class => "btn btn-warning btn-lg", :role => "button" %> <% else %> <%= link_to 'Start a Tournament', new_tournament_path, :class => "btn btn-warning btn-lg", :role => "button" %> <% end %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index aa71f00..f0ce746 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -56,5 +56,5 @@

    -<%= link_to 'Already Have an Account? Log in', "signin", :class => "btn btn-warning btn-lg" %> +<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "btn btn-warning btn-lg" %> diff --git a/config/routes.rb b/config/routes.rb index d3f6654..022ce42 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,7 @@ Leaguer::Application.routes.draw do - #creates sessions as a resource but limits it to these actions - resources :sessions, only: [:new, :create, :destroy] - - match '/signup', to: 'users#new', via: 'get' - match '/signin', to: 'sessions#new', via: 'get' - match '/signout', to: 'sessions#destroy', via: 'get' + #creates sessions as a resource but limits it to these actions + resources :sessions, only: [:new, :create, :destroy] resources :users -- cgit v1.2.3-54-g00ecf From 42c241f0d533e243a01560d28e8cd7e3b90a6165 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Mar 2014 11:38:21 -0500 Subject: indent application.html.erb --- app/views/layouts/application.html.erb | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'app/views') diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f12c778..0362062 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,14 +10,12 @@ - -
    -<%= yield %>
    + +
    <%= yield %>
    +
    -

    Tomer Kimia Andrew Murrell Luke Shumaker Nathaniel Foy Davis Webb Guntas Grewal

    -

    The Leaguer System © <%= Time.now.year %>

    - <%= debug(params) if Rails.env.development? %> +

    Leaguer is copyright © 2014, Tomer Kimia, Andrew Murrell, Luke Shumaker, Nathaniel Foy, Davis Webb, and Guntas Grewal

    + +<%= debug(params) if Rails.env.development? %> -- cgit v1.2.3-54-g00ecf From 47db24fe712877d919256c431d0c5fcbbd431a45 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Mar 2014 11:50:33 -0500 Subject: make notifications be shown an all pages --- app/views/alerts/show.html.erb | 2 -- app/views/games/show.html.erb | 2 -- app/views/layouts/application.html.erb | 2 ++ app/views/matches/show.html.erb | 2 -- app/views/pms/show.html.erb | 2 -- app/views/servers/show.html.erb | 2 -- app/views/teams/show.html.erb | 2 -- app/views/tournaments/show.html.erb | 2 -- app/views/users/show.html.erb | 2 -- 9 files changed, 2 insertions(+), 16 deletions(-) (limited to 'app/views') diff --git a/app/views/alerts/show.html.erb b/app/views/alerts/show.html.erb index eeab7f7..5dda2c9 100644 --- a/app/views/alerts/show.html.erb +++ b/app/views/alerts/show.html.erb @@ -1,5 +1,3 @@ -

    <%= notice %>

    -

    Author: <%= @alert.author %> diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb index 7986016..88bf91c 100644 --- a/app/views/games/show.html.erb +++ b/app/views/games/show.html.erb @@ -1,5 +1,3 @@ -

    <%= notice %>

    -

    Name: <%= @game.name %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0362062..4651efc 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -29,6 +29,8 @@ +<% if notice %>

    <%= notice %>

    <% end %> +
    <%= yield %>

    diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 0b02ae7..9c9cbb4 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,5 +1,3 @@ -

    <%= notice %>

    -

    Tournament: <%= @match.tournament %> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index 5ee483f..2a03716 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -1,5 +1,3 @@ -

    <%= notice %>

    -

    Author: <%= @pm.author %> diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb index 039cd8f..67f7647 100644 --- a/app/views/servers/show.html.erb +++ b/app/views/servers/show.html.erb @@ -1,4 +1,2 @@ -

    <%= notice %>

    - <%= link_to 'Edit', edit_server_path(@server) %> | <%= link_to 'Back', servers_path %> diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb index 5b18d33..ab49d65 100644 --- a/app/views/teams/show.html.erb +++ b/app/views/teams/show.html.erb @@ -1,4 +1,2 @@ -

    <%= notice %>

    - <%= link_to 'Edit', edit_team_path(@team) %> | <%= link_to 'Back', teams_path %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index 30df788..0d9dd10 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -1,5 +1,3 @@ -

    <%= notice %>

    -

    Game: <%= @tournament.game %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 9455a3c..d8cc82b 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,5 +1,3 @@ -

    <%= notice %>

    -

    Name: <%= @user.name %> -- cgit v1.2.3-54-g00ecf From da95cb4f0f48731c2713c61f17b522b048647fd1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Mar 2014 12:02:15 -0500 Subject: Use the navbar header to demonstrate using SCSS @extend --- app/assets/stylesheets/custom.css.scss | 5 +++++ app/views/layouts/application.html.erb | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss index cbd46a7..25cac21 100644 --- a/app/assets/stylesheets/custom.css.scss +++ b/app/assets/stylesheets/custom.css.scss @@ -1 +1,6 @@ @import "bootstrap"; + +header > nav { + @extend .navbar; + @extend .navbar-inverse; +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4651efc..d817484 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,8 +8,7 @@ <%= yield :head %> -

    + <% if notice %>

    <%= notice %>

    <% end %> -- cgit v1.2.3-54-g00ecf