Sha256: 2789720177424d5c79c5eeec1e4da062580296ece21d3315cce9e21a45c0c3e6

Contents?: true

Size: 1.66 KB

Versions: 15

Compression:

Stored size: 1.66 KB

Contents

require 'spec_helper'

%w[docomo au softbank].each do |carrier|
  shared_examples_for "non-#{carrier} devices" do
    it("should not be #{carrier}?") do
      @request.should_not send("be_#{carrier}")
    end
  end
  shared_examples_for "#{carrier} devices" do
    it("should be #{carrier}?") do
      @request.should send("be_#{carrier}")
    end
    it("should be galakei") { @request.should be_galakei }
  end
end

describe Galakei::Request do
  describe "from Firefox" do
    before { @request = Rack::Request.new(env_for("Firefox")) }
    it_should_behave_like "non-au devices"
    it_should_behave_like "non-docomo devices"
    it_should_behave_like "non-softbank devices"
    it("should not be galakei") { @request.should_not be_galakei }
  end

  describe "from Docomo SH-06A" do
    before { @request = Rack::Request.new(env_for("Docomo SH-06A")) }
    it_should_behave_like "docomo devices"
    it_should_behave_like "non-au devices"
    it_should_behave_like "non-softbank devices"
  end

  describe "from AU W51SH" do
    before { @request = Rack::Request.new(env_for("AU W51SH")) }
    it_should_behave_like "non-docomo devices"
    it_should_behave_like "non-softbank devices"
  end

  describe "from Vodafone 802N" do
    before { @request = Rack::Request.new(env_for("Vodafone 802N")) }
    it_should_behave_like "non-au devices"
    it_should_behave_like "non-docomo devices"
    it_should_behave_like "softbank devices"
  end

  describe "from Softbank 709SC" do
    before { @request = Rack::Request.new(env_for("Softbank 709SC")) }
    it_should_behave_like "non-au devices"
    it_should_behave_like "non-docomo devices"
    it_should_behave_like "softbank devices"
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
galakei-0.6.2 spec/galakei/request_spec.rb
galakei-0.6.1 spec/galakei/request_spec.rb
galakei-0.6.0 spec/galakei/request_spec.rb
galakei-0.5.1 spec/galakei/request_spec.rb
galakei-0.5.0 spec/galakei/request_spec.rb
galakei-0.4.1 spec/galakei/request_spec.rb
galakei-0.4.0 spec/galakei/request_spec.rb
galakei-0.3.8 spec/galakei/request_spec.rb
galakei-0.3.7 spec/galakei/request_spec.rb
galakei-0.3.6 spec/galakei/request_spec.rb
galakei-0.3.5 spec/galakei/request_spec.rb
galakei-0.3.4 spec/galakei/request_spec.rb
galakei-0.3.3 spec/galakei/request_spec.rb
galakei-0.3.2 spec/galakei/request_spec.rb
galakei-0.3.1 spec/galakei/request_spec.rb