http_stub 0.13.4 → 0.13.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.
- checksums.yaml +4 -4
 - data/lib/http_stub/rake/server_tasks.rb +6 -11
 - data/lib/http_stub/version.rb +1 -1
 - data/spec/lib/http_stub/rake/server_tasks_spec.rb +5 -30
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a55a4336aae9316c8d777ed41a0f0727a3e823f9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1626c8d91fed1870ba6c4876e281a60efe06cb66
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5a9281b96bad47e690cf8ab42b73ae0da0a52200561a307aaa0e2ea16e0c1cc1e4998ddf9779d311aeb67fb968fd9ede7b4fe4169ffef26ca8c2c84d2157047b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 802e5b6711c1f8c3468210dc27e3c9a2cbd9e5f6670c20fdbd4a23a63621252059231ffe11a292f7939e8075db0c33e513536b076c8f5bb4d7b2f220178868e5
         
     | 
| 
         @@ -6,10 +6,7 @@ module HttpStub 
     | 
|
| 
       6 
6 
     | 
    
         
             
                  def initialize(args)
         
     | 
| 
       7 
7 
     | 
    
         
             
                    namespace args[:name] do
         
     | 
| 
       8 
8 
     | 
    
         
             
                      define_start_task(args)
         
     | 
| 
       9 
     | 
    
         
            -
                      if args[:configurer]
         
     | 
| 
       10 
     | 
    
         
            -
                        define_initialize_task(args)
         
     | 
| 
       11 
     | 
    
         
            -
                        define_reset_task(args)
         
     | 
| 
       12 
     | 
    
         
            -
                      end
         
     | 
| 
      
 9 
     | 
    
         
            +
                      define_initialize_task(args) if args[:configurer]
         
     | 
| 
       13 
10 
     | 
    
         
             
                    end
         
     | 
| 
       14 
11 
     | 
    
         
             
                  end
         
     | 
| 
       15 
12 
     | 
    
         | 
| 
         @@ -29,13 +26,11 @@ module HttpStub 
     | 
|
| 
       29 
26 
     | 
    
         
             
                  end
         
     | 
| 
       30 
27 
     | 
    
         | 
| 
       31 
28 
     | 
    
         
             
                  def define_initialize_task(args)
         
     | 
| 
       32 
     | 
    
         
            -
                    desc "Configures stub #{args[:name]}"
         
     | 
| 
       33 
     | 
    
         
            -
                    task(:configure)  
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                    desc "Resets stub #{args[:name]} to its configured state"
         
     | 
| 
       38 
     | 
    
         
            -
                    task(:reset) { args[:configurer].reset! }
         
     | 
| 
      
 29 
     | 
    
         
            +
                    desc "Configures stub #{args[:name]} in its initial state"
         
     | 
| 
      
 30 
     | 
    
         
            +
                    task(:configure) do
         
     | 
| 
      
 31 
     | 
    
         
            +
                      args[:configurer].initialize!
         
     | 
| 
      
 32 
     | 
    
         
            +
                      args[:configurer].reset!
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
       39 
34 
     | 
    
         
             
                  end
         
     | 
| 
       40 
35 
     | 
    
         | 
| 
       41 
36 
     | 
    
         
             
                end
         
     | 
    
        data/lib/http_stub/version.rb
    CHANGED
    
    
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            describe HttpStub::Rake::ServerTasks do
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
              let(:default_args) { { port: 8001 } }
         
     | 
| 
       4 
     | 
    
         
            -
              let(:configurer)   { double(HttpStub::Configurer) }
         
     | 
| 
      
 4 
     | 
    
         
            +
              let(:configurer)   { double(HttpStub::Configurer).as_null_object }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              before(:each) { HttpStub::Rake::ServerTasks.new(default_args.merge(args)) }
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
         @@ -19,35 +19,10 @@ describe HttpStub::Rake::ServerTasks do 
     | 
|
| 
       19 
19 
     | 
    
         
             
                      Rake::Task["configure_task_configurer_provided_test:configure"].execute
         
     | 
| 
       20 
20 
     | 
    
         
             
                    end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                context "when a configurer is not provided" do
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                  let(:args) { { name: :configure_task_configurer_not_provided_test } }
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                  it "does not generate a task" do
         
     | 
| 
       31 
     | 
    
         
            -
                    lambda { Rake::Task["configure_task_configurer_not_provided_test:configure"] }.should
         
     | 
| 
       32 
     | 
    
         
            -
                      raise_error(/Don't know how to build task/)
         
     | 
| 
       33 
     | 
    
         
            -
                  end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
              end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
              describe "the reset task" do
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                context "when a configurer is provided" do
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                  let(:args) { { name: :reset_task_configurer_provided_test, configurer: configurer } }
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                  context "and the task is executed" do
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                    it "resets the provided configurer" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                    it "resets the provided configurer to ensure stubs are in their initial state" do
         
     | 
| 
       48 
23 
     | 
    
         
             
                      configurer.should_receive(:reset!)
         
     | 
| 
       49 
24 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                      Rake::Task[" 
     | 
| 
      
 25 
     | 
    
         
            +
                      Rake::Task["configure_task_configurer_provided_test:configure"].execute
         
     | 
| 
       51 
26 
     | 
    
         
             
                    end
         
     | 
| 
       52 
27 
     | 
    
         | 
| 
       53 
28 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -56,10 +31,10 @@ describe HttpStub::Rake::ServerTasks do 
     | 
|
| 
       56 
31 
     | 
    
         | 
| 
       57 
32 
     | 
    
         
             
                context "when a configurer is not provided" do
         
     | 
| 
       58 
33 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                  let(:args) { { name: : 
     | 
| 
      
 34 
     | 
    
         
            +
                  let(:args) { { name: :configure_task_configurer_not_provided_test } }
         
     | 
| 
       60 
35 
     | 
    
         | 
| 
       61 
36 
     | 
    
         
             
                  it "does not generate a task" do
         
     | 
| 
       62 
     | 
    
         
            -
                    lambda { Rake::Task[" 
     | 
| 
      
 37 
     | 
    
         
            +
                    lambda { Rake::Task["configure_task_configurer_not_provided_test:configure"] }.should
         
     | 
| 
       63 
38 
     | 
    
         
             
                      raise_error(/Don't know how to build task/)
         
     | 
| 
       64 
39 
     | 
    
         
             
                  end
         
     | 
| 
       65 
40 
     | 
    
         |