rspec_piccolo 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +2 -2
- data/README.md +326 -0
- data/bin/piccolo +2 -1
- data/lib/rspec_piccolo.rb +45 -7
- data/lib/rspec_piccolo/version.rb +1 -1
- data/spec/rspec_piccolo_spec.rb +643 -490
- data/spec/spec_helper.rb +8 -10
- metadata +14 -14
    
        data/spec/rspec_piccolo_spec.rb
    CHANGED
    
    | @@ -1,490 +1,643 @@ | |
| 1 | 
            -
            # encoding: utf-8
         | 
| 2 | 
            -
            require "spec_helper"
         | 
| 3 | 
            -
            require "rspec_piccolo"
         | 
| 4 | 
            -
            require "fileutils"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            describe RSpecPiccolo::Core do
         | 
| 7 | 
            -
              context :generate do
         | 
| 8 | 
            -
                CASE1_EXPECTED=<<-EOS
         | 
| 9 | 
            -
            # encoding: utf-8
         | 
| 10 | 
            -
            require "spec_helper"
         | 
| 11 | 
            -
            require "hoge_core"
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            describe Hoge::Core do
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
            require " | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
                     | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                       | 
| 40 | 
            -
             | 
| 41 | 
            -
                      # --  | 
| 42 | 
            -
                       | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
                      #  | 
| 46 | 
            -
                      #  | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
                       | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
                     | 
| 55 | 
            -
                  end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                  def  | 
| 58 | 
            -
                    # implement each case  | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
                       | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
                       | 
| 85 | 
            -
             | 
| 86 | 
            -
                      #  | 
| 87 | 
            -
             | 
| 88 | 
            -
                       | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
                     | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
            end
         | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
                       | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
                       | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
             | 
| 145 | 
            -
                     | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
             | 
| 151 | 
            -
             | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
                   | 
| 157 | 
            -
             | 
| 158 | 
            -
             | 
| 159 | 
            -
                 | 
| 160 | 
            -
             | 
| 161 | 
            -
             | 
| 162 | 
            -
             | 
| 163 | 
            -
             | 
| 164 | 
            -
             | 
| 165 | 
            -
             | 
| 166 | 
            -
             | 
| 167 | 
            -
             | 
| 168 | 
            -
             | 
| 169 | 
            -
             | 
| 170 | 
            -
             | 
| 171 | 
            -
             | 
| 172 | 
            -
             | 
| 173 | 
            -
             | 
| 174 | 
            -
                     | 
| 175 | 
            -
                       | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 178 | 
            -
             | 
| 179 | 
            -
             | 
| 180 | 
            -
             | 
| 181 | 
            -
             | 
| 182 | 
            -
             | 
| 183 | 
            -
             | 
| 184 | 
            -
             | 
| 185 | 
            -
             | 
| 186 | 
            -
             | 
| 187 | 
            -
             | 
| 188 | 
            -
             | 
| 189 | 
            -
             | 
| 190 | 
            -
             | 
| 191 | 
            -
             | 
| 192 | 
            -
             | 
| 193 | 
            -
             | 
| 194 | 
            -
             | 
| 195 | 
            -
             | 
| 196 | 
            -
             | 
| 197 | 
            -
             | 
| 198 | 
            -
             | 
| 199 | 
            -
             | 
| 200 | 
            -
                   | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 203 | 
            -
             | 
| 204 | 
            -
             | 
| 205 | 
            -
             | 
| 206 | 
            -
             | 
| 207 | 
            -
                 | 
| 208 | 
            -
             | 
| 209 | 
            -
             | 
| 210 | 
            -
             | 
| 211 | 
            -
             | 
| 212 | 
            -
             | 
| 213 | 
            -
             | 
| 214 | 
            -
             | 
| 215 | 
            -
             | 
| 216 | 
            -
             | 
| 217 | 
            -
             | 
| 218 | 
            -
             | 
| 219 | 
            -
             | 
| 220 | 
            -
             | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 223 | 
            -
             | 
| 224 | 
            -
             | 
| 225 | 
            -
                   | 
| 226 | 
            -
             | 
| 227 | 
            -
             | 
| 228 | 
            -
             | 
| 229 | 
            -
             | 
| 230 | 
            -
             | 
| 231 | 
            -
             | 
| 232 | 
            -
             | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
             | 
| 238 | 
            -
             | 
| 239 | 
            -
             | 
| 240 | 
            -
             | 
| 241 | 
            -
             | 
| 242 | 
            -
                     | 
| 243 | 
            -
                   | 
| 244 | 
            -
             | 
| 245 | 
            -
             | 
| 246 | 
            -
             | 
| 247 | 
            -
             | 
| 248 | 
            -
             | 
| 249 | 
            -
             | 
| 250 | 
            -
             | 
| 251 | 
            -
             | 
| 252 | 
            -
             | 
| 253 | 
            -
             | 
| 254 | 
            -
             | 
| 255 | 
            -
             | 
| 256 | 
            -
             | 
| 257 | 
            -
             | 
| 258 | 
            -
             | 
| 259 | 
            -
             | 
| 260 | 
            -
             | 
| 261 | 
            -
                     | 
| 262 | 
            -
             | 
| 263 | 
            -
             | 
| 264 | 
            -
             | 
| 265 | 
            -
             | 
| 266 | 
            -
             | 
| 267 | 
            -
             | 
| 268 | 
            -
             | 
| 269 | 
            -
             | 
| 270 | 
            -
             | 
| 271 | 
            -
             | 
| 272 | 
            -
             | 
| 273 | 
            -
             | 
| 274 | 
            -
             | 
| 275 | 
            -
             | 
| 276 | 
            -
             | 
| 277 | 
            -
             | 
