Skip to content

Commit

Permalink
remove old schema validations and green tests
Browse files Browse the repository at this point in the history
  • Loading branch information
npauzenga committed Jan 31, 2016
1 parent ca1aa40 commit 1bcdb6e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 19 deletions.
9 changes: 7 additions & 2 deletions app/controllers/game_night_attendances_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
class GameNightAttendancesController < AuthenticationController
# POST /game_nights/:game_night_id/game_night_attendences
def create
result = CreateGameNightAttendance.call(user_id: current_user.id,
game_night_id: params[:game_night_id])
result = CreateGameNightAttendance.call(interactor_params)
if result.success?
head :no_content
else
render json: result.errors, status: :internal_server_error
end
end

private

def interactor_params
{ user_id: current_user.id, game_night_id: params[:game_night_id] }
end
end
8 changes: 0 additions & 8 deletions spec/acceptance/groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
Knock::AuthToken.new(payload: { sub: authenticated_user.id }).token
end

def schema_path
"./config/schema/schemata/group.json"
end

shared_context "group parameters" do
parameter "name", <<-DESC, scope: :group, required: true
The name of the group.
Expand All @@ -35,10 +31,6 @@ def schema_path
end

post "/groups" do
let(:schema_path) { "#{Rails.root}/config/schema/api.json" }
let(:last_response) { response }
let(:last_request) { request }

include_context "group parameters"

let(:name) { "Waaggh" }
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/user_group_memberships_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

post "/groups/:group_id/group_memberships" do
include_context "game_night parameters"
include_context "user_group_membership parameters"

let!(:group) { create(:group) }
let(:group_id) { group.id }
Expand Down
4 changes: 0 additions & 4 deletions spec/acceptance/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
Knock::AuthToken.new(payload: { sub: authenticated_user.id }).token
end

def schema_path
"./config/schema/schemata/user.json"
end

shared_context "user parameters" do
parameter "first_name", <<-DESC, scope: :user, required: true
The first name of the user.
Expand Down
8 changes: 6 additions & 2 deletions spec/controllers/game_night_attendances_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
describe "POST #create" do
let(:user) { create(:confirmed_user) }
let(:game_night) { create(:game_night) }
let(:params) { { id: game_night.id.to_s } }
let(:arguments) { { user_id: user.id, game_night_id: params[:id] } }
let(:params) { { game_night_id: game_night.id.to_s } }

let(:arguments) do
{ user_id: user.id, game_night_id: params[:game_night_id] }
end

let(:context) { double(:context, success?: true) }

before(:example) do
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/group_memberships_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
describe "POST #create" do
let(:user) { create(:confirmed_user) }
let(:group) { create(:group) }
let(:params) { { id: group.id } }
let(:arguments) { { user_id: user.id, group_id: params[:group_id] } }
let(:params) { { group_id: group.id } }
let(:arguments) { { user_id: user.id, group_id: params[:group_id].to_s } }
let(:context) { double(:context, success?: true) }

before(:example) do
Expand Down

0 comments on commit 1bcdb6e

Please sign in to comment.