Browse code
remove unused generator from tokens
Greg Wiley authored on 03/05/2017 20:25:36
Showing 3 changed files
Showing 3 changed files
... | ... |
@@ -26,11 +26,8 @@ class tokens_impl : public tokens_ifc |
26 | 26 |
{ |
27 | 27 |
private: |
28 | 28 |
fstreams fstreams_; |
29 |
- token_generator generate_token_; |
|
30 | 29 |
public: |
31 |
- tokens_impl (const fstreams &fstreams, |
|
32 |
- const token_generator &generate_token) : |
|
33 |
- generate_token_ (generate_token), |
|
30 |
+ tokens_impl (const fstreams &fstreams) : |
|
34 | 31 |
fstreams_ (fstreams) {} |
35 | 32 |
std::string token (const user &user) const override |
36 | 33 |
{ |
... | ... |
@@ -55,10 +52,9 @@ public: |
55 | 52 |
} |
56 | 53 |
}; |
57 | 54 |
} |
58 |
-tokens tokens::create (const fstreams &fstreams, |
|
59 |
- const tokens_impl::token_generator &generate_token) |
|
55 |
+tokens tokens::create (const fstreams &fstreams) |
|
60 | 56 |
{ |
61 | 57 |
return tokens (tokens::delegate |
62 |
- (new tokens_impl (fstreams, generate_token))); |
|
58 |
+ (new tokens_impl (fstreams))); |
|
63 | 59 |
} |
64 | 60 |
|
... | ... |
@@ -95,7 +95,7 @@ int reads_from_the_right_file () |
95 | 95 |
//file_reader test_file_reader (file_reader::delegate (new fake_file_reader)); |
96 | 96 |
user test_user (user::delegate (new fake_user (home_directory))); |
97 | 97 |
tokens supplier (tokens::create ( |
98 |
- test_streams,[] {return"";})); |
|
98 |
+ test_streams)); |
|
99 | 99 |
|
100 | 100 |
//when |
101 | 101 |
std::string actual = supplier.token (test_user); |
... | ... |
@@ -115,7 +115,7 @@ int returns_empty_string_if_file_open_fail() |
115 | 115 |
"654321"))); |
116 | 116 |
user test_user (user::delegate (new fake_user (home_directory))); |
117 | 117 |
tokens supplier (tokens::create ( |
118 |
- test_streams, [] {return "";})); |
|
118 |
+ test_streams)); |
|
119 | 119 |
|
120 | 120 |
//when |
121 | 121 |
std::string actual = supplier.token (test_user); |
... | ... |
@@ -133,7 +133,7 @@ int writes_the_token () |
133 | 133 |
mock_write_fstreams *mockfs (new mock_write_fstreams); |
134 | 134 |
fstreams test_streams{fstreams::delegate (mockfs)}; |
135 | 135 |
std::string token ("token"); |
136 |
- tokens tokens (tokens::create (test_streams, [&] {return "wrong token";})); |
|
136 |
+ tokens tokens (tokens::create (test_streams)); |
|
137 | 137 |
|
138 | 138 |
//when |
139 | 139 |
tokens.save (test_user, token); |