forked from nanego/my-dcim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "Bays" do | ||
let(:bay) { bays(:one) } | ||
|
||
describe "GET #print" do | ||
subject(:response) do | ||
get print_bay_path(bay) | ||
|
||
# NOTE: used to simplify usage and custom test done in final spec file. | ||
@response # rubocop:disable RSpec/InstanceVariable | ||
end | ||
|
||
include_context "with authenticated user" | ||
|
||
context "with not found bay" do | ||
let(:bay) { Bay.new(id: SecureRandom.uuid) } | ||
|
||
it { expect { response }.to raise_error(ActiveRecord::RecordNotFound) } | ||
end | ||
|
||
context "with existing bay" do | ||
it { expect(response).to have_http_status(:success) } | ||
it { expect(response).to render_template(:print) } | ||
it { expect(response).to render_template("layouts/pdf") } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "Frames" do | ||
let(:frame) { frames(:one) } | ||
|
||
describe "GET #print" do | ||
subject(:response) do | ||
get print_frame_path(frame) | ||
|
||
# NOTE: used to simplify usage and custom test done in final spec file. | ||
@response # rubocop:disable RSpec/InstanceVariable | ||
end | ||
|
||
include_context "with authenticated user" | ||
|
||
context "with not found frame" do | ||
let(:frame) { Frame.new(id: SecureRandom.uuid) } | ||
|
||
it { expect { response }.to raise_error(ActiveRecord::RecordNotFound) } | ||
end | ||
|
||
context "with existing frame" do | ||
it { expect(response).to have_http_status(:success) } | ||
it { expect(response).to render_template(:print) } | ||
it { expect(response).to render_template("layouts/pdf") } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "Moves" do | ||
let(:move) { moves(:one) } | ||
|
||
describe "GET #print" do | ||
subject(:response) do | ||
get print_moves_path(move.frame_id) | ||
|
||
# NOTE: used to simplify usage and custom test done in final spec file. | ||
@response # rubocop:disable RSpec/InstanceVariable | ||
end | ||
|
||
include_context "with authenticated user" | ||
|
||
context "with not found frame" do | ||
before { move.frame_id = SecureRandom.uuid } | ||
|
||
it { expect { response }.to raise_error(ActiveRecord::RecordNotFound) } | ||
end | ||
|
||
context "with existing move" do | ||
it { expect(response).to have_http_status(:success) } | ||
it { expect(response).to render_template(:print) } | ||
it { expect(response).to render_template("layouts/pdf") } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe "Rooms" do | ||
let(:room) { rooms(:one) } | ||
|
||
describe "GET #print" do | ||
subject(:response) do | ||
get print_room_path(room) | ||
|
||
# NOTE: used to simplify usage and custom test done in final spec file. | ||
@response # rubocop:disable RSpec/InstanceVariable | ||
end | ||
|
||
include_context "with authenticated user" | ||
|
||
context "with not found room" do | ||
let(:room) { Room.new(id: SecureRandom.uuid) } | ||
|
||
it { expect { response }.to raise_error(ActiveRecord::RecordNotFound) } | ||
end | ||
|
||
context "with existing room" do | ||
it { expect(response).to have_http_status(:success) } | ||
it { expect(response).to render_template(:print) } | ||
it { expect(response).to render_template("layouts/pdf") } | ||
end | ||
end | ||
end |