+ );
+ }
+});
diff --git a/app/controllers/tables_controller.rb b/app/controllers/tables_controller.rb
index a039d88..deb22a3 100644
--- a/app/controllers/tables_controller.rb
+++ b/app/controllers/tables_controller.rb
@@ -1,6 +1,8 @@
class TablesController < ApplicationController
before_action :set_table, only: [:show, :edit, :update, :destroy]
+ respond_to :html, :json
+
# GET /tables
# GET /tables.json
def index
diff --git a/app/views/tables/show.json.jbuilder b/app/views/tables/show.json.jbuilder
new file mode 100644
index 0000000..ca42e25
--- /dev/null
+++ b/app/views/tables/show.json.jbuilder
@@ -0,0 +1 @@
+json.extract! @table, :id, :title, :created_at, :updated_at
diff --git a/config/routes.rb b/config/routes.rb
index 5bd9be8..f19e42a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,9 @@
Rails.application.routes.draw do
resources :players
- resources :tables
+ resources :tables do
+ resources :seats
+ resources :games
+ end
resources :games do
member do
diff --git a/spec/features/visitors/table_index_spec.rb b/spec/features/tables/table_index_spec.rb
similarity index 100%
rename from spec/features/visitors/table_index_spec.rb
rename to spec/features/tables/table_index_spec.rb
diff --git a/spec/features/tables/table_join_spec.rb b/spec/features/tables/table_join_spec.rb
new file mode 100644
index 0000000..a282031
--- /dev/null
+++ b/spec/features/tables/table_join_spec.rb
@@ -0,0 +1,41 @@
+# Feature: Table show
+# As a visitor
+# I want to view a table
+# So I can sit and play a game
+feature 'Table show', :devise do
+ context "As a visitor" do
+ before(:each) do
+ @table = FactoryGirl.create :table
+ visit tables_path
+ click_link @table.title
+ end
+ # Scenario: Visitor can view a table
+ # Given I am not signed in
+ # When I visit a table
+ # Then I see the table attributes
+ scenario 'visitor can see the table', js: true do
+ expect(page).to have_selector "#table-#{@table.id} > h1", @table.title
+ end
+
+ scenario 'visitor can sit at the table', js: true do
+ click_button 'Sit'
+ expect(page).to have_content "Guest"
+ end
+ end
+
+ context "As a user" do
+ # Scenario: User can view a table
+ # Given I am signed in
+ # When I click a table
+ # Then I see an index of tables
+ scenario 'visitor can see the table', js: true do
+ @table = FactoryGirl.create :table
+ # TODO: sign in
+ visit tables_path
+ click_link @table.title
+ expect(page).to have_button "Sit"
+ expect(page).to have_selector "#table-#{@table.id} > .title", @table.title
+ expect(current_path).to eq table_path(@table)
+ end
+ end
+end