| 278 | 
            -
             | 
| 279 | 
            -
             | 
| 280 | 
            -
            #  | 
| 281 | 
            -
             | 
| 282 | 
            -
             | 
| 283 | 
            -
             | 
| 284 | 
            -
             | 
| 285 | 
            -
             | 
| 286 | 
            -
             | 
| 287 | 
            -
                   | 
| 288 | 
            -
                     | 
| 289 | 
            -
             | 
| 290 | 
            -
             | 
| 291 | 
            -
             | 
| 292 | 
            -
             | 
| 293 | 
            -
             | 
| 294 | 
            -
             | 
| 295 | 
            -
             | 
| 296 | 
            -
             | 
| 297 | 
            -
             | 
| 298 | 
            -
             | 
| 299 | 
            -
             | 
| 300 | 
            -
             | 
| 301 | 
            -
             | 
| 302 | 
            -
             | 
| 303 | 
            -
             | 
| 304 | 
            -
             | 
| 305 | 
            -
             | 
| 306 | 
            -
             | 
| 307 | 
            -
             | 
| 308 | 
            -
             | 
| 309 | 
            -
             | 
| 310 | 
            -
             | 
| 311 | 
            -
                     | 
| 312 | 
            -
             | 
| 313 | 
            -
             | 
| 314 | 
            -
             | 
| 315 | 
            -
             | 
| 316 | 
            -
             | 
| 317 | 
            -
             | 
| 318 | 
            -
             | 
| 319 | 
            -
             | 
| 320 | 
            -
             | 
| 321 | 
            -
             | 
| 322 | 
            -
             | 
| 323 | 
            -
             | 
| 324 | 
            -
             | 
| 325 | 
            -
             | 
| 326 | 
            -
             | 
| 327 | 
            -
             | 
| 328 | 
            -
             | 
| 329 | 
            -
             | 
| 330 | 
            -
             | 
| 331 | 
            -
             | 
| 332 | 
            -
             | 
| 333 | 
            -
             | 
| 334 | 
            -
             | 
| 335 | 
            -
             | 
| 336 | 
            -
             | 
| 337 | 
            -
             | 
| 338 | 
            -
             | 
| 339 | 
            -
             | 
| 340 | 
            -
             | 
| 341 | 
            -
             | 
| 342 | 
            -
             | 
| 343 | 
            -
             | 
| 344 | 
            -
             | 
| 345 | 
            -
             | 
| 346 | 
            -
             | 
| 347 | 
            -
             | 
| 348 | 
            -
             | 
| 349 | 
            -
             | 
| 350 | 
            -
             | 
| 351 | 
            -
             | 
| 352 | 
            -
             | 
| 353 | 
            -
             | 
| 354 | 
            -
                     | 
| 355 | 
            -
             | 
| 356 | 
            -
             | 
| 357 | 
            -
                   | 
| 358 | 
            -
             | 
| 359 | 
            -
             | 
| 360 | 
            -
                 | 
| 361 | 
            -
             | 
| 362 | 
            -
             | 
| 363 | 
            -
             | 
| 364 | 
            -
             | 
| 365 | 
            -
             | 
| 366 | 
            -
             | 
| 367 | 
            -
             | 
| 368 | 
            -
             | 
| 369 | 
            -
             | 
| 370 | 
            -
             | 
| 371 | 
            -
             | 
| 372 | 
            -
             | 
| 373 | 
            -
             | 
| 374 | 
            -
             | 
| 375 | 
            -
                     | 
| 376 | 
            -
             | 
| 377 | 
            -
             | 
| 378 | 
            -
                     | 
| 379 | 
            -
             | 
| 380 | 
            -
             | 
| 381 | 
            -
             | 
| 382 | 
            -
                     | 
| 383 | 
            -
             | 
| 384 | 
            -
             | 
| 385 | 
            -
             | 
| 386 | 
            -
                   | 
| 387 | 
            -
             | 
| 388 | 
            -
             | 
| 389 | 
            -
             | 
| 390 | 
            -
             | 
| 391 | 
            -
             | 
| 392 | 
            -
             | 
| 393 | 
            -
             | 
| 394 | 
            -
             | 
| 395 | 
            -
             | 
| 396 | 
            -
             | 
| 397 | 
            -
             | 
| 398 | 
            -
             | 
| 399 | 
            -
             | 
| 400 | 
            -
             | 
| 401 | 
            -
             | 
| 402 | 
            -
             | 
| 403 | 
            -
             | 
| 404 | 
            -
             | 
| 405 | 
            -
             | 
| 406 | 
            -
             | 
| 407 | 
            -
             | 
| 408 | 
            -
             | 
| 409 | 
            -
             | 
| 410 | 
            -
             | 
| 411 | 
            -
             | 
| 412 | 
            -
             | 
| 413 | 
            -
             | 
| 414 | 
            -
             | 
| 415 | 
            -
             | 
| 416 | 
            -
             | 
| 417 | 
            -
             | 
| 418 | 
            -
             | 
| 419 | 
            -
                     | 
| 420 | 
            -
                     | 
| 421 | 
            -
                     | 
| 422 | 
            -
                     | 
| 423 | 
            -
             | 
| 424 | 
            -
                   | 
| 425 | 
            -
             | 
| 426 | 
            -
             | 
| 427 | 
            -
             | 
| 428 | 
            -
             | 
| 429 | 
            -
                     | 
| 430 | 
            -
             | 
| 431 | 
            -
             | 
| 432 | 
            -
             | 
| 433 | 
            -
             | 
| 434 | 
            -
             | 
| 435 | 
            -
             | 
| 436 | 
            -
             | 
| 437 | 
            -
             | 
| 438 | 
            -
             | 
| 439 | 
            -
             | 
