Browse Source

soon to be updated

Lou 3 years ago
parent
commit
ebf68217cd

+ 8
- 0
test/controllers/api/v1/activities_controller_test.rb View File

@@ -19,6 +19,14 @@ class Api::V1::ActivitiesControllerTest < ActionDispatch::IntegrationTest
19 19
     assert_response :forbidden
20 20
   end
21 21
 
22
+  # test "should filter activities by name" do
23
+  #   assert_equal 2, Activity.filter_by_name('pyheatpump').count
24
+  # end
25
+
26
+  # test "should filter activities by name and sort them" do
27
+  #   assert_equal [activities(:one), activities(:three)], Activity.all.select {|n| n.name.include?("pyheat")}.sort {|a,b| a.name <=> b.name}
28
+  # end
29
+
22 30
   #SHOW
23 31
   test "should access show" do
24 32
     get api_v1_activity_url(@activity),

+ 15
- 3
test/fixtures/activities.yml View File

@@ -1,7 +1,19 @@
1 1
 # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 2
 
3 3
 one:
4
-  name: RandomActivity
5
-  client: MyClient
6
-  description: RandomActivity
4
+  name: PyheatPump A
5
+  client: OTEC
6
+  description: Outil de gestion à distance de pompes à chaleur
7
+  author: two
8
+
9
+two:
10
+  name: Création d'un wordpress
11
+  client: Lambda
12
+  description: Blabla sur la création d'une page static wordpress
13
+  author: two
14
+
15
+three:
16
+  name: PyheatPump B
17
+  client: OTEC
18
+  description: Outil de gestion à distance de pompes à chaleur
7 19
   author: one

+ 5
- 0
test/fixtures/users.yml View File

@@ -3,4 +3,9 @@
3 3
 one:
4 4
   email: one@one.com
5 5
   username: OneUsername
6
+  password_digest: <%= BCrypt::Password.create('g00d_pa$$') %>
7
+
8
+two:
9
+  email: two@two.com
10
+  username: TwoUsername
6 11
   password_digest: <%= BCrypt::Password.create('g00d_pa$$') %>

Loading…
Cancel
Save