Browse Source

fix all offences except for allow_any_instance

pull/264/head
Kat 3 years ago
parent
commit
86ef5c839b
  1. 12
      spec/features/organisation_spec.rb
  2. 2
      spec/features/user_spec.rb
  3. 0
      spec/helpers/question_view_helper_spec.rb
  4. 4
      spec/helpers/tab_nav_helper_spec.rb

12
spec/features/organisation_spec.rb

@ -17,10 +17,10 @@ RSpec.describe "User Features" do
sign_in user
end
context "User is a data coordinator" do
context "when user is a data coordinator" do
let!(:user) { FactoryBot.create(:user, :data_coordinator) }
context "Organisation page" do
context "when viewing organisation page" do
it "defaults to organisation details" do
visit("/logs")
click_link("Your organisation")
@ -36,7 +36,7 @@ RSpec.describe "User Features" do
end
end
context "Organisation users" do
context "when users are part of organisation" do
it "users can be added" do
visit("/organisations/#{org_id}")
click_link("Users")
@ -65,10 +65,10 @@ RSpec.describe "User Features" do
end
end
context "User is a data provider" do
let!(:user) { FactoryBot.create(:user) }
context "when the user is a data provider" do
let(:user) { FactoryBot.create(:user) }
context "Organisation page" do
context "when viewing organisation page" do
it "can only see the details tab" do
visit("/logs")
click_link("Your organisation")

2
spec/features/user_spec.rb

@ -4,7 +4,7 @@ require_relative "../request_helper"
RSpec.describe "User Features" do
let!(:user) { FactoryBot.create(:user, last_sign_in_at: Time.zone.now) }
let(:reset_password_template_id) { DeviseNotifyMailer::RESET_PASSWORD_TEMPLATE_ID }
let(:notify_client) { double(Notifications::Client) }
let(:notify_client) { instance_double(Notifications::Client) }
let(:reset_password_token) { "MCDH5y6Km-U7CFPgAMVS" }
before do

0
spec/helpers/question_view_helper.rb → spec/helpers/question_view_helper_spec.rb

4
spec/helpers/tab_nav_helper_spec.rb

@ -19,7 +19,7 @@ RSpec.describe TabNavHelper do
end
describe "#tab_items" do
context "user is a data_coordinator" do
context "when user is a data_coordinator" do
let(:user) { FactoryBot.build(:user, :data_coordinator, organisation: organisation) }
it "returns details and user tabs" do
@ -30,7 +30,7 @@ RSpec.describe TabNavHelper do
end
end
context "user is a data_provider" do
context "when user is a data_provider" do
it "returns details tab only" do
result = tab_items(user).map { |i| i[:name] }
expect(result.count).to eq(1)

Loading…
Cancel
Save