| 440 | 
            -
             | 
| 441 | 
            -
             | 
| 442 | 
            -
                     | 
| 443 | 
            -
             | 
| 444 | 
            -
             | 
| 445 | 
            -
             | 
| 446 | 
            -
                     | 
| 447 | 
            -
             | 
| 448 | 
            -
             | 
| 449 | 
            -
             | 
| 450 | 
            -
             | 
| 451 | 
            -
             | 
| 452 | 
            -
             | 
| 453 | 
            -
             | 
| 454 | 
            -
                   | 
| 455 | 
            -
                     | 
| 456 | 
            -
             | 
| 457 | 
            -
             | 
| 458 | 
            -
             | 
| 459 | 
            -
             | 
| 460 | 
            -
             | 
| 461 | 
            -
             | 
| 462 | 
            -
             | 
| 463 | 
            -
             | 
| 464 | 
            -
             | 
| 465 | 
            -
             | 
| 466 | 
            -
             | 
| 467 | 
            -
             | 
| 468 | 
            -
             | 
| 469 | 
            -
             | 
| 470 | 
            -
             | 
| 471 | 
            -
             | 
| 472 | 
            -
             | 
| 473 | 
            -
                     | 
| 474 | 
            -
                       | 
| 475 | 
            -
             | 
| 476 | 
            -
             | 
| 477 | 
            -
             | 
| 478 | 
            -
             | 
| 479 | 
            -
             | 
| 480 | 
            -
             | 
| 481 | 
            -
             | 
| 482 | 
            -
             | 
| 483 | 
            -
             | 
| 484 | 
            -
             | 
| 485 | 
            -
             | 
| 486 | 
            -
                     | 
| 487 | 
            -
             | 
| 488 | 
            -
             | 
| 489 | 
            -
             | 
| 490 | 
            -
            end
         | 
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 | 
            +
            require "spec_helper"
         | 
| 3 | 
            +
            require "rspec_piccolo"
         | 
| 4 | 
            +
            require "fileutils"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            describe RSpecPiccolo::Core do
         | 
| 7 | 
            +
              context :generate do
         | 
| 8 | 
            +
                CASE1_EXPECTED=<<-EOS
         | 
| 9 | 
            +
            # encoding: utf-8
         | 
| 10 | 
            +
            require "spec_helper"
         | 
| 11 | 
            +
            require "hoge_core"
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            describe Hoge::Core do
         | 
| 14 | 
            +
             | 
| 15 | 
            +
             | 
| 16 | 
            +
            end
         | 
| 17 | 
            +
            EOS
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                CASE2_EXPECTED=<<-EOS
         | 
| 20 | 
            +
            # encoding: utf-8
         | 
| 21 | 
            +
            require "spec_helper"
         | 
| 22 | 
            +
            require "hoge_core"
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            describe Hoge::Core do
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              context :method1 do
         | 
| 27 | 
            +
                cases = [
         | 
| 28 | 
            +
                  {
         | 
| 29 | 
            +
                    case_no: 1,
         | 
| 30 | 
            +
                    case_title: "case_title",
         | 
| 31 | 
            +
                    expected: "expected",
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  },
         | 
| 34 | 
            +
                ]
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                cases.each do |c|
         | 
| 37 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 38 | 
            +
                    begin
         | 
| 39 | 
            +
                      case_before c
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                      # -- given --
         | 
| 42 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                      # -- when --
         | 
| 45 | 
            +
                      # TODO: implement execute code
         | 
| 46 | 
            +
                      # actual = hoge_core.method1
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                      # -- then --
         | 
| 49 | 
            +
                      # TODO: implement assertion code
         | 
| 50 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 51 | 
            +
                    ensure
         | 
| 52 | 
            +
                      case_after c
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                    end
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                  def case_before(c)
         | 
| 58 | 
            +
                    # implement each case before
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                  end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                  def case_after(c)
         | 
| 63 | 
            +
                    # implement each case after
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
              context :method2 do
         | 
| 69 | 
            +
                cases = [
         | 
| 70 | 
            +
                  {
         | 
| 71 | 
            +
                    case_no: 1,
         | 
| 72 | 
            +
                    case_title: "case_title",
         | 
| 73 | 
            +
                    expected: "expected",
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                  },
         | 
| 76 | 
            +
                ]
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                cases.each do |c|
         | 
| 79 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 80 | 
            +
                    begin
         | 
| 81 | 
            +
                      case_before c
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                      # -- given --
         | 
| 84 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                      # -- when --
         | 
| 87 | 
            +
                      # TODO: implement execute code
         | 
| 88 | 
            +
                      # actual = hoge_core.method2
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                      # -- then --
         | 
| 91 | 
            +
                      # TODO: implement assertion code
         | 
| 92 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 93 | 
            +
                    ensure
         | 
| 94 | 
            +
                      case_after c
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                    end
         | 
| 97 | 
            +
                  end
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                  def case_before(c)
         | 
| 100 | 
            +
                    # implement each case before
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                  end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                  def case_after(c)
         | 
| 105 | 
            +
                    # implement each case after
         | 
| 106 | 
            +
                  end
         | 
| 107 | 
            +
                end
         | 
| 108 | 
            +
              end
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            end
         | 
| 111 | 
            +
            EOS
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                CASE3_EXPECTED=<<-EOS
         | 
| 114 | 
            +
            # encoding: utf-8
         | 
| 115 | 
            +
            require "spec_helper"
         | 
| 116 | 
            +
            require "only_class"
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            describe OnlyClass do
         | 
| 119 | 
            +
             | 
| 120 | 
            +
              context :method1 do
         | 
| 121 | 
            +
                cases = [
         | 
| 122 | 
            +
                  {
         | 
| 123 | 
            +
                    case_no: 1,
         | 
| 124 | 
            +
                    case_title: "case_title",
         | 
| 125 | 
            +
                    expected: "expected",
         | 
| 126 | 
            +
             | 
| 127 | 
            +
                  },
         | 
| 128 | 
            +
                ]
         | 
| 129 | 
            +
             | 
| 130 | 
            +
                cases.each do |c|
         | 
| 131 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 132 | 
            +
                    begin
         | 
| 133 | 
            +
                      case_before c
         | 
| 134 | 
            +
             | 
| 135 | 
            +
                      # -- given --
         | 
| 136 | 
            +
                      only_class = OnlyClass.new
         | 
| 137 | 
            +
             | 
| 138 | 
            +
                      # -- when --
         | 
| 139 | 
            +
                      # TODO: implement execute code
         | 
| 140 | 
            +
                      # actual = only_class.method1
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                      # -- then --
         | 
| 143 | 
            +
                      # TODO: implement assertion code
         | 
| 144 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 145 | 
            +
                    ensure
         | 
| 146 | 
            +
                      case_after c
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                    end
         | 
| 149 | 
            +
                  end
         | 
| 150 | 
            +
             | 
| 151 | 
            +
                  def case_before(c)
         | 
| 152 | 
            +
                    # implement each case before
         | 
| 153 | 
            +
             | 
| 154 | 
            +
                  end
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                  def case_after(c)
         | 
| 157 | 
            +
                    # implement each case after
         | 
| 158 | 
            +
                  end
         | 
| 159 | 
            +
                end
         | 
| 160 | 
            +
              end
         | 
| 161 | 
            +
             | 
| 162 | 
            +
              context :method2 do
         | 
| 163 | 
            +
                cases = [
         | 
| 164 | 
            +
                  {
         | 
| 165 | 
            +
                    case_no: 1,
         | 
| 166 | 
            +
                    case_title: "case_title",
         | 
| 167 | 
            +
                    expected: "expected",
         | 
| 168 | 
            +
             | 
| 169 | 
            +
                  },
         | 
| 170 | 
            +
                ]
         | 
| 171 | 
            +
             | 
| 172 | 
            +
                cases.each do |c|
         | 
| 173 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 174 | 
            +
                    begin
         | 
| 175 | 
            +
                      case_before c
         | 
| 176 | 
            +
             | 
| 177 | 
            +
                      # -- given --
         | 
| 178 | 
            +
                      only_class = OnlyClass.new
         | 
| 179 | 
            +
             | 
| 180 | 
            +
                      # -- when --
         | 
| 181 | 
            +
                      # TODO: implement execute code
         | 
| 182 | 
            +
                      # actual = only_class.method2
         | 
| 183 | 
            +
             | 
| 184 | 
            +
                      # -- then --
         | 
| 185 | 
            +
                      # TODO: implement assertion code
         | 
| 186 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 187 | 
            +
                    ensure
         | 
| 188 | 
            +
                      case_after c
         | 
| 189 | 
            +
             | 
| 190 | 
            +
                    end
         | 
| 191 | 
            +
                  end
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                  def case_before(c)
         | 
| 194 | 
            +
                    # implement each case before
         | 
| 195 | 
            +
             | 
| 196 | 
            +
                  end
         | 
| 197 | 
            +
             | 
| 198 | 
            +
                  def case_after(c)
         | 
| 199 | 
            +
                    # implement each case after
         | 
| 200 | 
            +
                  end
         | 
| 201 | 
            +
                end
         | 
| 202 | 
            +
              end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
            end
         | 
| 205 | 
            +
            EOS
         | 
| 206 | 
            +
             | 
| 207 | 
            +
                CASE4_EXPECTED=<<-EOS
         | 
| 208 | 
            +
            # encoding: utf-8
         | 
| 209 | 
            +
            require "spec_helper"
         | 
| 210 | 
            +
            require "some_dir/hoge_core"
         | 
| 211 | 
            +
             | 
| 212 | 
            +
            describe Hoge::Core do
         | 
| 213 | 
            +
             | 
| 214 | 
            +
              context :method1 do
         | 
| 215 | 
            +
                cases = [
         | 
| 216 | 
            +
                  {
         | 
| 217 | 
            +
                    case_no: 1,
         | 
| 218 | 
            +
                    case_title: "case_title",
         | 
| 219 | 
            +
                    expected: "expected",
         | 
| 220 | 
            +
             | 
| 221 | 
            +
                  },
         | 
| 222 | 
            +
                ]
         | 
| 223 | 
            +
             | 
| 224 | 
            +
                cases.each do |c|
         | 
| 225 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 226 | 
            +
                    begin
         | 
| 227 | 
            +
                      case_before c
         | 
| 228 | 
            +
             | 
| 229 | 
            +
                      # -- given --
         | 
| 230 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 231 | 
            +
             | 
| 232 | 
            +
                      # -- when --
         | 
| 233 | 
            +
                      # TODO: implement execute code
         | 
| 234 | 
            +
                      # actual = hoge_core.method1
         | 
| 235 | 
            +
             | 
| 236 | 
            +
                      # -- then --
         | 
| 237 | 
            +
                      # TODO: implement assertion code
         | 
| 238 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 239 | 
            +
                    ensure
         | 
| 240 | 
            +
                      case_after c
         | 
| 241 | 
            +
             | 
| 242 | 
            +
                    end
         | 
| 243 | 
            +
                  end
         | 
| 244 | 
            +
             | 
| 245 | 
            +
                  def case_before(c)
         | 
| 246 | 
            +
                    # implement each case before
         | 
| 247 | 
            +
             | 
| 248 | 
            +
                  end
         | 
| 249 | 
            +
             | 
| 250 | 
            +
                  def case_after(c)
         | 
| 251 | 
            +
                    # implement each case after
         | 
| 252 | 
            +
                  end
         | 
| 253 | 
            +
                end
         | 
| 254 | 
            +
              end
         | 
| 255 | 
            +
             | 
| 256 | 
            +
              context :method2 do
         | 
| 257 | 
            +
                cases = [
         | 
| 258 | 
            +
                  {
         | 
| 259 | 
            +
                    case_no: 1,
         | 
| 260 | 
            +
                    case_title: "case_title",
         | 
| 261 | 
            +
                    expected: "expected",
         | 
| 262 | 
            +
             | 
| 263 | 
            +
                  },
         | 
| 264 | 
            +
                ]
         | 
| 265 | 
            +
             | 
| 266 | 
            +
                cases.each do |c|
         | 
| 267 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 268 | 
            +
                    begin
         | 
| 269 | 
            +
                      case_before c
         | 
| 270 | 
            +
             | 
| 271 | 
            +
                      # -- given --
         | 
| 272 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 273 | 
            +
             | 
| 274 | 
            +
                      # -- when --
         | 
| 275 | 
            +
                      # TODO: implement execute code
         | 
| 276 | 
            +
                      # actual = hoge_core.method2
         | 
| 277 | 
            +
             | 
| 278 | 
            +
                      # -- then --
         | 
| 279 | 
            +
                      # TODO: implement assertion code
         | 
| 280 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 281 | 
            +
                    ensure
         | 
| 282 | 
            +
                      case_after c
         | 
| 283 | 
            +
             | 
| 284 | 
            +
                    end
         | 
| 285 | 
            +
                  end
         | 
| 286 | 
            +
             | 
| 287 | 
            +
                  def case_before(c)
         | 
| 288 | 
            +
                    # implement each case before
         | 
| 289 | 
            +
             | 
| 290 | 
            +
                  end
         | 
| 291 | 
            +
             | 
| 292 | 
            +
                  def case_after(c)
         | 
| 293 | 
            +
                    # implement each case after
         | 
| 294 | 
            +
                  end
         | 
| 295 | 
            +
                end
         | 
| 296 | 
            +
              end
         | 
| 297 | 
            +
             | 
| 298 | 
            +
            end
         | 
| 299 | 
            +
            EOS
         | 
| 300 | 
            +
             | 
| 301 | 
            +
                CASE9_EXPECTED=<<-EOS
         | 
| 302 | 
            +
            # encoding: utf-8
         | 
| 303 | 
            +
            require "spec_helper"
         | 
| 304 | 
            +
            require "some_dir/some_sub_dir/hoge_core"
         | 
| 305 | 
            +
             | 
| 306 | 
            +
            describe Hoge::Core do
         | 
| 307 | 
            +
             | 
| 308 | 
            +
              context :method1 do
         | 
| 309 | 
            +
                cases = [
         | 
| 310 | 
            +
                  {
         | 
| 311 | 
            +
                    case_no: 1,
         | 
| 312 | 
            +
                    case_title: "case_title",
         | 
| 313 | 
            +
                    expected: "expected",
         | 
| 314 | 
            +
             | 
| 315 | 
            +
                  },
         | 
| 316 | 
            +
                ]
         | 
| 317 | 
            +
             | 
| 318 | 
            +
                cases.each do |c|
         | 
| 319 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 320 | 
            +
                    begin
         | 
| 321 | 
            +
                      case_before c
         | 
| 322 | 
            +
             | 
| 323 | 
            +
                      # -- given --
         | 
| 324 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 325 | 
            +
             | 
| 326 | 
            +
                      # -- when --
         | 
| 327 | 
            +
                      # TODO: implement execute code
         | 
| 328 | 
            +
                      # actual = hoge_core.method1
         | 
| 329 | 
            +
             | 
| 330 | 
            +
                      # -- then --
         | 
| 331 | 
            +
                      # TODO: implement assertion code
         | 
| 332 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 333 | 
            +
                    ensure
         | 
| 334 | 
            +
                      case_after c
         | 
| 335 | 
            +
             | 
| 336 | 
            +
                    end
         | 
| 337 | 
            +
                  end
         | 
| 338 | 
            +
             | 
| 339 | 
            +
                  def case_before(c)
         | 
| 340 | 
            +
                    # implement each case before
         | 
| 341 | 
            +
             | 
| 342 | 
            +
                  end
         | 
| 343 | 
            +
             | 
| 344 | 
            +
                  def case_after(c)
         | 
| 345 | 
            +
                    # implement each case after
         | 
| 346 | 
            +
                  end
         | 
| 347 | 
            +
                end
         | 
| 348 | 
            +
              end
         | 
| 349 | 
            +
             | 
| 350 | 
            +
              context :method2 do
         | 
| 351 | 
            +
                cases = [
         | 
| 352 | 
            +
                  {
         | 
| 353 | 
            +
                    case_no: 1,
         | 
| 354 | 
            +
                    case_title: "case_title",
         | 
| 355 | 
            +
                    expected: "expected",
         | 
| 356 | 
            +
             | 
| 357 | 
            +
                  },
         | 
| 358 | 
            +
                ]
         | 
| 359 | 
            +
             | 
| 360 | 
            +
                cases.each do |c|
         | 
| 361 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 362 | 
            +
                    begin
         | 
| 363 | 
            +
                      case_before c
         | 
| 364 | 
            +
             | 
| 365 | 
            +
                      # -- given --
         | 
| 366 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 367 | 
            +
             | 
| 368 | 
            +
                      # -- when --
         | 
| 369 | 
            +
                      # TODO: implement execute code
         | 
| 370 | 
            +
                      # actual = hoge_core.method2
         | 
| 371 | 
            +
             | 
| 372 | 
            +
                      # -- then --
         | 
| 373 | 
            +
                      # TODO: implement assertion code
         | 
| 374 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 375 | 
            +
                    ensure
         | 
| 376 | 
            +
                      case_after c
         | 
| 377 | 
            +
             | 
| 378 | 
            +
                    end
         | 
| 379 | 
            +
                  end
         | 
| 380 | 
            +
             | 
| 381 | 
            +
                  def case_before(c)
         | 
| 382 | 
            +
                    # implement each case before
         | 
| 383 | 
            +
             | 
| 384 | 
            +
                  end
         | 
| 385 | 
            +
             | 
| 386 | 
            +
                  def case_after(c)
         | 
| 387 | 
            +
                    # implement each case after
         | 
| 388 | 
            +
                  end
         | 
| 389 | 
            +
                end
         | 
| 390 | 
            +
              end
         | 
| 391 | 
            +
             | 
| 392 | 
            +
            end
         | 
| 393 | 
            +
            EOS
         | 
| 394 | 
            +
             | 
| 395 | 
            +
                CASE10_EXPECTED=<<-EOS
         | 
| 396 | 
            +
            # encoding: utf-8
         | 
| 397 | 
            +
            require "spec_helper"
         | 
| 398 | 
            +
            require "hoge_core"
         | 
| 399 | 
            +
             | 
| 400 | 
            +
            describe Hoge::Core do
         | 
| 401 | 
            +
              REPORT = "rspec_report"
         | 
| 402 | 
            +
              DIRS = File.path(__FILE__).gsub(/^.*\\/spec\\//, '').gsub(File.basename(__FILE__), '')
         | 
| 403 | 
            +
              OUT_DIR = "./#\{REPORT}/#\{DIRS}"
         | 
| 404 | 
            +
              REPORT_NAME = report_name = File.basename(__FILE__, ".rb")
         | 
| 405 | 
            +
              REPORT_FILE = "#\{OUT_DIR}#\{REPORT_NAME}.tsv"
         | 
| 406 | 
            +
             | 
| 407 | 
            +
              mkspec_report = Proc.new do
         | 
| 408 | 
            +
                Dir.mkdir(REPORT) unless File.exists?(REPORT)
         | 
| 409 | 
            +
                FileUtils.mkdir_p(OUT_DIR) unless File.exists?(OUT_DIR)
         | 
| 410 | 
            +
                File.open(REPORT_FILE, "w") {|f|f.puts "method\\tcase\\ttitle\\tsuccess\\/failure"}
         | 
| 411 | 
            +
              end.call
         | 
| 412 | 
            +
             | 
| 413 | 
            +
              success = Proc.new {|c|File.open(REPORT_FILE, "a") {|f|f.puts "\\tsuccess"}}
         | 
| 414 | 
            +
              failure = Proc.new {|c|File.open(REPORT_FILE, "a") {|f|f.puts "\\tfailure"}}
         | 
| 415 | 
            +
             | 
| 416 | 
            +
              context :method1 do
         | 
| 417 | 
            +
                cases = [
         | 
| 418 | 
            +
                  {
         | 
| 419 | 
            +
                    case_no: 1,
         | 
| 420 | 
            +
                    case_title: "case_title",
         | 
| 421 | 
            +
                    expected: "expected",
         | 
| 422 | 
            +
                    success_hook: success,
         | 
| 423 | 
            +
                    failure_hook: failure
         | 
| 424 | 
            +
                  },
         | 
| 425 | 
            +
                ]
         | 
| 426 | 
            +
             | 
| 427 | 
            +
                cases.each do |c|
         | 
| 428 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 429 | 
            +
                    begin
         | 
| 430 | 
            +
                      case_before c
         | 
| 431 | 
            +
             | 
| 432 | 
            +
                      # -- given --
         | 
| 433 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 434 | 
            +
             | 
| 435 | 
            +
                      # -- when --
         | 
| 436 | 
            +
                      # TODO: implement execute code
         | 
| 437 | 
            +
                      # actual = hoge_core.method1
         | 
| 438 | 
            +
             | 
| 439 | 
            +
                      # -- then --
         | 
| 440 | 
            +
                      # TODO: implement assertion code
         | 
| 441 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 442 | 
            +
                    ensure
         | 
| 443 | 
            +
                      case_after c
         | 
| 444 | 
            +
                      sf_hook = ret ? c[:success_hook] : c[:failure_hook]
         | 
| 445 | 
            +
                      sf_hook.call(c)
         | 
| 446 | 
            +
                    end
         | 
| 447 | 
            +
                  end
         | 
| 448 | 
            +
             | 
| 449 | 
            +
                  def case_before(c)
         | 
| 450 | 
            +
                    # implement each case before
         | 
| 451 | 
            +
                    File.open(REPORT_FILE, "a") {|f|f.print "method1\\t#\{c[:case_no]}\\t#\{c[:case_title]}"}
         | 
| 452 | 
            +
                  end
         | 
| 453 | 
            +
             | 
| 454 | 
            +
                  def case_after(c)
         | 
| 455 | 
            +
                    # implement each case after
         | 
| 456 | 
            +
                  end
         | 
| 457 | 
            +
                end
         | 
| 458 | 
            +
              end
         | 
| 459 | 
            +
             | 
| 460 | 
            +
              context :method2 do
         | 
| 461 | 
            +
                cases = [
         | 
| 462 | 
            +
                  {
         | 
| 463 | 
            +
                    case_no: 1,
         | 
| 464 | 
            +
                    case_title: "case_title",
         | 
| 465 | 
            +
                    expected: "expected",
         | 
| 466 | 
            +
                    success_hook: success,
         | 
| 467 | 
            +
                    failure_hook: failure
         | 
| 468 | 
            +
                  },
         | 
| 469 | 
            +
                ]
         | 
| 470 | 
            +
             | 
| 471 | 
            +
                cases.each do |c|
         | 
| 472 | 
            +
                  it "|case_no=\#{c[:case_no]}|case_title=\#{c[:case_title]}" do
         | 
| 473 | 
            +
                    begin
         | 
| 474 | 
            +
                      case_before c
         | 
| 475 | 
            +
             | 
| 476 | 
            +
                      # -- given --
         | 
| 477 | 
            +
                      hoge_core = Hoge::Core.new
         | 
| 478 | 
            +
             | 
| 479 | 
            +
                      # -- when --
         | 
| 480 | 
            +
                      # TODO: implement execute code
         | 
| 481 | 
            +
                      # actual = hoge_core.method2
         | 
| 482 | 
            +
             | 
| 483 | 
            +
                      # -- then --
         | 
| 484 | 
            +
                      # TODO: implement assertion code
         | 
| 485 | 
            +
                      # ret = expect(actual).to eq(c[:expected])
         | 
| 486 | 
            +
                    ensure
         | 
| 487 | 
            +
                      case_after c
         | 
| 488 | 
            +
                      sf_hook = ret ? c[:success_hook] : c[:failure_hook]
         | 
| 489 | 
            +
                      sf_hook.call(c)
         | 
| 490 | 
            +
                    end
         | 
| 491 | 
            +
                  end
         | 
| 492 | 
            +
             | 
| 493 | 
            +
                  def case_before(c)
         | 
| 494 | 
            +
                    # implement each case before
         | 
| 495 | 
            +
                    File.open(REPORT_FILE, "a") {|f|f.print "method2\\t#\{c[:case_no]}\\t#\{c[:case_title]}"}
         | 
| 496 | 
            +
                  end
         | 
| 497 | 
            +
             | 
| 498 | 
            +
                  def case_after(c)
         | 
| 499 | 
            +
                    # implement each case after
         | 
| 500 | 
            +
                  end
         | 
| 501 | 
            +
                end
         | 
| 502 | 
            +
              end
         | 
| 503 | 
            +
             | 
| 504 | 
            +
            end
         | 
| 505 | 
            +
            EOS
         | 
| 506 | 
            +
             | 
| 507 | 
            +
                cases = [
         | 
| 508 | 
            +
                  {
         | 
| 509 | 
            +
                    case_no: 1,
         | 
| 510 | 
            +
                    case_title: "only classname",
         | 
| 511 | 
            +
                    class_name: "Hoge::Core",
         | 
| 512 | 
            +
                    class_path: "hoge_core",
         | 
| 513 | 
            +
                    method_names: nil,
         | 
| 514 | 
            +
                    expected_file_name: "./spec/hoge_core_spec.rb",
         | 
| 515 | 
            +
                    expected_file_exists: true,
         | 
| 516 | 
            +
                    expected_contents: CASE1_EXPECTED
         | 
| 517 | 
            +
                  },
         | 
| 518 | 
            +
                  {
         | 
| 519 | 
            +
                    case_no: 2,
         | 
| 520 | 
            +
                    case_title: "classname(with module) and method_names",
         | 
| 521 | 
            +
                    class_name: "Hoge::Core",
         | 
| 522 | 
            +
                    class_path: "hoge_core",
         | 
| 523 | 
            +
                    method_names: ["method1", "method2"],
         | 
| 524 | 
            +
                    expected_file_name: "./spec/hoge_core_spec.rb",
         | 
| 525 | 
            +
                    expected_file_exists: true,
         | 
| 526 | 
            +
                    expected_contents: CASE2_EXPECTED
         | 
| 527 | 
            +
                  },
         | 
| 528 | 
            +
                  {
         | 
| 529 | 
            +
                    case_no: 3,
         | 
| 530 | 
            +
                    case_title: "classname(with no module) and method_names",
         | 
| 531 | 
            +
                    class_name: "OnlyClass",
         | 
| 532 | 
            +
                    class_path: "only_class",
         | 
| 533 | 
            +
                    method_names: ["method1", "method2"],
         | 
| 534 | 
            +
                    expected_file_name: "./spec/only_class_spec.rb",
         | 
| 535 | 
            +
                    expected_file_exists: true,
         | 
| 536 | 
            +
                    expected_contents: CASE3_EXPECTED
         | 
| 537 | 
            +
                  },
         | 
| 538 | 
            +
                  {
         | 
| 539 | 
            +
                    case_no: 4,
         | 
| 540 | 
            +
                    case_title: "with directory, classname(with module) and method_names",
         | 
| 541 | 
            +
                    class_name: "Hoge::Core",
         | 
| 542 | 
            +
                    class_path: "some_dir/hoge_core",
         | 
| 543 | 
            +
                    del_dir: "some_dir",
         | 
| 544 | 
            +
                    method_names: ["method1", "method2"],
         | 
| 545 | 
            +
                    expected_file_name: "./spec/some_dir/hoge_core_spec.rb",
         | 
| 546 | 
            +
                    expected_file_exists: true,
         | 
| 547 | 
            +
                    expected_contents: CASE4_EXPECTED
         | 
| 548 | 
            +
                  },
         | 
| 549 | 
            +
                  {
         | 
| 550 | 
            +
                    case_no: 5,
         | 
| 551 | 
            +
                    case_title: "nil_class",
         | 
| 552 | 
            +
                    class_name: nil,
         | 
| 553 | 
            +
                    class_path: "some_dir/hoge_core",
         | 
| 554 | 
            +
                    method_names: ["method1"],
         | 
| 555 | 
            +
                    expect_error: true
         | 
| 556 | 
            +
                  },
         | 
| 557 | 
            +
                  {
         | 
| 558 | 
            +
                    case_no: 6,
         | 
| 559 | 
            +
                    case_title: "empty_class",
         | 
| 560 | 
            +
                    class_name: "",
         | 
| 561 | 
            +
                    class_path: "empty_class",
         | 
| 562 | 
            +
                    method_names: ["method1"],
         | 
| 563 | 
            +
                    expect_error: true
         | 
| 564 | 
            +
                  },
         | 
| 565 | 
            +
                  {
         | 
| 566 | 
            +
                    case_no: 7,
         | 
| 567 | 
            +
                    case_title: "nil_class_path",
         | 
| 568 | 
            +
                    class_name: "nil_class_path",
         | 
| 569 | 
            +
                    class_path: nil,
         | 
| 570 | 
            +
                    method_names: ["method1"],
         | 
| 571 | 
            +
                    expect_error: true
         | 
| 572 | 
            +
                  },
         | 
| 573 | 
            +
                  {
         | 
| 574 | 
            +
                    case_no: 8,
         | 
| 575 | 
            +
                    case_title: "empty_class_path",
         | 
| 576 | 
            +
                    class_name: "empty_class_path",
         | 
| 577 | 
            +
                    class_path: "",
         | 
| 578 | 
            +
                    method_names: ["method1"],
         | 
| 579 | 
            +
                    expect_error: true
         | 
| 580 | 
            +
                  },
         | 
| 581 | 
            +
                  {
         | 
| 582 | 
            +
                    case_no: 9,
         | 
| 583 | 
            +
                    case_title: "with two directories, classname(with module) and method_names",
         | 
| 584 | 
            +
                    class_name: "Hoge::Core",
         | 
| 585 | 
            +
                    class_path: "some_dir/some_sub_dir/hoge_core",
         | 
| 586 | 
            +
                    del_dir: "some_dir",
         | 
| 587 | 
            +
                    method_names: ["method1", "method2"],
         | 
| 588 | 
            +
                    expected_file_name: "./spec/some_dir/some_sub_dir/hoge_core_spec.rb",
         | 
| 589 | 
            +
                    expected_file_exists: true,
         | 
| 590 | 
            +
                    expected_contents: CASE9_EXPECTED
         | 
| 591 | 
            +
                  },
         | 
| 592 | 
            +
                  {
         | 
| 593 | 
            +
                    case_no: 10,
         | 
| 594 | 
            +
                    case_title: "classname(with module) and method_names",
         | 
| 595 | 
            +
                    class_name: "Hoge::Core",
         | 
| 596 | 
            +
                    class_path: "hoge_core",
         | 
| 597 | 
            +
                    method_names: ["method1", "method2"],
         | 
| 598 | 
            +
                    reportable: true,
         | 
| 599 | 
            +
                    expected_file_name: "./spec/hoge_core_spec.rb",
         | 
| 600 | 
            +
                    expected_file_exists: true,
         | 
| 601 | 
            +
                    expected_contents: CASE10_EXPECTED
         | 
| 602 | 
            +
                  },
         | 
| 603 | 
            +
                ]
         | 
| 604 | 
            +
             | 
| 605 | 
            +
                cases.each do |c|
         | 
| 606 | 
            +
                  it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
         | 
| 607 | 
            +
                    begin
         | 
| 608 | 
            +
                      case_before c
         | 
| 609 | 
            +
             | 
| 610 | 
            +
                      # -- given --
         | 
| 611 | 
            +
                      piccolo = RSpecPiccolo::Core.new
         | 
| 612 | 
            +
             | 
| 613 | 
            +
                      # -- when --
         | 
| 614 | 
            +
                      if c[:expect_error]
         | 
| 615 | 
            +
                        lambda {piccolo.generate(c[:class_name], c[:class_path], c[:method_names], c[:reportable])}.should raise_error(RSpecPiccolo::RSpecPiccoloError)
         | 
| 616 | 
            +
                        # case_after c
         | 
| 617 | 
            +
                        next
         | 
| 618 | 
            +
                      end
         | 
| 619 | 
            +
                      piccolo.generate(c[:class_name], c[:class_path], c[:method_names], c[:reportable])
         | 
| 620 | 
            +
             | 
| 621 | 
            +
                      # -- then --
         | 
| 622 | 
            +
                      expect(File.exists?(c[:expected_file_name])).to be_true
         | 
| 623 | 
            +
                      actual = File.open(c[:expected_file_name]) {|f|f.read}
         | 
| 624 | 
            +
                      expect(actual).to eq(c[:expected_contents])
         | 
| 625 | 
            +
                    ensure
         | 
| 626 | 
            +
                      case_after c
         | 
| 627 | 
            +
                    end
         | 
| 628 | 
            +
                  end
         | 
| 629 | 
            +
             | 
| 630 | 
            +
                  def case_before(c)
         | 
| 631 | 
            +
                    # implement each case before
         | 
| 632 | 
            +
             | 
| 633 | 
            +
                  end
         | 
| 634 | 
            +
             | 
| 635 | 
            +
                  def case_after(c)
         | 
| 636 | 
            +
                    # implement each case after
         | 
| 637 | 
            +
                    return if c[:expect_error]
         | 
| 638 | 
            +
                    File.delete(c[:expected_file_name]) if File.exists?(c[:expected_file_name])
         | 
| 639 | 
            +
                    FileUtils.rm_rf("spec/some_dir")
         | 
| 640 | 
            +
                  end
         | 
| 641 | 
            +
                end
         | 
| 642 | 
            +
              end
         | 
| 643 | 
            +
            end
         |